Using variables in VisualStudio Application settings - visual-studio

i have this little problem, i use the Application settings in VS 2010 to configure a path. now it would be convenient if i could add a variable there (its an argument) so it looks like this: C:\EXAMPLEDIR\... is there any way todo this?
Or should i change the settings at startup in code? is this even possible (i would like to avoid this).
thank you.
GuyFawkes.

You can also change the scope from Application to User. User settings can be modified at runtime. They are saved if/when you invoke the Save method.

I solved this by creating a method that catches the setting. For example SPECIALFOLDER\Subdir... and then replaces the SPECIALFOLDER with an Environment.SpecialFolder. Voila. Now i can e.g. access the system folder in NT, XP and 7. Plus i can add more custom MY VARIABLE items to replace them accordingly.
greetings

Related

Launcher.LaunchUriAsync does not work on Xamarin Forms UWP [duplicate]

no Error just nothing happen and file target still there in my path
public void keyboard(){
ProcessStartInfo touchkey = new ProcessStartInfo(#"C:\Program
Files\Common Files\microsoft shared\ink\TabTip.exe");
touchkey.WorkingDirectory = #"C:\";
touchkey.WindowStyle = ProcessWindowStyle.Hidden;
Process.Start(touchkey);
}
Update
The suggested solution threw a `UnauthorizedAccessException`:
var path = #"ms-appx://C:/Program Files/Common Files/microsoft
shared/ink/TabTip.exe";
var file = await
Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(path);
await Windows.System.Launcher.LaunchFileAsync(file);
Update2
I try to use FullTrustProcessLauncher it's work fine but like code before Keyboard tabtip.exe not show I dont know what should I do
await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
{
FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
});
UWP applications are sandboxed and cannot launch other processes directly due to security restrictions.
The only way to launch other applications is if those applications have a URI registered, or an application is a default handler for a particular file type.
In those instances, you can use methods such as LaunchUriAsync or LaunchFileAsync
Without TabTip.exe
I recognize you are trying to show the on-screen keyboard judging by the path of the exe. I suggest a better approach would be to trigger the new touch-enabled keyboard which is easily possible without additional hassle from UWP with InputPane API:
var pane = InputPane.GetForCurrentView();
pane.TryShow();
With TabTip.exe
If you prefer the older on-screen keyboard for some reason, you have two problems with your existing code.
Firstly, ms-appx: scheme is used to refer to files at the application installation path. The path you require is an absolute path, so you can't use it there.
Secondly, as this is an arbitrary path on the hard drive, you don't have access to it directly (as UWP apps run in a sandbox and can't access the filesystem directly for security reasons). To access the file, you will need to declare the broadFileSystemAccess capability, which will then allow you to initialize the StorageFile instance. You can check for example this SO question to learn how to do just that.
Note: I don't have my VS PC around so I can't say for sure if this will allow you to launch the executable or not, as that seems like an additional permission which may not be granted. In case this fails, I strongly recommend the first solution.
Make sure you edited the manifest file and add the extension for full trust process in the application.

Relocate default directory away from mywork in JDeveloper

When one googles something like this it pops out that one needs to change either JDEV_USER_DIR or set ide.user.dir parameter in Oracle_Home\jdeveloper\ide\bin\ide.boot file, but this is explicitly wrong. Changing ide.user.dir parameter relocates files where JDeveloper saves its parameters, not default folder for my projects. So, can someone give me the correct answer how do I replace the default folder for my projects (that is after installing JDeveloper)?
jdeveloper.exe -J-Dide.user.dir=C:\myWork
The first step in the wizard for application creation lets you choose where to place the application. I believe that after you set this for one application the next ones will follow along to the same directory by default.
According to the first link I found, http://www.catgovind.com/jdeveloper/where-is-jdeveloper-user-home-directory-in-windows/ and the explanation on https://tompeez.wordpress.com/2011/08/13/how-to-find-and-reset-the-system11-x-x-x-folder-for-a-jdeveloper-installation/ the way to set the working directory is to set the environment variable JDEV_USER_HOME. I set it to the value: %USERPROFILE%\Documents\JDeveloper
The proper answer here: https://agungor.wordpress.com/2012/12/06/how-to-change-default-open-application-folder-of-jdeveloper/
Just navigate to C:\Users....\AppData\Roaming\JDeveloper\system11.1.1.6.38.62.29\o.jdeveloper\applications.xml and change workDirectory attribute

FileOpenDialog from vbScript custom action appears behind main dialog

I'm creating an installer at work that must open a file browser. There is no file browser in wix, so I built a custom vbscript action that uses the Shell.BrowseForFolder method. It's working fine, but the file dialog shows up behind the main wix window. Does anyone know a wix/vbscript approach I could take to solve this problem?
Locate the HWND for the MSI UI and pass this into Shell.BrowseForFolder. I see a few example solutions that use FindWindow("MsiDialogCloseClass", vbNullString). Be careful about launching UI from a custom action: you need to consider silent installs/repair/uninstall, etc to make sure you get it right in all cases.
It looks like you're trying to allow the user to pick a directory. MSI has native support for this. I reccomend you use that. For an example see http://wix.codeplex.com/SourceControl/latest#src/ext/UIExtension/wixlib/BrowseDlg.wxs.

Add a watch to an instance instead of a variable

Is there a way to add a watch to an instance of a object, instead to a variable? I have an object that is passed through various functions via parameters, and the parameters name may change in each function, so I'd like to add a watch that would be 'fixed' to that instance, regardless of the variable its currently assigned to.
Does anyone knows a way to do that? I'm using Visual Studio 2012.
When you add the item to the Watch window, try right-clicking on that entry and choose Make Object ID. Then add a watch for the particular ID (1#, 2#, etc.) See this link for more info.

Where is where is microsoft.office.tools.word.factory?

I'm in VS2010, in a new Word Add-In project. This is my first attempt at Word development using VSTO. The example I'm trying has this line:
Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
But when I add this line Visual Studio says it can't find "Factory". Indeed, it's not in Intellisense.
I've got references to:
Accessibility
Microsoft.Office.Interop.Word
Microsoft.Office.Tools.Common.v9.0
Microsoft.Office.Tools.v9.0
Microsoft.Office.Tools.Word.v9.0
Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0
Office
and all the usual System references.
Where am I going wrong and why can't I get to "Factory"?
stdole
That example looks a bit weird to me. Never seen that sort of reference before.
Generally, with Vsto, you hook into EVENTS on, say, the main Word App object.
Then, from within the event, you usually are passed a reference to the particular DOC object that the event is occurring for (say, being opened or saved, etc). In that way, there shouldn't be any need for using the "globals" object or the "factory" object, whereever they might be.
What method is that code in? A little more context might help.
I think the recommended way of doing this is:
Globals.ThisAddin.Application.ActiveDocument

Resources