private static FilerProgressWindow SetUpSavingProgress(string filename, WPFFiler wPFFiler, object saveObjects) { var fpw = new FilerProgressWindow { filename = filename, wPFFiler = wPFFiler, Title = "Progress: Saving...", lblopen1 = { Content = Path.GetFileName(filename) } }; fpw.stackContent.Children.Remove(fpw.lblopen2); fpw.stackContent.Children.Remove(fpw.progressBar2); wPFFiler.progWindow = fpw; fpw.backgroundWorker.RunWorkerCompleted += fpw.Completed_Save; if (!(saveObjects is object[])) { fpw.storage = new[] { saveObjects } } ; else { fpw.storage = (object[])saveObjects; } wPFFiler.progWindow = fpw; return(fpw); }
private static FilerProgressWindow SetUpOpeningProgress(string filename, Boolean SuppressWarnings, WPFFiler wPFFiler, Boolean thisIsRuleSet) { var fpw = new FilerProgressWindow { filename = filename, wPFFiler = wPFFiler, Title = "Progress: Opening..." }; if (thisIsRuleSet) { fpw.MinHeight = 182; fpw.lblopen2.Content = "Ruleset: " + Path.GetFileName(filename); } else { fpw.lblopen1.Content = Path.GetFileName(filename); fpw.stackContent.Children.Remove(fpw.lblopen2); fpw.stackContent.Children.Remove(fpw.progressBar2); } wPFFiler.progWindow = fpw; return(fpw); }
internal static void SaveRule(string filename, Boolean SuppressWarnings, WPFFiler wPFFiler, object saveObjects) { var fpw = SetUpSavingProgress(filename, wPFFiler, saveObjects); fpw.backgroundWorker.DoWork += fpw.Do_SaveRule; fpw.backgroundWorker.RunWorkerAsync(); fpw.ShowDialog(); wPFFiler.progWindow = null; }
internal static object[] OpenRuleSet(string filename, Boolean SuppressWarnings, WPFFiler wPFFiler) { var fpw = SetUpOpeningProgress(filename, SuppressWarnings, wPFFiler, true); fpw.backgroundWorker.DoWork += fpw.Do_OpenRuleSet; fpw.backgroundWorker.RunWorkerCompleted += fpw.Completed_OpenRuleSet; fpw.backgroundWorker.RunWorkerAsync(); fpw.ShowDialog(); wPFFiler.progWindow = null; return(fpw.storage); }