Пример #1
0
        protected virtual void Runner_ProcessEnded(object sender, int exitCode)
        {
            runner = null;
            DisplayErrors();

            ProjectWatcher.ForceRefresh();
        }
Пример #2
0
        public static void Execute(string command, string path1, string path2)
        {
            string           args = String.Format("/command:{0} /path:\"{1}\" /path2:\"{2}\"", command, path1, path2);
            ProcessStartInfo info = new ProcessStartInfo(GetTortoiseProc(), args);

            info.UseShellExecute = true;

            var proc = new Process
            {
                StartInfo           = info,
                EnableRaisingEvents = true
            };

            proc.Exited += (sender, eventArgs) => ProjectWatcher.ForceRefresh();
            proc.Start();
        }
Пример #3
0
        public static void ExecuteCustom(string command, string arguments)
        {
            string args = "/command:" + command + " " + arguments;
            var    info = new ProcessStartInfo(GetTortoiseProc(), args)
            {
                UseShellExecute = true
            };

            var proc = new Process
            {
                StartInfo           = info,
                EnableRaisingEvents = true
            };

            proc.Exited += (sender, eventArgs) => ProjectWatcher.ForceRefresh();
            proc.Start();
        }
Пример #4
0
        static public void Execute(string command, string path)
        {
            string           args = String.Format("{0} \"{1}\"", command, path);
            ProcessStartInfo info = new ProcessStartInfo(GetTortoiseProc(), args);

            info.UseShellExecute = false;
            info.CreateNoWindow  = true;

            var proc = new Process
            {
                StartInfo           = info,
                EnableRaisingEvents = true
            };

            proc.Exited += (sender, eventArgs) => ProjectWatcher.ForceRefresh();
            proc.Start();
        }
Пример #5
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
        {
            switch (e.Type)
            {
            case EventType.UIStarted:
                ProjectWatcher.Init();
                this.ready = true;
                break;

            // Catches Project change event and display the active project path
            case EventType.Command:
                if (!this.ready)
                {
                    return;
                }
                DataEvent de  = e as DataEvent;
                String    cmd = de.Action;
                if (!cmd.StartsWithOrdinal("ProjectManager."))
                {
                    return;
                }
                switch (cmd)
                {
                case ProjectManagerEvents.Project:
                    ProjectWatcher.SetProject(de.Data as Project);
                    break;

                case ProjectManagerEvents.TreeSelectionChanged:
                    ProjectWatcher.SelectionChanged();
                    break;

                case ProjectManagerEvents.UserRefreshTree:
                    ProjectWatcher.ForceRefresh();
                    break;

                case ProjectFileActionsEvents.FileBeforeRename:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileBeforeRename(de.Data as String);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileRename:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileRename(de.Data as String[]);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileDeleteSilent:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileDelete(de.Data as String[], false);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileDelete:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileDelete(de.Data as String[], true);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileMove:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileMove(de.Data as String[]);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectManagerEvents.BuildProject:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleBuildProject();
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectManagerEvents.TestProject:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleTestProject();
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectManagerEvents.BeforeSave:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleSaveProject((string)de.Data);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;
                }
                break;

            case EventType.FileOpen:
                try
                {
                    e.Handled = ProjectWatcher.HandleFileOpen((e as TextEvent).Value);
                }
                catch (Exception ex)
                {
                    ErrorManager.ShowError(ex);
                    e.Handled = true;
                }
                break;

            case EventType.FileReload:
                try
                {
                    e.Handled = ProjectWatcher.HandleFileReload((e as TextEvent).Value);
                }
                catch (Exception ex)
                {
                    ErrorManager.ShowError(ex);
                    e.Handled = true;
                }
                break;

            case EventType.FileModifyRO:
                try
                {
                    e.Handled = ProjectWatcher.HandleFileModifyRO((e as TextEvent).Value);
                }
                catch (Exception ex)
                {
                    ErrorManager.ShowError(ex);
                    e.Handled = true;
                }
                break;

            case EventType.FileNew:
            case EventType.FileTemplate:
                try
                {
                    e.Handled = ProjectWatcher.HandleFileNew((e as TextEvent).Value);
                }
                catch (Exception ex)
                {
                    ErrorManager.ShowError(ex);
                    e.Handled = true;
                }
                break;

            case EventType.ApplyTheme:
                AnnotatedDocument.ApplyTheme();
                break;
            }
        }
