Beispiel #1
0
        public string[] OpenProject()
        {
            string text = null;

            using (OpenFileDialog openFileDialog = new OpenFileDialog())
            {
                openFileDialog.CheckFileExists = true;
                openFileDialog.CheckPathExists = true;
                openFileDialog.ValidateNames   = true;
                openFileDialog.Title           = SR.GetString("PrjMgr_OpenTitle");
                openFileDialog.Filter          = SR.GetString("PrjMgr_OpenFilter");
                openFileDialog.FilterIndex     = 0;
                openFileDialog.Multiselect     = false;
                if (userIP.ShowDialog(openFileDialog, null) != DialogResult.OK)
                {
                    return(null);
                }
                text = openFileDialog.FileName;
            }
            if (!CloseProject())
            {
                return(null);
            }
            currentProjectFilePath = null;
            PersistedSettings.SaveRecentFiles(new string[1]
            {
                text
            }, isProject: true);
            openedFilePaths = new List <string>();
            if (!string.IsNullOrEmpty(text) && text.EndsWith(SR.GetString("PJ_Extension"), StringComparison.OrdinalIgnoreCase))
            {
                return(ExtraceFilePathsFromProject(text));
            }
            return(null);
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing && components != null)
     {
         components.Dispose();
     }
     PersistedSettings.SaveRecentFindStringList(recentFindStringList);
     base.Dispose(disposing);
 }
        internal void Initialize(TraceViewerForm parentForm, IUserInterfaceProvider uiProvider)
        {
            this.parentForm = parentForm;
            this.uiProvider = uiProvider;
            parentForm.ObjectStateController.RegisterStateSwitchListener(objectStateController);
            parentForm.LeftPanelStateController.RegisterStateSwitchListener(parentLeftPanelObjectStateController);
            parentForm.LeftPanelStateController.SwitchState("LeftPanelActivityViewState");
            lookinList.SelectedIndex = 0;
            recentFindStringList     = PersistedSettings.LoadRecentFindStringList();
            RefreshAutoCompleteSource();
            TraceViewerForm traceViewerForm = this.parentForm;

            traceViewerForm.FindTextChangedCallback = (TraceViewerForm.FindTextChanged)Delegate.Combine(traceViewerForm.FindTextChangedCallback, new TraceViewerForm.FindTextChanged(TraceViewerForm_FindTextChanged));
        }
Beispiel #4
0
 public string[] OpenProject(string projectPath)
 {
     if (!string.IsNullOrEmpty(projectPath) && projectPath.EndsWith(SR.GetString("PJ_Extension"), StringComparison.OrdinalIgnoreCase))
     {
         if (!CloseProject())
         {
             return(null);
         }
         PersistedSettings.SaveRecentFiles(new string[1]
         {
             projectPath
         }, isProject: true);
         return(ExtraceFilePathsFromProject(projectPath));
     }
     return(null);
 }
Beispiel #5
0
        private bool SaveProjectToFile(string filePath)
        {
            List <string> list          = openedFilePaths;
            FileStream    fileStream    = null;
            XmlTextWriter xmlTextWriter = null;

            try
            {
                fileStream    = Utilities.CreateFileStreamHelper(filePath, FileMode.Create, FileAccess.Write, FileShare.Read);
                xmlTextWriter = new XmlTextWriter(fileStream, Encoding.UTF8);
            }
            catch (LogFileException ex)
            {
                throw new TraceViewerException(ex.Message);
            }
            catch (ArgumentException)
            {
                throw new TraceViewerException(SR.GetString("MsgFailSavePrj") + filePath);
            }
            if (!ComposeProjectFileStream(xmlTextWriter, filePath))
            {
                openedFilePaths = list;
                return(false);
            }
            try
            {
                xmlTextWriter.Close();
                PersistedSettings.SaveRecentFiles(new string[1]
                {
                    filePath
                }, isProject: true);
            }
            catch (InvalidOperationException)
            {
                openedFilePaths = list;
                return(false);
            }
            finally
            {
                Utilities.CloseStreamWithoutException(fileStream, isFlushStream: false);
            }
            return(true);
        }