private void OpenTankingSummary() { if (TankingWindow?.IsOpen == true) { TankingWindow.Close(); } else { #pragma warning disable CA2000 // Dispose objects before losing scope var tankingSummary = new TankingSummary(); #pragma warning restore CA2000 // Dispose objects before losing scope tankingSummary.EventsSelectionChange += TankingSummary_SelectionChanged; TankingWindow = new DocumentWindow(dockSite, "tankingSummary", "Tanking Summary", null, tankingSummary); IconToWindow[tankingSummaryIcon.Name] = TankingWindow; Helpers.OpenWindow(TankingWindow); if (DamageWindow?.IsOpen == true || HealingWindow?.IsOpen == true) { TankingWindow.MoveToPreviousContainer(); } RepositionCharts(TankingWindow); if (TankingStatsManager.Instance.GetGroupCount() > 0) { // keep chart request until resize issue is fixed. resetting the series fixes it at a minimum var tankingOptions = new GenerateStatsOptions() { RequestSummaryData = true }; Task.Run(() => TankingStatsManager.Instance.RebuildTotalStats(tankingOptions)); } } }
private bool OpenLineChart(DocumentWindow window, DocumentWindow other1, DocumentWindow other2, FrameworkElement icon, string title, List <string> choices, bool includePets, out DocumentWindow newWindow) { bool updated = false; newWindow = window; if (newWindow?.IsOpen == true) { newWindow.Close(); newWindow = null; } else { updated = true; var chart = new LineChart(choices, includePets); newWindow = new DocumentWindow(dockSite, title, title, null, chart); IconToWindow[icon.Name] = newWindow; Helpers.OpenWindow(newWindow); newWindow.CanFloat = true; newWindow.CanClose = true; if (other1?.IsOpen == true || other2?.IsOpen == true) { newWindow.MoveToNextContainer(); } else { newWindow.MoveToNewHorizontalContainer(); } } return(updated); }
private void OpenHealingSummary() { if (HealingWindow?.IsOpen == true) { HealingWindow.Close(); } else { var healingSummary = new HealingSummary(); healingSummary.EventsSelectionChange += HealingSummary_SelectionChanged; HealingWindow = new DocumentWindow(dockSite, "healingSummary", "Healing Summary", null, healingSummary); IconToWindow[healingSummaryIcon.Name] = HealingWindow; Helpers.OpenWindow(HealingWindow); if (DamageWindow?.IsOpen == true || TankingWindow?.IsOpen == true) { HealingWindow.MoveToPreviousContainer(); } Helpers.RepositionCharts(HealingWindow, DamageChartWindow, TankingChartWindow, HealingChartWindow); if (HealingStatsManager.Instance.GetGroupCount() > 0) { // keep chart request until resize issue is fixed. resetting the series fixes it at a minimum var healingOptions = new GenerateStatsOptions() { RequestSummaryData = true }; Task.Run(() => HealingStatsManager.Instance.RebuildTotalStats(healingOptions)); } } }
internal void CloseAllDocuments() { for (int index = _mainForm.DockPanel.Contents.Count - 1; index >= 0; index--) { if (_mainForm.DockPanel.Contents[index] is DocumentWindow) { DocumentWindow window = (DocumentWindow)_mainForm.DockPanel.Contents[index]; window.Close(); } } }
private void CloseAllButThisClicked() { for (int index = _mainForm.DockPanel.Contents.Count - 1; index >= 0; index--) { IDockContent content = _mainForm.DockPanel.Contents[index]; if (content is DocumentWindow && content != ActiveWindow) { DocumentWindow window = content as DocumentWindow; window.Close(); } } }
private void OpenDocumentDeleted(NAntDocument document) { DocumentWindow window = FindDocumentWindow(document.FullName); DialogResult result = Errors.ShowDocumentDeletedMessage(document.FullName); if (result == DialogResult.No) { window.Close(); } else { window.TabText = Utils.AddAsterisk(window.TabText); document.FileType = FileType.New; } }
public void OnClose(UIElement smartPart) { if (activeSmartPart == smartPart) { activeSmartPart = null; } if (!_isClosing) { DocumentWindow window = ResolveSmartPartToWindow(smartPart); if (window != null) { window.Close(); } } }
/// <summary> /// STARTING POINT for Open Document /// /// Order of Operations /// 1.) MainViewModel.OnOpenDocument /// 2.) DocumentWindow.OpenFile /// 3.) MainViewModel.AddDocument /// </summary> public static void OpenDocument(string path, Action callback = null) { #region InvokeRequired if (View.InvokeRequired) { View.Invoke(new Action <string, Action>(OpenDocument), path, callback); return; } #endregion PerformanceService.StartEvent($"{PerformanceService.CONST_OpenDocument}{path}"); Log.WriteEnter(typeof(MainViewModel).FullName, MethodBase.GetCurrentMethod().Name); lock (_syncOpenDocument) { #region Check if already open if (!File.Exists(path)) { MessageBox.Show(string.Format("They system cannot find the file specified: \"{0}\"", path)); return; } var doc = FindDocument(path) as DocumentWindow; if (doc != null) { doc.DockHandler.Show(); var model = doc as DocumentWindow; if (model != null) { SetCurrent(model.ViewModel); } callback?.Invoke(); return; } #endregion #region Create DocumentWindow doc = new DocumentWindow { Text = Path.GetFileName(path) }; try { var model = new DocumentModel { Control = doc.PrepareDocument(path), File = XmlDal.CacheModel.GetFile(path) }; doc.ViewModel.View.StatusUpdate(StatusModel.Update("Loading")); doc.ViewModel.Model = model; model.File.Options = Options; model.File.DocumentModel = model; Documents.Add(doc.ViewModel); DocumentService.BuildDocument(model); } catch (Exception exception) { doc.Close(); MessageBox.Show(exception.Message); } #endregion #region Show if (View.DockPanel.DocumentStyle == DocumentStyle.SystemMdi) { doc.MdiParent = View as Form; doc.Show(); } else { doc.Show(View.DockPanel); } #endregion if (StartupComplete) { SetCurrent(doc.ViewModel); } callback?.Invoke(); PerformanceService.StopEvent($"{PerformanceService.CONST_OpenDocument}{path}"); Log.WriteExit(typeof(MainViewModel).FullName, MethodBase.GetCurrentMethod().Name); } }