How can I configure Editor Tracking in ArcObjects 10.3 for .net for a table programmatically? - arcgis

I use ArcObjects for .net for ArcGis 10.3.
I didn't find any interface to configure editor tracking for a table of GDB database.
How can I configure Editor Tracking for a table programmatically?
I found interface IDEEditorTracking but I didn't find a method to use it.

For your reference..first you need to find the dataelement(IDataElement) and then use enable editor geoprocessing tool..
IWorkspace pworkspace = ((IDataset)pfeaturelayer.FeatureClass).Workspace;
IGeoProcessor pGP = new GeoProcessor();
IGPDataType pGPDataType = new DEFeatureClassType() as IGPDataType;
IDataElement pDataElement = pGP.GetDataElement(pworkspace.PathName, pGPDataType);
IDEEditorTracking editorTracking = (IDEEditorTracking)pDataElement;
if (!editorTracking.EditorTrackingEnabled)
{
//now use Enable Editor Tracking geoprocessor tool
}

Related

Is it possible to add a progress bar to the taskbar icon of a Windows Forms App? [duplicate]

Windows 7 has an AWESOME new feature that applications can report the progress of the current activity through the status bar. For example, when copying file(s) using Windows Explorer, a progress bar is layered on top of the application icon in the task bar and the progress is shown as it updates.
What is the API for exposing the progress bar? Is there MSDN documentation on it?
For below .NET 4, or WinForms in any .NET version
Using the Windows API Code Pack from Microsoft (as Keeron mentioned), it's really simple. You just need to use the TaskbarManager. E.g.
To start the progress:
TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.Normal);
To update the progress:
TaskbarManager.Instance.SetProgressValue(currentValue, maxProgressValue);
And when when you're done, to end the progress:
TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
There is more you can do, but that should get you started and might be all you need.
For .NET 4 and above with WPF
You can use System.Windows.Shell.TaskbarItemInfo. E.g. in the Xaml for your main window, you'll need to add:
<Window.TaskbarItemInfo>
<TaskbarItemInfo x:Name="taskBarItemInfo" />
</Window.TaskbarItemInfo>
Then to update the progress, you would do something like:
taskBarItemInfo.ProgressState = TaskbarItemProgressState.Normal;
for (int i = 0; i < 100; i++)
{
taskBarItemInfo.ProgressValue = i / 100.0;
Thread.Sleep(50); // whatever the 'work' really is
}
taskBarItemInfo.ProgressState = TaskbarItemProgressState.None;
Don't forget that if you're doing the 'work' on a background thread (which is probably a good idea for long running tasks), you will need to switch back to the UI thread to update the taskbar.
There's a good article in MSDN magazine about the new taskbar APIs. And yes, the feature is awesome :-)
Essentially, it's all about implementing IFileOperation. There's a good article about using it in managed code here.
If you plan to use other Windows 7 Taskbar features, another approach would be to use the library from Microsoft: Windows API Code Pack for .NET Framework which is no longer available at the old link, but can be found on nuget.
I've written an article about implementing the Windows 7 Taskbar progress API in C# (see: Windows 7 Taskbar Progress Bar with C# and .NET). The control is open source (BSD) and has example projects for C# and VB.NET.
This way you don't have to convert the C++ code from scratch.
Actually I use Telerik's RadWindow which you cannot just use <telerik:RadWindow.TaskbarItemInfo>. So I use this workaround for net6.0-windows WPF:
In code behind file I made a property:
public Lazy<TaskbarItemInfo> TaskbarItemInfo { get; set; } = new Lazy<TaskbarItemInfo>(() =>
{
return System.Windows.Application.Current.MainWindow.TaskbarItemInfo = new TaskbarItemInfo();
});
In method part of BackgroundWorker
private void WorkerProgressChanged(object sender, ProgressChangedEventArgs e)
I set the value of the progress:
TaskbarItemInfo.Value.ProgressState = TaskbarItemProgressState.Normal;
TaskbarItemInfo.Value.ProgressValue = (double)progressUserState.ProgressInPercent / 100;
In
private void WorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
I reset the state:
TaskbarItemInfo.Value.ProgressValue = 0;
TaskbarItemInfo.Value.ProgressState = TaskbarItemProgressState.None;

Windows Phone ThemeManager

is it possible to for example - write a background service, which randomly changes the windows phone theme, I mean is it possible to access the windows phone theme under settings via code? and change it?
if so can you please give me an example of the API's I can use or additional libraries I can dl
thank you
Unfortunately you can't. It is not possible to change the Windows Phone theme by code. The only one who can is the user. This is part of the Windows Phone concept.
The only thing you can do is defining themes that are used in your own apps.
Sorry for the bad news...
You are allowed to change the theme for your application. There is a Nuget package available that makes this even easier. You could accomplish changing it in a background task by setting a property that you check when the app opens.
// background agent code
// get random value
IsolatedStorageSettings.ApplicationSettings["Theme"] = randomValue; // this is just a string or something simple
IsolatedStorageSettings.ApplicationSettings.Save();
When your app opens, you would check this value
var theme = "Standard";
if(IsolatedStorageSettings.ApplicationSettings.ContainsValue("Theme"))
{
theme = IsolatedStorageSettings.ApplicationSettings["Theme"];
// Set the theme
}
You can modify the source of the Theme Manager by downloading the source from github. Here is some more info on the Theme Manager. If you would like to change values yourself, you can accomplish this by setting the resource values when the papp starts
((SolidColorBrush)Resources["PhoneAccentBrush"]).Color = myAccentBrush;
((SolidColorBrush)Resources["PhoneBackgroundBrush"]).Color = myBackgroundBrush;
((SolidColorBrush)Resources["PhoneChromeBrush"]).Color = myChromeBrush;
((SolidColorBrush)Resources["PhoneForegroundBrush"]).Color = myForegroundBrush;

