Example #1
0
        public void SaveProjectWhenClose(IProject iprj, FormClosingEventArgs a)
        {
            DialogResult         result;
            GeneralProjectEntity entity = iprj as GeneralProjectEntity;

            LockMainForm.Lock();
            if (!this.m_MainFormUIManager.MainForm.IsLicClose)
            {
                result = MessageBoxUtil.ShowYesNoCancel(FrameworkResource.PROJECT_SAVE, new string[] { entity.Name });
                if (DialogResult.Yes == result)
                {
                    result = ProjectFileManager.Instance().SaveProjectFile() ? DialogResult.OK : DialogResult.Cancel;
                }
                if (DialogResult.Cancel == result)
                {
                    a.Cancel = true;
                }
            }
            else
            {
                result = MessageBoxUtil.ShowYesNo(FrameworkResource.PROJECT_SAVE, new string[] { entity.Name });
                if (DialogResult.Yes == result)
                {
                    ProjectFileManager.Instance().SaveProjectFile();
                }
            }
            LockMainForm.Unlock();
        }
Example #2
0
        public string OpenProjectIpLFile(string fileName)
        {
            LockMainForm.Lock();
            string str = string.Empty;

            try
            {
                this.m_ProcessBarManager.ShowLoadingForm();
                GeneralProjectEntity prjEntity = ProjectFileManager.Instance().OpenProjectFile(fileName) as GeneralProjectEntity;
                if (null == prjEntity)
                {
                    this.m_ProcessBarManager.CloseLoadingForm();
                    return(ProjectFileManager.Instance().LastErrMsg);
                }
                this.OrderTreeView();
                this.BindProject();
                this.OpenIPLAutoLoadData(prjEntity);
                prjEntity.MainForm.TabText = prjEntity.Name;
                prjEntity.ProjectIPLFile   = fileName;
                prjEntity.NeedPromptSave   = false;
                this.m_MainFormUIManager.SetRecentlyPrjEnable(false, this.m_MainFormUIManager.MainForm.FileMenuItem);
                this.m_MainFormUIManager.MainForm.SwitchFrameWorkStatus(true);
                this.m_MainFormUIManager.MainForm.PrintConfigCollection = ProjectFileManager.Instance().PrjSerializeData.PSCollection;
                PrintProject.Instance.PrintSeeting = ProjectFileManager.Instance().PrjSerializeData.PrintSeeting;
            }
            catch (Exception exception)
            {
                str = FrameworkResource.PROJECT_LOAD_FAIL;
                WriteLog.Logger.Error("Open Project Failed: " + exception.StackTrace + "\nMessage:" + exception.Message);
                ProjectFileManager.Instance().UnlockProjectFile(fileName);
                return(str);
            }
            finally
            {
                this.m_ProcessBarManager.CloseLoadingForm();
                LockMainForm.Unlock();
            }
            return(str);
        }
Example #3
0
        private void CreateNewProject()
        {
            //ProjectCreate类两个方法:CfgFile:设置默认的配置文件路径和NetType:网络类型(LTE)
            ProjectCreate frm = new ProjectCreate();

            LockMainForm.Lock();
            try
            {
                string str = this.m_MainFormUIManager.ProjectUIManager.CreateNewProjectCanTest(frm.CfgFile, frm.NetType);
                if (!"".Equals(str))
                {
                    MessageBoxUtil.ShowError(str);
                }
            }
            catch (Exception exception)
            {
                WriteLog.Logger.Error(exception.Message + exception.StackTrace);
            }
            finally
            {
                LockMainForm.Unlock();
                this.TempStrip.Visible = false;
            }
        }