internal static void OnOpenDocumentISOClick(object sender, RoutedEventArgs e) { if (!IsolatedFileHelper.IsStorageAllowed()) return; OpenSaveDialog openDialog = new OpenSaveDialog(App.Model.DocumentHolder.CurrentDocumentFileName, ResxResources.DefaultDocumentType, true/*bOpen*/); openDialog.Closed += delegate(object senderDialog, EventArgs eDialog) { OpenSaveDialog dialog = senderDialog as OpenSaveDialog; if (dialog == null) return; if (dialog.DialogResult == MessageBoxResult.Cancel) return; string filePath = dialog.OpenFilePathXml; if (!App.Model.DocumentHolder.Open(filePath)) MessageBoxEx.ShowError("Open document", string.Format("Cannot open document '{0}'", filePath), null); }; }
internal static void OnSaveProfileISOClick(object sender, RoutedEventArgs e) { //if (App.Model.ProfileHolder.Profile == null) //{ // MessageBoxEx.ShowOK("Save profile", "A profile has not been created", null); // return; //} if (!IsolatedFileHelper.IsStorageAllowed()) return; bool bOK = IsolatedFileHelper.IncreaseQuotaTo(10 * 1024 * 1024); OpenSaveDialog saveDialog = new OpenSaveDialog(ResxResources.DefaultProfileFileName, ResxResources.DefaultProfileType, false/*bOpen*/); saveDialog.Closed += delegate(object senderDialog, EventArgs eDialog) { OpenSaveDialog dialog = senderDialog as OpenSaveDialog; if (dialog == null) return; if (dialog.DialogResult == MessageBoxResult.Cancel) return; string filePath = dialog.SaveFilePathXml; if (!App.Model.ProfileHolder.Save(filePath)) MessageBoxEx.ShowError("Save profile", string.Format("Cannot save profile '{0}'", filePath), null); }; }