Better way to use Velocity's GenericTools in a Standalone app?

I want to use VelocityTool's GenericTools for some standard formatting in a standalone app. e.g. have something like this in my Velocity template to use the GenericTools' NumberTool formatter:
Total: $numberTool.format("#0.00", $totalPnL)
How do I associate the above "$numberTool" with the GenericTool NumberTool. Here's my Velocity code:
Velocity.init();
VelocityContext velocityContext = new VelocityContext();
Template template = Velocity.getTemplate("example.vm");
velocityContext.put("totalPnL", 100);
StringWriter sw = new StringWriter();
template.merge(velocityContext, sw);
Now I know I can do this to get it to work:
velocityContext.put("numberTool", new NumberTool());
But is that how I need to add all the GenericTools to my app? Manually and one at a time (e.g. another line for DateTool ... etc)? Isn't there a way to make all the GenericTools exposed to my template with out this? I know there's a "tools.xml" that comes with VelocityTools that has the GenericTools defined. Can I just add that to my app to expose all the tools? If so, how?
thanks,
David
http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/ToolManager.html
http://velocity.apache.org/tools/devel/standalone.html
The default tool configuration provides all the generic tools already. Though you can create a config if you want to configure those tools. There's even auto loading for configurations, or manual specification.
ToolManager tm = new ToolManager();
tm.setVelocityEngine(yourVelocityEngine);
Context context = tm.createContext();
it is at least the way I do it too.
I'll put for example
context.put("esc", new EscapeTool());
and in the template I simply use then
${esc.h}
to write a "#" in the code so that Velocity does not parse it as "velocity-script".
I think those helper tools are rather utils and only cover some basic signs. They are not intend to be a standard, you rather can include them on-demand.
I've build for example an abstract class that loads the context of velocity and puts the EscapeTool into the context all the time so that I do not have to add it everywhere.
Good luck with your project
Sebastian

How to expose the content formatter in a custom Eclipse editor?

I am writing a custom Eclipse editor by subclassing TextEditor, and I can't use the Format action that I configured.
I read the 3 parts in Creating a commercial quality IDE, and I know about SourceViewerConfiguration. I implemented the required method:
override def getContentFormatter(viewer: ISourceViewer) = {
val formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(viewer), IDocument.DEFAULT_CONTENT_TYPE)
formatter.setMasterStrategy(new ScalaFormattingStrategy(textEditor))
formatter
}
However, I can't find Format anywhere in the menu, contextual menu, toolbar, etc. The Java shortcut (CMD-Shift-F) does not work either.
Edit: I have implemented other methods in the SourceViewerConfiguration subclass I created, and everything else works as expected in my editor (completion, hyperlinking, reconciliation).
What is the preferred way to expose the formatter? Do I need to do anything more?
Quoting the Eclipse formatter FAQ:
Finally, you will need to create an action that invokes the formatter.
No generic formatting action is defined by the text infrastructure,
but it is quite easy to create one of your own. The action’s run
method can simply call the following on the source viewer to invoke
the formatter:
sourceViewer.doOperation(ISourceViewer.FORMAT);

AIR: How to set NativeWindow type to Utility

The nativeWindow supports systemChrome (standard,none) and transparent (false,true); These options are in the Adobe AIR Application Descriptor File (xml)
<!-- The type of system chrome to use (either "standard" or "none"). Optional. Default standard. -->
<!-- <systemChrome></systemChrome> -->
<!-- Whether the window is transparent. Only applicable when systemChrome is none. Optional. Default false. -->
<!-- <transparent></transparent> -->
But I can't find the option to set the window type (utility,normal,lightweight) as seen on the TourDeFlex under Air Applications -> AIR APIs and Techniques -> Native Windows.
From the application can be accessed just as a read-only property.
Where's the right place to set this property?
A good example of usage could be: minitask.org
Thanks!
Edit: The window should start in the UTILITY mode
you have to set the NativeWindowType of your window via NativeWindowInitOptions's type property when you instantiate a window.
more here: AIR Window Basics
You may not be able to do this with a main application window. A trick you could use is:
function MainConstructor() {
var opt:NativeWindowInitOptions = new NativeWindowInitOptions();
opt.type = NativeWindowType.UTILITY;
var window:NativeWindow = new NativeWindow(opt);
window.activate();
window.stage.addChild(new PreviousMainConstructor());
stage.nativeWindow.close();
}
this just opens a new utility window, and closes the main application window
this.type = NativeWindowType.UTILITY;