Пример #6
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority priority)
        {
            switch (e.Type)
            {
            case EventType.UIStarted:
                ProjectWatcher.Init();
                this.ready = true;
                break;

            // Catches Project change event and display the active project path
            case EventType.Command:
                if (!this.ready)
                {
                    return;
                }
                DataEvent de  = e as DataEvent;
                String    cmd = de.Action;
                if (!cmd.StartsWithOrdinal("ProjectManager."))
                {
                    return;
                }
                switch (cmd)
                {
                case ProjectManagerEvents.Project:
                    ProjectWatcher.SetProject(de.Data as Project);
                    break;

                case ProjectManagerEvents.TreeSelectionChanged:
                    ProjectWatcher.SelectionChanged();
                    break;

                case ProjectManagerEvents.UserRefreshTree:
                    ProjectWatcher.ForceRefresh();
                    break;

                case ProjectFileActionsEvents.FileBeforeRename:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileBeforeRename(de.Data as String);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileRename:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileRename(de.Data as String[]);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileDeleteSilent:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileDelete(de.Data as String[], false);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectManagerEvents.FilePasted:         //ProjectFileActionsEvents.FilePaste
                    //cannot distinguish between copy and cut, so assume it was copied
                    var files = de.Data as Hashtable;
                    ProjectWatcher.HandleFileCopied((string)files["fromPath"], (string)files["toPath"]);
                    break;


                case ProjectFileActionsEvents.FileDelete:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileDelete(de.Data as String[], true);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileMove:         //this is never called, because CodeRefactor catches it before us
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileMove(de.Data as String[]);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectManagerEvents.FileMoved:
                    try
                    {
                        var file = de.Data as Hashtable;
                        ProjectWatcher.HandleFileMoved((string)file["fromPath"], (string)file["toPath"]);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectManagerEvents.BuildProject:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleBuildProject();
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectManagerEvents.TestProject:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleTestProject();
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectManagerEvents.BeforeSave:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleSaveProject((string)de.Data);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;
                }
                break;

            case EventType.FileOpen:
                try
                {
                    e.Handled = ProjectWatcher.HandleFileOpen((e as TextEvent).Value);
                }
                catch (Exception ex)
                {
                    ErrorManager.ShowError(ex);
                    e.Handled = true;
                }
                break;

            case EventType.FileReload:
                try
                {
                    e.Handled = ProjectWatcher.HandleFileReload((e as TextEvent).Value);
                }
                catch (Exception ex)
                {
                    ErrorManager.ShowError(ex);
                    e.Handled = true;
                }
                break;

            case EventType.FileModifyRO:
                try
                {
                    e.Handled = ProjectWatcher.HandleFileModifyRO((e as TextEvent).Value);
                }
                catch (Exception ex)
                {
                    ErrorManager.ShowError(ex);
                    e.Handled = true;
                }
                break;

            case EventType.FileNew:
            case EventType.FileTemplate:
                try
                {
                    string file = (e as TextEvent).Value;
                    if (File.Exists(file))
                    {
                        e.Handled = ProjectWatcher.HandleFileNew(file);
                    }
                }
                catch (Exception ex)
                {
                    ErrorManager.ShowError(ex);
                    e.Handled = true;
                }
                break;

            case EventType.ApplyTheme:
                AnnotatedDocument.ApplyTheme();
                break;
            }
        }
Пример #7
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
        {
            switch (e.Type)
            {
            case EventType.UIStarted:
                ProjectWatcher.Init();
                this.ready = true;
                break;

            // Catches Project change event and display the active project path
            case EventType.Command:
                if (!this.ready)
                {
                    return;
                }
                DataEvent de  = e as DataEvent;
                String    cmd = de.Action;
                if (!cmd.StartsWith("ProjectManager."))
                {
                    return;
                }
                switch (cmd)
                {
                case ProjectManagerEvents.Project:
                    ProjectWatcher.SetProject(de.Data as Project);
                    break;

                case ProjectManagerEvents.TreeSelectionChanged:
                    ProjectWatcher.SelectionChanged();
                    break;

                case ProjectManagerEvents.UserRefreshTree:
                    ProjectWatcher.ForceRefresh();
                    break;

                case ProjectFileActionsEvents.FileBeforeRename:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileBeforeRename(de.Data as String);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileRename:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileRename(de.Data as String[]);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileDeleteSilent:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileDelete(de.Data as String[], false);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileDelete:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileDelete(de.Data as String[], true);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;

                case ProjectFileActionsEvents.FileMove:
                    try
                    {
                        de.Handled = ProjectWatcher.HandleFileMove(de.Data as String[]);
                    }
                    catch (Exception ex)
                    {
                        ErrorManager.ShowError(ex);
                        de.Handled = true;
                    }
                    break;
                }
                break;
            }
        }