示例#1
0
        private void OnMruFile(int number, String filename)
        {
            bool loadSuccessful = false;

            try
            {
                SpyWindowHelper.WantToSave(_rootNurseObject);
                loadSuccessful = ModelFileHandler.LoadRecentModelFile(filename, _presenterModel.GetTreeView());
            }
            catch (Exception ex)
            {
                //"Invalid file format, please check log files for more details"
                MessageBox.Show(StringResources.LPSpy_SpyMainWindow_InvalidFileFormat);
                //TODO: log message
                MessageBox.Show(ex.ToString());
            }

            if (loadSuccessful)
            {
                mruMenu.SetFirstFile(number);
            }
            else
            {
                //The file '{0}' cannot be opened and will be removed from the Recent list(s)
                string message = StringResources.LPSpy_SpyMainWindow_FileRemovedFromRecentList;
                MessageBox.Show(string.Format(message, filename)
                                , ""
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Error);
                mruMenu.RemoveFile(number);
            }
        }
示例#2
0
 private void chineseMenuItem_Click(object sender, EventArgs e)
 {
     if (SpySettings.Language == AppLanguageEnum.English)
     {
         SpyWindowHelper.SwitchLanguage(AppLanguageEnum.Chinese, () => { SpyWindowHelper.WantToSave(_rootNurseObject); });
     }
 }
示例#3
0
        private void SpyMainWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            //check whether need to save before exit
            SpyWindowHelper.WantToSave(_rootNurseObject);

            SpySettings.SaveUserSettings();
            mruMenu.SaveToRegistry();
            mruMenu.BuildJumpList();
        }
示例#4
0
        //menu -> new
        private void newMenuItem_Click(object sender, EventArgs e)
        {
            SpyWindowHelper.WantToSave(_rootNurseObject);

            string filePath = null;

            if (ModelFileHandler.DlgNewModelFile(out filePath))
            {
                _presenterModel.NewModel(filePath);
            }
        }
示例#5
0
        //menu -> open
        private void openMenuItem_Click(object sender, EventArgs e)
        {
            SpyWindowHelper.WantToSave(_rootNurseObject);
            try
            {
                if (_presenterModel.DlgOpenModelFile())
                {
                    mruMenu.AddFile(AppEnvironment.CurrentModelPath);
                }
            }
            catch (Newtonsoft.Json.JsonReaderException ex)
            {
                //Invalid file format, please check log files for more detail
                MessageBox.Show(StringResources.LPSpy_SpyMainWindow_InvalidFileFormat);

                _Logger.WriteWarning(ex.ToString());
            }
        }