Inheritance: FileSelectionMessage
        public void SaveImage()
        {
            if (DeferredImageItems[SelectedIndex].Bitmap == null)
            {
                return;
            }

            var fileName = Path.GetFileNameWithoutExtension(DeferredImageItems[SelectedIndex].Name);
            var ext = Path.GetExtension(DeferredImageItems[SelectedIndex].FileExtension);

            var tmpList = new List<string>
            {
                "JPEG(*.jpg;*.jpeg;*.jfif)|*.jpg;*.jpeg;*.jfif|",
                "Bitmap(*.bmp)|*.bmp|",
                "PNG(*.png)|*.png|",
                "GIF(*.gif)|*.gif|"
            };

            var filterList = new List<string>();
            filterList.AddRange(tmpList.Where(x => ext != null && x.Contains(ext)));

            var filter = "";
            filterList.ForEach(x => filter += x);
            filter += "All Files(*.*)|*.*";

            var message = new SavingFileSelectionMessage("Save")
            {
                AddExtension = true,
                FileName = fileName + ext,
                Filter = filter
            };
            Messenger.Raise(message);
            if (message.Response == null)
            {
                return;
            }

            DeferredImageItems[SelectedIndex].Save(message.Response[0]);
        }
Example #2
0
 public void SaveTabAsSTOT()
 {
     SavingFileSelectionMessage m = new SavingFileSelectionMessage("SaveFile");
     m.Filter = "テキスト ファイル|*.txt";
     m.Title = "保存先のファイルを指定";
     String file = null;
     if ((file = this.Parent.Messenger.GetResponse(m).Response) != null)
     {
         using (FileStream fs = File.Open(file, FileMode.Create, FileAccess.ReadWrite))
         using (StreamWriter sw = new StreamWriter(fs))
         {
             this.CurrentForegroundTimeline.CoreViewModel.TweetsSource.ForEach(tdtvm =>
                 {
                     sw.WriteLine(TwitterHelper.GetSuggestedUser(tdtvm.Tweet).ScreenName + ":" + tdtvm.Tweet.Text + " [" + tdtvm.Tweet.Permalink + "]");
                 });
         }
     }
 }
Example #3
0
 public void Save()
 {
     if (Settings.Current.CustomImageSaveFolder)
     {
         _model.Save(Path.Combine(Settings.Current.CustomImageSaveFolderPath, FileName).NextFilePath());
     }
     else
     {
         var msg = new SavingFileSelectionMessage("SaveDialogMessageKey");
         Messenger.Raise(msg);
     }
 }
Example #4
0
 public void SaveFileDialogCallback(SavingFileSelectionMessage msg)
 {
     if (msg.Response == null || msg.Response.Count() == 0) return;
     _model.Save(msg.Response.First());
 }
Example #5
0
        private void GetExportData(SavingFileSelectionMessage parameter)
        {
            if (parameter.Response == null || parameter.Response.Length == 0)
                return;

            this.Save();

            using (var sw = new StreamWriter(parameter.Response[0], false, Encoding.UTF8))
            {
                sw.WriteLine(Customer.HeaderCsv);
                foreach (var customer in this.entityService.Customers)
                    sw.WriteLine(Customer.GetCsvFromCustomer(customer));
            }
            Messenger.Raise(new InformationMessage("エクスポート完了。", "お知らせ", "Info"));
        }
Example #6
0
        private void GetBackUpData(SavingFileSelectionMessage parameter)
        {
            if (parameter.Response == null || parameter.Response.Length == 0)
                return;

            File.Copy(AppDomain.CurrentDomain.BaseDirectory + @"\Domains\Resources\MyData.sdf", parameter.Response[0], true);
            Messenger.Raise(new InformationMessage("保存しました。", "お知らせ", "Info"));
        }
 public void FileExport()
 {
     var cm = new ConfirmationMessage(
         "色設定をエクスポートすると、現在の設定内容がKrileの設定に反映されます。" +
         "よろしいですか?", "色設定保存", System.Windows.MessageBoxImage.Warning,
          System.Windows.MessageBoxButton.YesNo, "Confirm");
     this.Messenger.Raise(cm);
     if (cm.Response.GetValueOrDefault())
     {
         var sfm = new SavingFileSelectionMessage("SaveFile");
         sfm.Title = "色設定ファイルの保存";
         sfm.Filter = "色設定ファイル|*.kcx";
         this.Messenger.Raise(sfm);
         if (sfm.Response != null)
         {
             try
             {
                 Apply();
                 XMLSerializer.SaveXML<ColoringProperty>(sfm.Response, Setting.Instance.ColoringProperty);
             }
             catch
             {
                 this.Messenger.Raise(new InformationMessage("ファイルを読み込めません。",
                     "色設定ファイルのロードエラー", System.Windows.MessageBoxImage.Error, "Message"));
             }
         }
     }
 }
Example #8
0
 protected String SaveDialog(String title, string filename)
 {
     var message = new SavingFileSelectionMessage("Save")
     {
         Title = title,
         FileName = String.IsNullOrEmpty(filename) ? "list.txt" : filename,
     };
     Messenger.Raise(message);
     return message.Response != null ? message.Response[0] : null;
 }
Example #9
0
        /// <summary>
        /// パラメータファイル保存
        /// </summary>
        /// <param name="parameter">パラメータ</param>
        public void SaveParamFile(SavingFileSelectionMessage parameter)
        {
            if (parameter.Response == null || parameter.Response.Length < 1)
            {
                return;
            }

            try
            {
                _parameterFileManager.save(parameter.Response[0]);
            }
            catch (Exception e)
            {
                StatusBarMessage = e.Message;
            }
        }