private void OnOpenClassDetail(object obj) { if (detailWindow == null) { initDetailWindow(); } detailWindow.Title = "Class Detail"; detailWindow.Content = new ClassDetailView(); detailWindow.Focus(); }
public static void ShowArgInfoControl(ArgInfo argInfo, TemplateInfoControl templateInfoControl, TemplateInfo templateInfo) { var w = new MetroWindow { Height = 430, Width = 600, EnableDWMDropShadow = true, ResizeMode = ResizeMode.NoResize }; w.LostFocus += (ss, ee) => w.Focus(); w.Title = "参数信息"; w.WindowStartupLocation = WindowStartupLocation.CenterScreen; var control = new ArgInfoControl(); control.Load(argInfo); control.OnCancelClose += (sender, args) => w.Close(); control.OnOkClose += (ss, ee) => { if (Tools.UpdateArgConfig(argInfo) != "") { return; } templateInfoControl.Load(templateInfo, true); w.Close(); }; w.Content = control; w.ShowDialog(); }
public static bool FocusWindow() { if (MainWindow == null) { return(false); } if (MainWindow.WindowState == WindowState.Minimized) { MainWindow.WindowState = WindowState.Normal; } MainWindow.Activate(); MainWindow.Topmost = true; // important MainWindow.Topmost = false; // important MainWindow.Focus(); // important return(true); }
void IHandle <ShowMainWindowEvent> .Handle(ShowMainWindowEvent message) { if (!_window.IsVisible) { _window.Show(); } if (_window.WindowState == WindowState.Minimized) { _window.WindowState = WindowState.Normal; } _window.Activate(); _window.Topmost = true; _window.Topmost = false; _window.Focus(); if (message.SelectMostRecentMessage) { MessageListViewModel.TryGetValidSelectedIndex(); } }
public void ToTop() { _win.Topmost = true; _win.Topmost = false; _win.Focus(); }
private void GetOffRecords() { try { var xml = new XmlDocument(); xml.Load($@"{Directory.GetCurrentDirectory()}\Settings.xml"); var seasonBalNode = xml.SelectSingleNode("/Settings/SeasonBal"); if (seasonBalNode != null) { SeasonMinGames = Convert.ToInt32(seasonBalNode.InnerText); } var seriesBalNode = xml.SelectSingleNode("/Settings/SeriesBal"); if (seriesBalNode != null) { SeriesMinGames = Convert.ToInt32(seriesBalNode.InnerText); } var offRatingSource = Context.SeasonRatingDbSet.Where(x => x.Games < SeasonMinGames && x.IsMember == true).GroupBy(x => x.Games).OrderByDescending(x => x.Key).Take(5).ToList(); foreach (var item in offRatingSource) { OffRating.Add(item.Key); } if (OffRating.Count > 0) { var firstDigit = OffRating[0]; foreach (var item in Context.SeasonRatingDbSet.Where(item => item.Games == firstDigit && item.IsMember == true)) { FirstOffRating.Add(item.Nick); } } if (OffRating.Count > 1) { var secondDigit = OffRating[1]; foreach (var item in Context.SeasonRatingDbSet.Where(item => item.Games == secondDigit && item.IsMember == true)) { SecondOffRating.Add(item.Nick); } } if (OffRating.Count > 2) { var thirdDigit = OffRating[2]; foreach (var item in Context.SeasonRatingDbSet.Where(item => item.Games == thirdDigit && item.IsMember == true)) { ThirdOffRating.Add(item.Nick); } } if (OffRating.Count > 3) { var fourthDigit = OffRating[3]; foreach (var item in Context.SeasonRatingDbSet.Where(item => item.Games == fourthDigit && item.IsMember == true)) { FourthOffRating.Add(item.Nick); } } if (OffRating.Count > 4) { var fifthDigit = OffRating[4]; foreach (var item in Context.SeasonRatingDbSet.Where(item => item.Games == fifthDigit && item.IsMember == true)) { FifthOffRating.Add(item.Nick); } } } catch (FileNotFoundException) { _infoWindow.Focus(); _infoWindow.ShowMessageAsync("ERROR", GetLocalized("SettingsNotFoundError"), MessageDialogStyle.Affirmative, _settings); } }