private void ProcedLoadRules() { LoadSaveDialogOptions options = new LoadSaveDialogOptions(); options.IsMultiselect = false; List <string> paths; bool isOk = _iOutput.FileDialog.ShowLoadDialog(options, out paths); if (!isOk) { return; } string path = paths.FirstOrDefault(); if (path.IsNullObj()) { return; } _repository.Categories.Load(path); _repository.Options.Item.CategoryPath = path; }
public void OnButtonClick(object sender, EventArgs e) { if (sender == btnLoad) { LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Filter = BudgetConst.FILE_EXTENSION, IsMultiselect = false, Caption = "Plik z kategoriami" }; _collection.Load(options); AttachCategories(_collection); } if (sender == btnSaveAs) { LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Filter = BudgetConst.FILE_EXTENSION, IsMultiselect = false, Caption = "Plik z kategoriami" }; _collection.Save(options); } if (sender == btnSave) { _collection.Save(); } }
private void ProceedSaveReports() { LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Caption = "Select file", Filter = FileTools.Instance.GetFileFilter("Pliki raportow", "rpt"), IsMultiselect = false }; _repository.Reports.Save(options); }
public bool ShowSaveDialog(LoadSaveDialogOptions options, out List <string> paths) { using (SaveFileDialog dialog = new SaveFileDialog()) { dialog.Filter = options.Filter; System.Windows.Forms.DialogResult formsResult = dialog.ShowDialog(); paths = new List <string>(); paths.AddRange(dialog.FileNames.ToList()); bool isOk = formsResult == DialogResult.OK; return(isOk); } }
string getFileName(IFileDialog dialog, string filter, bool isLoad) { LoadSaveDialogOptions options = new LoadSaveDialogOptions { Filter = filter }; List <string> paths; bool isOk = dialog.ShowLoadDialog(options, out paths); if (!isOk || paths.IsNullOrEmpty()) { return(null); } return(paths.First()); }
public void Save(LoadSaveDialogOptions options) { List <string> paths; bool isOk = _dialog.ShowSaveDialog(options, out paths); if (!isOk) { return; } string path = paths.FirstOrDefault(); if (path.IsNull()) { return; } Save(path); }
public void SaveWithDialog <T>(IFileDialog dialog, T item, string fileFilter) { List <string> paths; LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Filter = fileFilter }; bool isOk = dialog.ShowSaveDialog(options, out paths); if (!isOk || paths.IsNullOrEmpty()) { return; } string path = paths.First(); string xml = Serializer.Instance.SerializeToXml <T>(item); File.WriteAllText(path, xml); }
public void SaveTxtWithDialog(IFileDialog dialog, string text, string fileFilter) { LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Filter = fileFilter }; List <string> paths; bool isOk = dialog.ShowSaveDialog(options, out paths); if (!isOk || paths.IsNullOrEmpty()) { return; } string path = paths.First(); File.WriteAllText(path, text); }
public string LoadTxtWithDialog(IFileDialog dialog, string fileFilter) { List <string> paths; LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Filter = fileFilter }; bool isOk = dialog.ShowSaveDialog(options, out paths); if (!isOk || paths.IsNullOrEmpty()) { return(null); } string path = paths.First(); string txt = LoadTxt(path); return(txt); }
public T LoadWithDialog <T>(IFileDialog dialog, string fileFilter, out string path) { path = string.Empty; LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Filter = fileFilter }; List <string> paths; bool isOk = dialog.ShowSaveDialog(options, out paths); if (!isOk || paths.IsNullOrEmpty()) { return(default(T)); } path = paths.First(); T t = Load <T>(path); return(t); }
public void OnButtonClick(object sender, EventArgs e) { if (sender == btnLoad) { LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Filter = BudgetConst.FILE_EXTENSION, IsMultiselect = false, Caption = "Plik z kategoriami" }; _collection.Load(options); _aggregator.PublishEvent <PathChangedEvent>(new PathChangedEvent() { Path = _collection.Path }); AttachCategories(_collection, null); } if (sender == btnSaveAs) { LoadSaveDialogOptions options = new LoadSaveDialogOptions() { Filter = BudgetConst.FILE_EXTENSION, IsMultiselect = false, Caption = "Plik z kategoriami" }; _collection.Save(options); } if (sender == btnSave) { _collection.Save(); } }