Example #1
0
            protected override void DoPaste()
            {
                var standardPeptidesNew = new List <StandardPeptide>();

                GridView.DoPaste(MessageParent, ValidateRowWithTime,
                                 values =>
                                 standardPeptidesNew.Add(new StandardPeptide
                {
                    Target        = new Target(values[0]),
                    RetentionTime = double.Parse(values[1])
                }));

                string message = ValidateUniquePeptides(standardPeptidesNew.Select(p => p.Target), null, null);

                if (message != null)
                {
                    MessageDlg.Show(MessageParent, message);
                    return;
                }

                if (standardPeptidesNew.Count > 0)
                {
                    standardPeptidesNew[0].FixedPoint = true;
                    standardPeptidesNew[standardPeptidesNew.Count - 1].FixedPoint = true;
                }
                Items.Clear();
                foreach (var peptide in standardPeptidesNew)
                {
                    Items.Add(peptide);
                }
            }
Example #2
0
        public void OkDialog()
        {
            if (treeViewFolders.SelectedNode == null || treeViewFolders.SelectedNode.Level == 0)
            {
                // Prompt the user to select a folder if no node is selected or only the top-level node
                // (the server name) is selected.
                MessageDlg.Show(this, Resources.PublishDocumentDlg_OkDialog_Please_select_a_folder);
                return;
            }

            FolderInformation folderInfo = treeViewFolders.SelectedNode.Tag as FolderInformation;

            if (folderInfo == null)
            {
                MessageDlg.Show(this, Resources.PublishDocumentDlg_UploadSharedZipFile_Error_obtaining_server_information);
                return;
            }
            if (!folderInfo.HasWritePermission)
            {
                MessageDlg.Show(this, Resources.PublishDocumentDlg_UploadSharedZipFile_You_do_not_have_permission_to_upload_to_the_given_folder);
                return;
            }

            if (!PanoramaPublishClient.ServerSupportsSkydVersion(folderInfo, _docContainer, this))
            {
                return;
            }

            DialogResult = DialogResult.OK;
        }
Example #3
0
        private bool ProcessTransitionList()
        {
            if (!File.Exists(txtTransitionList.Text))
            {
                MessageDlg.Show(this, Resources.ChooseIrtStandardPeptides_OkDialog_Transition_list_field_must_contain_a_path_to_a_valid_file_);
                txtTransitionList.Focus();
                return(false);
            }

            try
            {
                var inputs = new MassListInputs(txtTransitionList.Text);
                Document = Document.ImportMassList(inputs, new IdentityPath(Document.PeptideGroups.First().Id), out _, out _irtAdd, out _librarySpectra, out var errorList);
                if (errorList.Any())
                {
                    throw new InvalidDataException(errorList[0].ErrorMessage);
                }
                IrtFile = txtTransitionList.Text;
            }
            catch (Exception x)
            {
                MessageDlg.ShowWithException(this, string.Format(Resources.CreateIrtCalculatorDlg_OkDialog_Error_reading_iRT_standards_transition_list___0_, x.Message), x);
                return(false);
            }
            return(true);
        }
        private void browseToResultsFileButton_Click(object sender, EventArgs e)
        {
            MsDataFileUri[] dataSources;
            using (var dlg = new OpenDataSourceDialog(Settings.Default.ChorusAccountList)
            {
                Text = Resources.ImportResultsControl_browseToResultsFileButton_Click_Import_Peptide_Search,
                InitialDirectory = new MsDataFilePath(DocumentDirectory)
            })
            {
                // Use saved source type, if there is one.
                string sourceType = Settings.Default.SrmResultsSourceType;
                if (!string.IsNullOrEmpty(sourceType))
                {
                    dlg.SourceTypeName = sourceType;
                }

                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }

                dataSources = dlg.DataSources;
            }

            if (dataSources == null || dataSources.Length == 0)
            {
                MessageDlg.Show(this, Resources.ImportResultsDlg_GetDataSourcePathsFile_No_results_files_chosen);
                return;
            }

            Array.ForEach(dataSources, d => ImportPeptideSearch.TryMatch(d.ToString(), true));
            UpdateResultsFilesUI();
        }
