示例#1
0
        private static void singleAnalysisWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            AnalysisClass.timer.Stop();
            AnalysisClass.isSingleAnalysis = false;
            AnalysisClass.ue.Dispose();
            AnalysisClass.ue = null;
            AnalysisClass.SetControlState(AnalysisStates.None);
            AnalysisClass.mainForm.OnDoOperation(Operations.None);
            string result  = (string)((object[])e.Result)[0];
            bool   flag    = (bool)((object[])e.Result)[1];
            string str     = (string)((object[])e.Result)[2];
            string result1 = (string)((object[])e.Result)[3];

            bool[] flagArray = (bool[])((object[])e.Result)[4];
            LogClass.AppendLine(result, false);
            DateTime now = DateTime.Now;

            LogClass.AppendLine(string.Concat("Single parse ending", now.ToString()), false);
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message);
                LogClass.AppendLine(string.Concat("Tracking error:", e.Error.ToString()), false);
            }
            else if (!flag)
            {
                MessageBox.Show("Failed to parse model image, The file should not be a valid model file.");
            }
            else if (MessageBox.Show("Want to save the model image?", string.Empty, MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                File.Delete(str);
            }
            else
            {
                string       str1         = AnalysisClass.MoveImageFile(AnalysisClass.mainForm.txtOutputFolder.Text, result, str, result1, flagArray);
                DialogResult dialogResult = MessageBox.Show("Click 'Yes' to open the folder where the image, click 'No' to open the image.", string.Empty, MessageBoxButtons.YesNoCancel);
                if (dialogResult == DialogResult.Yes)
                {
                    Process process = new Process();
                    process.StartInfo.FileName  = "explorer.exe";
                    process.StartInfo.Arguments = Path.GetDirectoryName(str1);
                    process.Start();
                }
                else if (dialogResult == DialogResult.No)
                {
                    Process process1 = new Process();
                    process1.StartInfo.FileName = str1;
                    process1.Start();
                }
            }
        }
示例#2
0
        private static void mainForm_DoOperation(object sender, OperationEventArgs e)
        {
            if ((e.Operation != Operations.LeaveSettings ? true : Directory.Exists(AnalysisClass.mainForm.txtModelFolder.Text)))
            {
                switch (e.Operation)
                {
                case Operations.LeaveSettings:
                {
                    if (AnalysisClass.analysisWorker.IsBusy)
                    {
                        break;
                    }
                    AnalysisClass.SetControlState(AnalysisStates.Refresh);
                    AnalysisClass.TryCancelAnalysis();
                    AnalysisClass.TryCancelRefresh();
                    AnalysisClass.BeginRefresh();
                    break;
                }

                case Operations.RefreshAnalysisList:
                {
                    AnalysisClass.SetControlState(AnalysisStates.Refresh);
                    AnalysisClass.TryCancelAnalysis();
                    AnalysisClass.TryCancelRefresh();
                    AnalysisClass.BeginRefresh();
                    break;
                }

                case Operations.CancelRefreshanalysisList:
                {
                    AnalysisClass.TryCancelRefresh();
                    break;
                }

                case Operations.LookModel:
                {
                    AnalysisClass.LookSelectedModel();
                    break;
                }

                case Operations.BeginAnalysis:
                {
                    AnalysisClass.SetControlState(AnalysisStates.Analysis);
                    AnalysisClass.TryCancelAnalysis();
                    AnalysisClass.TryCancelRefresh();
                    AnalysisClass.BeginAnalysis();
                    break;
                }

                case Operations.CancelAnalysis:
                {
                    AnalysisClass.TryCancelAnalysis();
                    break;
                }

                case Operations.DragAnalysis:
                {
                    AnalysisClass.SetControlState(AnalysisStates.OtherWork);
                    AnalysisClass.DragDropAnalysis();
                    break;
                }

                case Operations.CurrentAnalysis:
                {
                    AnalysisClass.SetControlState(AnalysisStates.OtherWork);
                    AnalysisClass.CurrentSelectedItemAnalysis();
                    break;
                }

                case Operations.BeginReplace:
                {
                    AnalysisClass.SetControlState(AnalysisStates.OtherWork);
                    break;
                }

                case Operations.ManualAction:
                {
                    AnalysisClass.SetControlState(AnalysisStates.OtherWork);
                    break;
                }

                case Operations.None:
                {
                    AnalysisClass.SetControlState(AnalysisStates.None);
                    break;
                }
                }
            }
        }