Ejemplo n.º 1
0
        public MainWindow()
        {
            this.MoveToOtherContextMenuHeader = "Move to Machine";

            InitializeComponent();

            var permissions = new EnvironmentPermission(EnvironmentPermissionAccess.AllAccess, "PATH");
            permissions.Demand();

            this.DataContext = this;
            uxPaths.ItemsSource = paths;

            this.AddShortcut(new KeyGesture(Key.Z, ModifierKeys.Control), Undo);
            this.AddShortcut(new KeyGesture(Key.Y, ModifierKeys.Control), Redo);
            uxPaths.AddShortcut(new KeyGesture(Key.Up, ModifierKeys.Control), MoveUp);
            uxPaths.AddShortcut(new KeyGesture(Key.Down, ModifierKeys.Control), MoveDown);
            uxPaths.AddShortcut(new KeyGesture(Key.Delete), Delete);

            GongSolutions.Wpf.DragDrop.DragDrop.SetIsDragSource(uxPaths, true);
            GongSolutions.Wpf.DragDrop.DragDrop.SetIsDropTarget(uxPaths, true);
            GongSolutions.Wpf.DragDrop.DragDrop.SetDropHandler(uxPaths, this);
        }
Ejemplo n.º 2
0
 public static bool SetEnvironmentVariableEx(string environmentVariable, string variableValue)
 {
     try
     {
         EnvironmentPermission environmentPermission = new EnvironmentPermission(EnvironmentPermissionAccess.Write, environmentVariable);
         environmentPermission.Demand();
         System.Environment.SetEnvironmentVariable(environmentVariable, variableValue);
         return true;
     }
     catch
     {
         throw new Qt5VSException(SR.GetString("HelperFunctions_CannotWriteEnvQTDIR"));
     }
 }