Example #5
0
        static void Application_ThreadException(object sender,
                                                ThreadExceptionEventArgs e)
        {
            if (bExiting == true)
            {
                return;
            }

            Exception ex       = (Exception)e.Exception;
            string    strError = GetExceptionText(ex, "界面线程");

            bool         bSendReport = true;
            DialogResult result      = MessageDlg.Show(_mainForm,
                                                       "dp2Catalog 发生未知的异常:\r\n\r\n" + strError + "\r\n---\r\n\r\n是否关闭程序?",
                                                       "dp2Catalog 发生未知的异常",
                                                       MessageBoxButtons.YesNo,
                                                       MessageBoxDefaultButton.Button2,
                                                       ref bSendReport,
                                                       new string[] { "关闭", "继续" },
                                                       "将信息发送给开发者");

            {
                if (bSendReport)
                {
                    CrashReport(strError);
                }
            }
            if (result == DialogResult.Yes)
            {
                //End();
                bExiting = true;
                Application.Exit();
            }
        }
        public void OpenDatabase(string path)
        {
            if (!File.Exists(path))
            {
                MessageDlg.Show(this, String.Format(Resources.EditIonMobilityLibraryDlg_OpenDatabase_The_file__0__does_not_exist__Click_the_Create_button_to_create_a_new_ion_mobility_library_or_click_the_Open_button_to_find_the_missing_file_,
                                                    path));
                return;
            }

            try
            {
                IonMobilityDb db         = IonMobilityDb.GetIonMobilityDb(path, null); // TODO: (copied from iRT code) LongWaitDlg
                var           dbPeptides = db.GetPeptides().ToArray();

                LoadLibrary(dbPeptides);

                // Clone all of the peptides to use for comparison in OkDialog
                _originalPeptides = dbPeptides.Select(p => new ValidatingIonMobilityPeptide(p.Sequence, p.CollisionalCrossSection, p.HighEnergyDriftTimeOffsetMsec)).ToArray();

                textDatabase.Text = path;
            }
            catch (DatabaseOpeningException e)
            {
                MessageDlg.ShowException(this, e);
            }
        }
Example #7
0
 private bool TestChorusAccount(ChorusAccount chorusAccount)
 {
     using (ChorusSession chorusSession = new ChorusSession(chorusAccount))
     {
         try
         {
             CookieContainer cookieContainer = new CookieContainer();
             try
             {
                 chorusSession.Login(chorusAccount, cookieContainer);
                 MessageDlg.Show(this, Resources.EditChorusAccountDlg_TestSettings_Settings_are_correct);
                 return(true);
             }
             catch (RemoteServerException chorusException)
             {
                 MessageDlg.ShowException(this, chorusException);
                 textPassword.Focus();
                 return(false);
             }
         }
         catch (Exception x)
         {
             MessageDlg.ShowWithException(this, Resources.EditChorusAccountDlg_TestSettings_Error_connecting_to_server__ + x.Message, x);
             textServerURL.Focus();
             return(false);
         }
     }
 }
