Esempio n. 1
0
        private void Attach(IVsDebugger debugger)
        {
            var process = Process;

            if (process != null)
            {
                if (!VsEnvironment.IsDebuggerPresent(process))
                {
                    try
                    {
                        debugger.Attach(process.Id);
                        AttachVisibility = System.Windows.Visibility.Collapsed;
                        DetachVisibility = System.Windows.Visibility.Visible;

                        DetachCommand = new ActionCommand(() => { Detach(debugger); },
                                                          Service.Status == ServiceControllerStatus.Running &&
                                                          VsEnvironment.Debuggers.Any());
                        OnPropertyChanged("DetachCommand");
                    }
                    catch (COMException e)
                    {
                        MessageBox.Show(e.Message);
                    }
                }
            }
            ((ActionCommand)AttachCommand).Enabled =
                Service.Status == ServiceControllerStatus.Running &&
                VsEnvironment.Debuggers.Any();
        }
Esempio n. 2
0
        public async Task <bool> ItemIsUnderSourceControl(string filename)
        {
            try
            {
                var vp = VsEnvironment.GetService <IVersionControlProvider>();
                if (vp != null)
                {
                    bool isBound;
                    vp.IsFileBoundToSCC(filename, out isBound);
                    return(isBound);
                }
                var statusOutput = TaskResult = await TfExec("info \"" + filename + "\"");

                if (statusOutput.StartsWith("No items match"))
                {
                    return(false);
                }
                return(true);
            }
            catch (FileNotFoundException e /* ?? .. trying to find a reported error #35 */)
            {
                if (_tfexe != null) // TFS wouldn't have worked anyway
                {
                    _logger.LogWarn(e.ToString());
                }
                return(false);
            }
        }