/// <summary>
        /// Notifies clients of changes made to a directory.
        /// </summary>
        /// <param name="dir">
        /// Name of the directory that had a change.
        /// </param>
        public int DirectoryChanged(string dir)
        {
            MacroFSNode node = MacroFSNode.FindNodeFromFullPath(dir);

            if (node != null)
            {
                // Refresh tree rooted at the changed directory
                MacroFSNode.RefreshTree(node);
            }

            return(VSConstants.S_OK);
        }
        /// <summary>
        /// Notifies clients of changes made to one or more files.
        /// </summary>
        /// <param name="numberOfFilesChanged">
        /// Number of files changed.
        /// </param>
        /// <param name="files">
        /// Array of file names.
        /// </param>
        /// <param name="typesOfChange">
        /// Array of flags indicating the type of changes. <see cref="_VSFILECHANGEFLAGS" />.
        public int FilesChanged(uint numberOfFilesChanged, string[] files, uint[] changeTypes)
        {
            // Go over each file and treat the change appropriately
            for (int i = 0; i < files.Length; i++)
            {
                string             path   = files[i];
                _VSFILECHANGEFLAGS change = (_VSFILECHANGEFLAGS)changeTypes[i];

                // _VSFILECHANGEFLAGS.VSFILECHG_Add is handled by DirectoryChanged
                // Only handle _VSFILECHANGEFLAGS.VSFILECHG_Del here
                if (change == _VSFILECHANGEFLAGS.VSFILECHG_Del)
                {
                    MacroFSNode node = MacroFSNode.FindNodeFromFullPath(path);
                    if (node != null)
                    {
                        node.Delete();
                    }
                }
            }

            return(VSConstants.S_OK);
        }
Beispiel #3
0
        public void AssignShortcut()
        {
            AssignShortcutDialog dlg = new AssignShortcutDialog();

            dlg.ShowDialog();

            if (dlg.DialogResult == true)
            {
                MacroFSNode macro = this.SelectedMacro;

                // Remove old shortcut if it exists
                if (macro.Shortcut != MacroFSNode.None)
                {
                    Manager.Shortcuts[macro.Shortcut] = string.Empty;
                }

                int newShortcutNumber = dlg.SelectedShortcutNumber;

                // At this point, the shortcut has been removed
                // Assign a new one only if the user selected a key binding
                if (newShortcutNumber != MacroFSNode.None)
                {
                    // Get the node that previously owned that shortcut
                    MacroFSNode previousNode = MacroFSNode.FindNodeFromFullPath(Manager.Shortcuts[newShortcutNumber]);

                    // Update dictionary
                    Manager.Shortcuts[newShortcutNumber] = macro.FullPath;

                    // Update the UI binding for the old node
                    previousNode.Shortcut = MacroFSNode.ToFetch;
                }

                // Update UI with new macro's shortcut
                macro.Shortcut = MacroFSNode.ToFetch;

                // Mark the shortcuts in memory as dirty
                this.shortcutsDirty = true;
            }
        }
Beispiel #4
0
 private void MacroTreeView_Loaded(object sender, RoutedEventArgs e)
 {
     // Select Current macro
     MacroFSNode.FindNodeFromFullPath(Manager.CurrentMacroPath).IsSelected = true;
 }