示例#1
0
        public void OnFirstInitialized()
        {
            string[] args = Environment.GetCommandLineArgs();
            if (args.Count() == 2)
            {
                var iEditor = _pluginLoader.GetEditor();
                _fileService.OpenFile(iEditor, args[1]);
            }
            else
            {
                string filePath = Properties.Settings.Default.LastSavedFilePath;

                if (!Path.IsPathRooted(filePath))
                {
                    Assembly myAssembly = Assembly.GetEntryAssembly();
                    string   path       = myAssembly.Location;
                    filePath = Path.Combine(Path.GetDirectoryName(path), filePath);
                }
                if (File.Exists(filePath))
                {
                    var iEditor = _pluginLoader.GetEditor();
                    try
                    {
                        _fileService.OpenFile(iEditor, filePath);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            FileBoxModelManager.Load();
        }
示例#2
0
        /// <summary>
        /// ファイル名を指定してファイルを保存する
        /// </summary>
        /// <param name="toFile"></param>
        /// <returns></returns>
        public bool SaveFile(string toFile)
        {
            SaveManager manager = new SaveManager();

            if (manager.Save(toFile) == SaveResult.Succeed)
            {
                CurrentFile = toFile;

                Properties.Settings.Default.SavedFolderPath   = Path.GetDirectoryName(CurrentFile);
                Properties.Settings.Default.LastSavedFilePath = CurrentFile;

                FileBoxModelManager.AddRecentlySavedFile(CurrentFile);

                Properties.Settings.Default.Save();

                EventAggregator.OnSaved(this, new SaveEventArgs());

                return(true);
            }
            else
            {
                ShowDialogManager.ShowMessageBox("保存に失敗しました。保存先を変えるなどして再チャレンジしてみてください", "エラー", MessageBoxButton.OK, MessageBoxImage.Warning);
            }

            return(false);
        }