Example #8
0
        //we are removing locally focused shape (not cursored by others), if any.
        //the shape either must have our cursor or be cursor-free
        public void RemoveShape(int owner, bool supressErrMessages = false)
        {
            var sh = _doc.VolatileCtx.LocalFocus;

            if (sh == null && !supressErrMessages)
            {
                MessageDlg.Show("Please select shape to remove/削除対象が選択されていません",
                                "No shape selected",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            if (!editingPermission(sh) && !supressErrMessages)
            {
                MessageDlg.Show("Cannot remove shape under user cursor/他のユーザーが操作中の付箋は削除できません",
                                "No permission",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            //badges and clusters cannot be removed with palette
            if (sh.ShapeCode() == VdShapeType.Badge || sh.ShapeCode() == VdShapeType.Cluster)
            {
                return;
            }

            _doc.BeginRemoveSingleShape(sh.Id());
        }
Example #9
0
        private void GetLinkables(Point pos, TouchDevice d)
        {
            Shape resizeNode = null;
            var   sh         = DocTools.DetectSelectedShape(_doc, pos, d, out resizeNode) as IVdShape;
            var   end        = DocTools.RequestLinkable(sh);

            if (end == null)
            {
                MessageDlg.Show("Can only link points and groups/付箋とグループ以外はリンクできません",
                                "Tip",
                                MessageBoxButton.OK,
                                MessageBoxImage.Information);
                _palette.ResetTool();
                _modeMgr.Mode = ShapeInputMode.ManipulationExpected;
                return;
            }

            if (_linkCreation.end1 == null)
            {
                _linkCreation.end1 = end;
            }
            else if (end == _linkCreation.end1)
            {
                _palette.ResetTool();
                _modeMgr.Mode = ShapeInputMode.ManipulationExpected;
                MessageDlg.Show("Cannot link points with itself/同じ付箋・グループをリンクする事はできません",
                                "Error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
            else
            {
                _linkCreation.end2 = end;
            }
        }
Example #10
0
        public void OpenDatabase(string path)
        {
            if (!File.Exists(path))
            {
                MessageDlg.Show(this, String.Format(Resources.EditOptimizationLibraryDlg_OpenDatabase_The_file__0__does_not_exist__Click_the_Create_button_to_create_a_new_library_or_the_Open_button_to_find_the_missing_file_,
                                                    path));
                return;
            }

            try
            {
                OptimizationDb db = OptimizationDb.GetOptimizationDb(path, null, _document);
                var            dbOptimizations = db.GetOptimizations().ToArray();

                SetOptimizations(dbOptimizations);

                // Clone all of the optimizations to use for comparison in OkDialog
                _original = dbOptimizations.Select(p => new DbOptimization(p)).ToArray();

                textDatabase.Text = path;
            }
            catch (OptimizationsOpeningException e)
            {
                MessageDlg.ShowException(this, e);
            }
        }
Example #11
0
        /// <summary>
        /// At this point a failure in this function probably means the optimization database was used
        /// </summary>
        private bool ValidateOptimizationList(IEnumerable <DbOptimization> optimizationList, string tableName)
        {
            var keySet = new HashSet <OptimizationKey>();

            foreach (DbOptimization optimization in optimizationList)
            {
                string seqModified = optimization.Target.Sequence;
                if (LibraryGridViewDriver.ValidateSequence(seqModified) != null)
                {
                    MessageDlg.Show(this, string.Format(Resources.EditOptimizationLibraryDlg_ValidateOptimizationList_The_value__0__is_not_a_valid_modified_peptide_sequence_,
                                                        seqModified));
                    return(false);
                }

                if (keySet.Contains(optimization.Key))
                {
                    MessageDlg.Show(this, string.Format(Resources.EditOptimizationLibraryDlg_ValidateOptimizationList_The_optimization_with_sequence__0___charge__1___fragment_ion__2__and_product_charge__3__appears_in_the__4__table_more_than_once_,
                                                        seqModified, optimization.Adduct, optimization.FragmentIon, optimization.ProductAdduct, tableName));
                    return(false);
                }
                keySet.Add(optimization.Key);
            }

            return(true);
        }
Example #12
0
        public static bool ValidateLibraryPath(Control owner, string path)
        {
            if (!File.Exists(path))
            {
                MessageDlg.Show(owner, string.Format(Resources.EditLibraryDlg_OkDialog_The_file__0__does_not_exist, path));
                return(false);
            }
            if (FileEx.IsDirectory(path))
            {
                MessageDlg.Show(owner, string.Format(Resources.EditLibraryDlg_OkDialog_The_path__0__is_a_directory, path));
                return(false);
            }

            // Display an error message if the user is trying to add a BiblioSpec library,
            // and the library has the text "redundant" in the file name.
            if (path.EndsWith(BiblioSpecLiteSpec.EXT_REDUNDANT))
            {
                var message = TextUtil.LineSeparate(string.Format(Resources.EditLibraryDlg_OkDialog_The_file__0__appears_to_be_a_redundant_library, path),
                                                    Resources.EditLibraryDlg_OkDialog_Please_choose_a_non_redundant_library);
                MessageDlg.Show(owner, string.Format(message, path));
                return(false);
            }

            return(true);
        }
Example #13
0
        protected virtual bool DoCellValidating(int rowIndex, int columnIndex, string value)
        {
            string errorText = null;

            if (columnIndex == COLUMN_SEQUENCE && GridView.IsCurrentCellInEditMode)
            {
                var sequence = TryResolveTarget(value, out errorText);
                if (errorText == null)
                {
                    int iExist = Items.ToArray().IndexOf(pep => Equals(pep.Target, sequence));
                    if (iExist != -1 && iExist != rowIndex)
                    {
                        errorText = string.Format(Resources.PeptideGridViewDriver_DoCellValidating_The_sequence__0__is_already_present_in_the_list, sequence);
                    }
                }
            }
            else if (columnIndex == COLUMN_TIME && GridView.IsCurrentCellInEditMode)
            {
                string rtText = value;
                if (!AllowMissingTime || !string.IsNullOrEmpty(rtText))
                {
                    errorText = MeasuredPeptide.ValidateRetentionTime(rtText, AllowNegativeTime);
                }
            }
            if (errorText != null)
            {
                MessageDlg.Show(MessageParent, errorText);
                return(false);
            }
            return(true);
        }
Example #14
0
        private void btnConfirm_Click_1(object sender, RoutedEventArgs e)
        {
            var dstTopic = lstDstTopics.SelectedItem as Topic;

            if (dstTopic == null)
            {
                MessageDlg.Show("Target topic not selected");
                return;
            }

            BusyWndSingleton.Show("Copying points...");
            try
            {
                var ownId  = SessionInfo.Get().person.Id;
                var discId = SessionInfo.Get().discussion.Id;
                foreach (var ap in dstPoints)
                {
                    copyArgPointTo(ap, dstTopic);
                }

                PrivateCenterCtx.SaveChangesIgnoreConflicts();

                _sharedClient.clienRt.SendNotifyStructureChanged(dstTopic.Id, ownId, DeviceType.Wpf);
                var srcTopic = lstSrcTopics.SelectedItem as Topic;
                _sharedClient.clienRt.SendStatsEvent(StEvent.ArgPointTopicChanged, ownId, discId, srcTopic.Id,
                                                     DeviceType.Wpf); //src
                _sharedClient.clienRt.SendStatsEvent(StEvent.ArgPointTopicChanged, ownId, discId, dstTopic.Id,
                                                     DeviceType.Wpf); //dst
            }
            finally
            {
                BusyWndSingleton.Hide();
            }
        }
Example #15
0
 private bool GetPython()
 {
     try
     {
         using (var waitDlg = new LongWaitDlg {
             ProgressValue = 0
         })
         {
             // Short wait, because this can't possible happen fast enough to avoid
             // showing progress, except in testing
             waitDlg.PerformWork(this, 50, DownloadPython);
         }
         using (var waitDlg = new LongWaitDlg(null, false)
         {
             Message = Resources.PythonInstaller_GetPython_Installing_Python
         })
         {
             waitDlg.PerformWork(this, 50, InstallPython);
         }
         MessageDlg.Show(this, Resources.PythonInstaller_GetPython_Python_installation_completed_);
         return(true);
     }
     catch (Exception ex)
     {
         MessageDlg.ShowWithException(this, (ex.InnerException ?? ex).Message, ex);
     }
     return(false);
 }
Example #16
0
        private static bool ValidateRegressionCellValues(string[] values, IWin32Window parent, int lineNumber)
        {
            int    tempInt;
            double tempDouble;
            string message;

            // Parse charge
            if (!int.TryParse(values[0].Trim(), out tempInt))
            {
                message = string.Format(Resources.EditCEDlg_ValidateRegressionCellValues_the_value__0__is_not_a_valid_charge_Charges_must_be_integer_values_between_1_and_5, values[0]);
            }

            // Parse slope
            else if (!double.TryParse(values[1].Trim(), out tempDouble))
            {
                message = string.Format(Resources.EditCEDlg_ValidateRegressionCellValues_the_value__0__is_not_a_valid_slope, values[1]);
            }

            // Parse intercept
            else if (!double.TryParse(values[2].Trim(), out tempDouble))
            {
                message = string.Format(Resources.EditCEDlg_ValidateRegressionCellValues_the_value__0__is_not_a_valid_intercept, values[2]);
            }

            else
            {
                return(true);
            }

            MessageDlg.Show(parent, string.Format(Resources.EditCEDlg_ValidateRegressionCellValues_On_line__0__1__, lineNumber, message));
            return(false);
        }
Example #17
0
 private bool GetR()
 {
     try
     {
         using (var dlg = new LongWaitDlg {
             Message = Resources.RInstaller_InstallR_Downloading_R, ProgressValue = 0
         })
         {
             // Short wait, because this can't possible happen fast enough to avoid
             // showing progress, except in testing
             dlg.PerformWork(this, 50, DownloadR);
         }
         using (var dlg = new LongWaitDlg(null, false)
         {
             Message = Resources.RInstaller_GetR_Installing_R
         })
         {
             dlg.PerformWork(this, 50, InstallR);
         }
         MessageDlg.Show(this, Resources.RInstaller_GetR_R_installation_complete_);
     }
     catch (TargetInvocationException ex)
     {
         if (ex.InnerException is ToolExecutionException)
         {
             MessageDlg.ShowException(this, ex);
             return(false);
         }
         throw;
     }
     return(true);
 }
Example #18
0
        private void LoginProcedure()
        {
            login = LoginDriver.Run(LoginFlow.ForEventGen);
            if (login == null)
            {
                System.Windows.Application.Current.Shutdown();
                return;
            }

            if (login.discussion == null)
            {
                MessageDlg.Show(
                    "In this application even moderator should select real, existing discussion");
                System.Windows.Application.Current.Shutdown();
                return;
            }

            Topics = new ObservableCollection <Topic>(login.discussion.Topic);

            Persons = new ObservableCollection <Person>(DaoHelpers.personsOfDiscussion(login.discussion));

            setPostLoginInfo();

            FillTopics(login.discussion);

            sharedClient.start(login, DbCtx.Get().Connection.DataSource, login.devType);
            sharedClient.clienRt.onStatsEvent += OnStatsEvent;
        }
Example #19
0
        public void OpenGraph()
        {
            if (Equals(comboDeconvPre.SelectedItem, DeconvolutionMethod.MSX) ||
                Equals(comboDeconvPre.SelectedItem, DeconvolutionMethod.MSX_OVERLAP))
            {
                MessageDlg.Show(this, Resources.EditIsolationSchemeDlg_OpenGraph_Graphing_multiplexing_is_not_supported_);
                return;
            }

            List <IsolationWindow> windows = GetIsolationWindows();

            if (windows == null)
            {
                return;
            }
            int windowsPerScan;

            if (!int.TryParse(textWindowsPerScan.Text, out windowsPerScan))
            {
                windowsPerScan = 1;
            }
            bool useMargins = cbSpecifyMargin.Checked;

            using (var graphDlg = new DiaIsolationWindowsGraphForm(windows, useMargins,
                                                                   comboDeconvPre.SelectedItem, windowsPerScan))
            {
                graphDlg.ShowDialog(this);
            }
        }
Example #20
0
        private bool FireStatsEvent(StEvent e, int personId = -2)
        {
            if (cbxTopics.SelectedItem == null)
            {
                MessageDlg.Show("Please first select topic");
                return(false);
            }

            if (personId == -2)
            {
                if (lstUsers.SelectedItem == null)
                {
                    MessageDlg.Show("Please first select user who initiates the event");
                    return(false);
                }
                personId = ((Person)lstUsers.SelectedItem).Id;
            }
            else
            {
                //we use given personId
            }

            var newEvent = new TimelineEvent(e,
                                             personId,
                                             login.discussion.Id,
                                             _timelineModel,
                                             _timelineModel.CurrentTime,
                                             ((Topic)cbxTopics.SelectedItem).Id,
                                             login.devType);

            EventGen.timeline.CommandManager.Instance.RegisterDoneCommand(new CreateEventCommand(newEvent, true));
            UpdateEventCounts();
            return(true);
        }
        private void findResultsFilesButton_Click(object sender, EventArgs e)
        {
            // Ask the user for the directory to search
            using (var dlg = new FolderBrowserDialog
            {
                Description = Resources.ImportResultsControl_findResultsFilesButton_Click_Results_Directory,
                ShowNewFolderButton = false,
                SelectedPath = Path.GetDirectoryName(DocumentDirectory)
            })
            {
                if (dlg.ShowDialog(WizardForm) != DialogResult.OK)
                {
                    return;
                }

                // See if we're still missing any files, and update UI accordingly
                var dirsToSearch = new List <string> {
                    dlg.SelectedPath
                };
                dirsToSearch.AddRange(ImportPeptideSearch.GetSubdirectories(dlg.SelectedPath));
                if (!UpdateResultsFiles(dirsToSearch, true))
                {
                    MessageDlg.Show(WizardForm, Resources.ImportResultsControl_findResultsFilesButton_Click_Could_not_find_all_the_missing_results_files_);
                }
            }
        }
Example #22
0
        private void SaveTimeline(bool saveAs)
        {
            if (_session.videoPathName == "")
            {
                MessageDlg.Show("Cannot save timeline, no video selected");
                return;
            }

            var megPathName = _session.megFilePathName;

            if (megPathName == "" || saveAs)
            {
                var dlg = new System.Windows.Forms.SaveFileDialog();
                dlg.CheckFileExists = false;
                dlg.Filter          = "MEG timeline file |*.meg";
                // dlg.DefaultExt = ".meg";
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    megPathName = dlg.FileName;
                }
            }

            if (megPathName != "")
            {
                _session.Write(megPathName);
            }
        }
Example #23
0
        public void ReimportResults()
        {
            CheckDisposed();
            if (!DocumentUIContainer.DocumentUI.Settings.MeasuredResults.IsLoaded)
            {
                MessageDlg.Show(this, Resources.ManageResultsDlg_ReimportResults_All_results_must_be_completely_imported_before_any_can_be_re_imported);
                return;
            }

            var missingFiles = FindMissingFiles(SelectedChromatograms);

            if (missingFiles.Length > 0)
            {
                var sb = new StringBuilder();
                sb.AppendLine(Resources.ManageResultsDlg_ReimportResults_Unable_to_find_the_following_files_either_in_their_original_locations_or_in_the_folder_of_the_current_document)
                .AppendLine()
                .Append(TextUtil.LineSeparate(missingFiles));
                MessageDlg.Show(this, sb.ToString());
                return;
            }

            using (new UpdateList(this, listResults))
            {
                int[] selectedIndices = SelectedIndices(listResults);
                foreach (int selectedIndex in selectedIndices)
                {
                    var selected = (ManageResultsAction)listResults.Items[selectedIndex];
                    selected.IsReimport = true;
                    listResults.Items[selectedIndex] = selected;
                    // Make sure the selected items stay selected
                    listResults.SelectedItems.Add(selected);
                }
            }
            listResults.Focus();
        }
Example #24
0
        public override void Delete()
        {
            if (null == BoundDataGridView)
            {
                return;
            }

            var selectedRows = GetSelectedRows <FoldChangeBindingSource.FoldChangeRow>(BoundDataGridView);

            if (!selectedRows.Any())
            {
                MessageDlg.Show(BoundDataGridView,
                                GroupComparisonStrings.GroupComparisonViewContext_Delete_No_rows_are_selected);
                return;
            }

            var docNodes = new Dictionary <IdentityPath, SkylineDocNode>();

            foreach (var row in selectedRows)
            {
                if (row.Peptide != null)
                {
                    docNodes[row.Peptide.IdentityPath] = row.Peptide;
                }
                else
                {
                    docNodes[row.Protein.IdentityPath] = row.Protein;
                }
            }

            DeleteSkylineDocNodes(BoundDataGridView, docNodes.Values);
        }
Example #25
0
        static void CurrentDomain_UnhandledException(object sender,
                                                     UnhandledExceptionEventArgs e)
        {
            if (bExiting == true)
            {
                return;
            }

            Exception ex       = (Exception)e.ExceptionObject;
            string    strError = GetExceptionText(ex, "");

            // TODO: 把信息提供给数字平台的开发人员,以便纠错
            // TODO: 显示为红色窗口,表示警告的意思
            bool         bSendReport = true;
            DialogResult result      = MessageDlg.Show(_mainForm,
                                                       "dp2Catalog 发生未知的异常:\r\n\r\n" + strError + "\r\n---\r\n\r\n点“关闭”即关闭程序",
                                                       "dp2Catalog 发生未知的异常",
                                                       MessageBoxButtons.OK,
                                                       MessageBoxDefaultButton.Button1,
                                                       ref bSendReport,
                                                       new string[] { "关闭" },
                                                       "将信息发送给开发者");

            // 发送异常报告
            if (bSendReport)
            {
                CrashReport(strError);
            }
        }
Example #26
0
        public static void CreateAndShowFindResults(ZedGraphControl sender, GraphSummary graphSummary, SrmDocument document, AreaCVGraphData.CVData data)
        {
            var peptideAnnotationPairs = data.PeptideAnnotationPairs.ToList();
            var results = new List <FindResult>(peptideAnnotationPairs.Count);

            var pred = new FindPredicate(new FindOptions().ChangeCustomFinders(new[] { new PeptideAnnotationPairFinder(peptideAnnotationPairs, data.CV) }), Program.MainWindow.SequenceTree.GetDisplaySettings(null));

            for (var i = 0; i < Math.Min(peptideAnnotationPairs.Count, MAX_FINDRESULTS_PEPTIDES); i++)
            {
                var pair        = peptideAnnotationPairs[i];
                var displayText = PeptideAnnotationPairFinder.GetDisplayText(data.CV, pair.Annotation);

                results.Add(new FindResult(pred,
                                           new BookmarkEnumerator(document,
                                                                  new Bookmark(document.GetPathTo((int)SrmDocument.Level.Molecules,
                                                                                                  document.Molecules.ToList().IndexOf(pair.Peptide)))), new FindMatch(displayText)));
            }

            var count = peptideAnnotationPairs.Count;

            if (results.Count != count)
            {
                MessageDlg.Show(sender, string.Format(Resources.HistogramHelper_CreateAndShowFindResults_Only_showing__0___1__peptides, MAX_FINDRESULTS_PEPTIDES, count));
                results = results.GetRange(0, MAX_FINDRESULTS_PEPTIDES);
            }

            if (peptideAnnotationPairs.Count == 1)
            {
                var nodes = peptideAnnotationPairs[0];
                graphSummary.StateProvider.SelectedPath = new IdentityPath(nodes.PeptideGroup.PeptideGroup, nodes.Peptide.Peptide);
            }

            Program.MainWindow.ShowFindResults(results);
        }
Example #27
0
        private void DisplayInstallSummary(ICollection <string> successfulUpdates, ICollection <KeyValuePair <string, string> > failedUpdates)
        {
            string oneUpdate       = Resources.ToolUpdatesDlg_DisplayInstallSummary_Successfully_updated_the_following_tool;
            string multipleUpdates =
                Resources.ToolUpdatesDlg_DisplayInstallSummary_Successfully_updated_the_following_tools;

            string oneFailure       = Resources.ToolUpdatesDlg_DisplayInstallSummary_Failed_to_update_the_following_tool;
            string multipleFailures =
                Resources.ToolUpdatesDlg_DisplayInstallSummary_Failed_to_update_the_following_tools;

            string success = TextUtil.LineSeparate(successfulUpdates.Count == 1 ? oneUpdate : multipleUpdates,
                                                   string.Empty,
                                                   TextUtil.LineSeparate(successfulUpdates));

            string failure = TextUtil.LineSeparate(failedUpdates.Count == 1 ? oneFailure : multipleFailures,
                                                   string.Empty,
                                                   TextUtil.LineSeparate(failedUpdates.Select(pair => FormatFailureMessage(pair.Key, pair.Value))));

            if (successfulUpdates.Count != 0 && !failedUpdates.Any())
            {
                MessageDlg.Show(this, success);
            }
            else if (successfulUpdates.Count == 0 & failedUpdates.Any())
            {
                MessageDlg.Show(this, failure);
            }
            else // both successes and failures
            {
                MessageDlg.Show(this, TextUtil.LineSeparate(success, string.Empty, failure));
            }
        }
        public bool TestSettings()
        {
            if (!ValidateValues())
            {
                return(false);
            }
            ChorusAccount chorusAccount = GetChorusAccount();
            ChorusSession chorusSession = new ChorusSession();

            try
            {
                CookieContainer cookieContainer = new CookieContainer();
                try
                {
                    chorusSession.Login(chorusAccount, cookieContainer);
                    MessageDlg.Show(this, Resources.EditChorusAccountDlg_TestSettings_Settings_are_correct);
                    return(true);
                }
                catch (ChorusServerException chorusException)
                {
                    MessageDlg.ShowException(this, chorusException);
                    textPassword.Focus();
                    return(false);
                }
            }
            catch (Exception x)
            {
                MessageDlg.ShowWithException(this, Resources.EditChorusAccountDlg_TestSettings_Error_connecting_to_server__ + x.Message, x);
                textServerURL.Focus();
                return(false);
            }
        }
Example #29
0
        private void tbxNoiseTimeRange_Leave(object sender, EventArgs e)
        {
            if (DialogResult != DialogResult.None)
            {
                return;
            }

            double noiseTime;
            string errorMessage = null;

            if (!double.TryParse(tbxNoiseTimeRange.Text, out noiseTime))
            {
                errorMessage = Resources.MinimizeResultsDlg_tbxNoiseTimeRange_Leave_The_noise_time_limit_must_be_a_valid_decimal_number;
            }
            if (noiseTime < 0)
            {
                errorMessage = Resources.MinimizeResultsDlg_tbxNoiseTimeRange_Leave_The_noise_time_limit_must_be_a_positive_decimal_number;
            }
            if (errorMessage != null)
            {
                MessageDlg.Show(this, errorMessage);
                tbxNoiseTimeRange.Focus();
                tbxNoiseTimeRange.SelectAll();
                return;
            }

            Settings = Settings.ChangeNoiseTimeRange(noiseTime);
        }
Example #30
0
        public void UseResults()
        {
            CheckDisposed();
            var document = Program.ActiveDocumentUI;

            if (!document.Settings.HasResults)
            {
                MessageDlg.Show(this, Resources.CalibrateIrtDlg_UseResults_The_document_must_contain_results_to_calibrate_a_standard);
                return;
            }

            var targetResolver = TargetResolver.MakeTargetResolver(document);

            calibratePeptides.TargetResolver = targetResolver;

            int count = document.Molecules.Count(nodePep => nodePep.SchedulingTime.HasValue);

            if (count > 20)
            {
                using (var dlg = new AddIrtStandardsDlg(count))
                {
                    if (dlg.ShowDialog(this) != DialogResult.OK)
                    {
                        return;
                    }

                    count = dlg.StandardCount;
                }
            }

            _gridViewDriver.Recalculate(document, count);
        }