/// <summary> /// -- Do the actual load /// </summary> /// <param name="filePath"></param> private void LoadState(string filePath) { foreach (var item in referenceWindows) { item.Close(); } referenceWindows.Clear(); var lines = File.ReadAllLines(filePath); var states = lines.Select(o => JsonConvert.DeserializeObject <State>(o)).ToList(); foreach (var item in states) { if (item.IsFutureWindow) { LayoutWindow fw = new LayoutWindow() { PreloadState = item }; fw.Show(); futureWindows.Add(fw); } else { ReferenceWindow mw = new ReferenceWindow() { PreloadState = item }; mw.Show(); referenceWindows.Add(mw); } } }
/// <summary> /// -- Add preset windows and not replace them like load state do /// </summary> private void LoadPresetBtn_Click(object sender, RoutedEventArgs e) { if (TryGetZrfFile(out string filePath, Environment.CurrentDirectory + "\\Presets")) { var lines = File.ReadAllLines(filePath); var states = lines.Select(o => JsonConvert.DeserializeObject <State>(o)); foreach (var item in states) { if (item.IsFutureWindow) { LayoutWindow fw = new LayoutWindow() { PreloadState = item }; fw.Show(); futureWindows.Add(fw); } else { ReferenceWindow mw = new ReferenceWindow() { PreloadState = item }; mw.Show(); referenceWindows.Add(mw); } } } }
//Create window Section: /// <summary> /// -- Create Layout window: /// </summary> private void TestWindowBtn_Click(object sender, RoutedEventArgs e) { LayoutWindow fw = new LayoutWindow(); fw.Show(); fw.Activate(); futureWindows.Add(fw); RefreshList(); }
public LayoutWindowCommander(LayoutWindow lw) { win = lw; }
public LayoutStateManager(LayoutWindow future) { win = future; }