public void OpenInNewWindow(string key, object parameter = null) { var window = GetWindow(key); if (window != null) { window.Activate(); } else { window = new MetroWindow() { Title = "HamburgerMenuApp", Style = Application.Current.FindResource("CustomMetroWindow") as Style }; var frame = new Frame() { Focusable = false, NavigationUIVisibility = NavigationUIVisibility.Hidden }; window.Content = frame; var page = _pageService.GetPage(key); window.Closed += OnWindowClosed; window.Show(); frame.Navigated += OnNavigated; var navigated = frame.Navigate(page, parameter); } }
public void Loaded(ViewLoadedParams p) { DisposeWindow = false; var mainViewModel = new GitHubForDynamoWPF.ViewModels.MainViewModel(p, p.DynamoWindow, UniqueId, Name); gitHubWindow = new GitHubForDynamoWPF.Views.MainView(mainViewModel) { Title = this.Name, Owner = p.DynamoWindow, DataContext = mainViewModel }; // When closing, actually hide the window so it is kept on the background gitHubWindow.Closing += (sender, args) => { if (!DisposeWindow) { args.Cancel = true; (sender as Window).Hide(); } }; gitHubMenuItem = new MenuItem { Header = this.Name }; gitHubMenuItem.Click += (sender, args) => { gitHubWindow.Show(); }; p.AddSeparator(MenuBarType.Packages, new Separator()); p.AddMenuItem(MenuBarType.Packages, gitHubMenuItem); }
public void OpenInNewWindow(Type pageType, object parameter = null) { var window = GetWindow(pageType); if (window != null) { window.Activate(); } else { window = new MetroWindow() { Title = "Param_ProjectName", Style = Application.Current.FindResource("CustomMetroWindow") as Style }; var frame = new Frame() { Focusable = false, NavigationUIVisibility = NavigationUIVisibility.Hidden }; window.Content = frame; window.Closed += OnWindowClosed; window.Show(); frame.Navigated += OnNavigated; var page = _serviceProvider.GetService(pageType); var navigated = frame.Navigate(page, parameter); } }
private void Btn_color_Click(object sender, RoutedEventArgs e) { if (accentThemeTestWindow != null) { accentThemeTestWindow.Activate(); return; } accentThemeTestWindow = new AccentStyleWindow() { Owner = this }; accentThemeTestWindow.Closed += (o, args) => accentThemeTestWindow = null; accentThemeTestWindow.Left = Left + ActualWidth / 2.0; accentThemeTestWindow.Top = Top + ActualHeight / 2.0; accentThemeTestWindow.Show(); }
public static void ShowMessage(string title, string message) { _metroWindow.Dispatcher.Invoke(() => { _metroWindow.ShowMessageAsync(title, message); _metroWindow.Show(); }, DispatcherPriority.Normal); }
public void ShowPopup(ViewModelBase view, string title, bool ismax = false, bool isDialog = true, bool sideToContent = false, bool isMin = false) { var p = new MetroWindow { WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner, ShowMinButton = false, ShowMaxRestoreButton = false }; p.Content = view.View; var tt = view.GetViewTitle(); if (string.IsNullOrEmpty(title)) { p.Title = tt; } else { p.Title = title; } p.SetValue(Panel.ZIndexProperty, 0); p.Topmost = false; var uc = view.View as UserControl; if (uc.MinHeight != 0) { p.Height = uc.MinHeight + 20; } if (uc.MinWidth != 0) { p.Width = uc.MinWidth + 10; } p.Icon = this.Icon; p.Owner = this; p.Closed += (s, e) => { view.Closed(); }; if (ismax) { p.WindowState = System.Windows.WindowState.Maximized; // p.SizeToContent = SizeToContent.WidthAndHeight; } if (isMin) { p.ShowMinButton = true; } if (sideToContent) { p.SizeToContent = System.Windows.SizeToContent.WidthAndHeight; p.ResizeMode = System.Windows.ResizeMode.CanMinimize; p.ShowMinButton = true; p.Height += 1; p.Width += 1; } if (isDialog) { p.ShowDialog(); } else { p.Show(); } }
private void initDetailWindow() { detailWindow = new MetroWindow { Width = 650, Height = 350 }; detailWindow.Closed += new System.EventHandler(DetailWindow_Closed); createDetailWindow(); detailWindow.Show(); }
public static void ShowWindow(string path) { var uri = new Uri(path, UriKind.Relative); var component = (FrameworkElement)Application.LoadComponent(uri); var window = new MetroWindow(); window.Content = component; window.Show(); }
private void ShowDialogWindow <T>(bool ownerMainWindow = false) where T : MetroWindow { _dialogWindow = _container.Resolve <T>(); if (ownerMainWindow) { _dialogWindow.Owner = this; } _dialogWindow.Closed += (o, args) => _dialogWindow = null; _dialogWindow.Show(); }
private void VanillaOptionBtn_Click(object sender, RibbonControlEventArgs e) { try { Excel.Worksheet activeWorksheet = ((Excel.Worksheet)Globals.ThisAddIn.Application.ActiveSheet); //object cellValue = activeWorksheet.get_Range("A1", System.Type.Missing).Value2; //activeWorksheet.get_Range("A1", System.Type.Missing).Value2 = "My new value"; //Excel.Range range1 = activeWorksheet.get_Range("A1", "B2"); //object[,] s = (object[,])range1.Value2; //Excel.Range range2 = activeWorksheet.get_Range("A3", "B4"); //range2.Value2 = (string)s[1, 2]; OptionManagerViewModel omvm = new OptionManagerViewModel(); omvm.loadDataFromExcelSheet(activeWorksheet); MetroWindow w = new MetroWindow(); ResourceDictionary merge = new ResourceDictionary(); ResourceDictionary rd1 = new ResourceDictionary(); rd1.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml"); merge.MergedDictionaries.Add(rd1); ResourceDictionary rd2 = new ResourceDictionary(); rd2.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml"); merge.MergedDictionaries.Add(rd2); ResourceDictionary rd3 = new ResourceDictionary(); rd3.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml"); merge.MergedDictionaries.Add(rd3); ResourceDictionary rd4 = new ResourceDictionary(); rd4.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Steel.xaml"); merge.MergedDictionaries.Add(rd4); ResourceDictionary rd5 = new ResourceDictionary(); rd5.Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml"); merge.MergedDictionaries.Add(rd5); w.Resources = merge; w.Title = "8586 지수옵션 민감도 비교"; //w.Width = 800; w.Height = 560; w.Content = omvm.view(); w.Visibility = Visibility.Visible; w.Show(); } catch (Exception) { } }
private void ChangeAppStyleButtonClick(object sender, RoutedEventArgs e) { if (accentThemeWindow != null) { accentThemeWindow.Activate(); return; } accentThemeWindow = new AccentStyleWindow(); accentThemeWindow.Owner = this; accentThemeWindow.Closed += (o, args) => accentThemeWindow = null; accentThemeWindow.Left = this.Left + this.ActualWidth / 2.0; accentThemeWindow.Top = this.Top + this.ActualHeight / 2.0; accentThemeWindow.Show(); }
public void Restore() { if (Width != 0 && Height != 0) { _win.Top = Top; _win.Left = Left; _win.Width = Width; _win.Height = Height; } switch (OpenState) { case WindowOpenState.Fullscreen: case WindowOpenState.Maximised: _win.WindowState = WindowState.Normal; _win.Show(); _win.WindowState = WindowState.Maximized; break; case WindowOpenState.Normal: _win.WindowState = WindowState.Normal; _win.Show(); break; case WindowOpenState.None: if (PreviousOpenState == WindowOpenState.Maximised) { _win.WindowState = WindowState.Normal; _win.WindowState = WindowState.Maximized; _win.Show(); _win.WindowState = WindowState.Minimized; break; } _win.WindowState = WindowState.Normal; _win.Show(); _win.WindowState = WindowState.Minimized; break; } }
private void ShowOnMonitor(int monitor, MetroWindow window) { Screen screens = Screen.AllScreens.ToList <Screen>()[monitor]; window.WindowStartupLocation = WindowStartupLocation.Manual; window.Left = screens.Bounds.Left; window.Top = screens.Bounds.Top; window.SourceInitialized += (snd, arg) => window.WindowState = WindowState.Maximized; window.Show(); }
private void ChangeAppStyleButtonClick(object sender, RoutedEventArgs e) { if (_accentThemeTestWindow != null) { _accentThemeTestWindow.Activate(); return; } _accentThemeTestWindow = new AccentStyleWindow(ViewModel.ThemeViewModel); _accentThemeTestWindow.Owner = this; _accentThemeTestWindow.Closed += (o, args) => _accentThemeTestWindow = null; _accentThemeTestWindow.Left = Left + ActualWidth / 4.0; _accentThemeTestWindow.Top = Top + ActualHeight / 4.0; _accentThemeTestWindow.Show(); }
private async void Deco() { var window = Application.Current.Windows.OfType <MetroWindow>().LastOrDefault(); if (window != null) { var result = await window.ShowMessageAsync("Avertissement", "Voulez-vous vraiment vous déconnecter ?", MessageDialogStyle.AffirmativeAndNegative, new MetroDialogSettings { AffirmativeButtonText = "Oui", NegativeButtonText = "Non", AnimateHide = false, AnimateShow = true }); if (result == MessageDialogResult.Affirmative) { VueLogin vl = new VueLogin(); vuePrecedente.Show(); vuePrecedente.Close(); window.Close(); vl.Show(); } } }
private void ChangeSettingsButtonClick(object sender, RoutedEventArgs e) { if (_settingsWindow != null) { _settingsWindow.Activate(); return; } _settingsWindow = new SettingsWindow(ViewModel.SettingsViewModel); _settingsWindow.Owner = this; _settingsWindow.Closed += (o, args) => _settingsWindow = null; _settingsWindow.Left = Left + ActualWidth / 6.0; _settingsWindow.Top = Top + ActualHeight / 6.0; _settingsWindow.Show(); }
private void ChangeAppStyleButtonClick(object sender, RoutedEventArgs e) { if (accentThemeTestWindow != null) { accentThemeTestWindow.Activate(); return; } accentThemeTestWindow = new AccentStyleWindow(); accentThemeTestWindow.Owner = this; accentThemeTestWindow.Closed += (o, args) => accentThemeTestWindow = null; accentThemeTestWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; accentThemeTestWindow.ShowMinButton = false; accentThemeTestWindow.ShowMaxRestoreButton = false; accentThemeTestWindow.Show(); }
private static void ShowResultWindow(IEnumerable <string> list) { var listbox = new ListBox { ItemsSource = list, SelectionMode = SelectionMode.Extended }; listbox.SelectionChanged += (ss, ee) => { var result = listbox.SelectedItems.Cast <object>().Aggregate("", (current, item) => current + (item.ToString() + "\r\n")); Clipboard.SetDataObject(result); }; var w = new MetroWindow { Content = listbox, Width = 600, Height = 400, Title = "全部查询个数", EnableDWMDropShadow = true }; w.Show(); }
public void ShowWindow(object viewModel, string id) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { var win = new MetroWindow { Height = 350, Width = 500, Content = viewModel, DataContext = viewModel }; _windows.Add(new Tuple <string, Window>(id, win)); win.Show(); })); }
public static void AbrirWindow(string title, string window, string isModal = "1", string WinParams = "x") { try { Type ventana = Type.GetType("Nomina1._0." + window); var datos = WinParams.Split(','); MetroWindow nventana = (MetroWindow)Activator.CreateInstance(ventana); if (WinParams != "x") { nventana = (MetroWindow)Activator.CreateInstance(ventana, datos); } nventana.Title = title; nventana.ShowInTaskbar = false; // nventana.WindowStyle = WindowStyle.ToolWindow; nventana.SetResourceReference(MetroWindow.GlowBrushProperty, "AccentColorBrush"); nventana.ResizeMode = ResizeMode.CanResizeWithGrip; if (window == "PrincipalWindow") { nventana.ShowInTaskbar = true; nventana.WindowStyle = WindowStyle.ThreeDBorderWindow; _PrincipalWindow = nventana; } else { nventana.Owner = _PrincipalWindow; } if (isModal == "1") { nventana.WindowStartupLocation = WindowStartupLocation.CenterScreen; nventana.ShowDialog(); } else { nventana.WindowStartupLocation = WindowStartupLocation.CenterScreen; nventana.Show(); } }catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
protected override void OnInitializing() { var factory = Routes.RouteFactory; Routes.MenuRoutes.Add(InitialRoute = factory.Get <HomeRoute> ()); Routes.MenuRoutes.Add(factory.Get <ExamplesRoute> ()); Routes.MenuRoutes.Add(factory.Get <XmlExamplesRoute> ()); FontSize = 15d; var window = new MetroWindow() { Content = new DynamicForm { Model = new Login() }, WindowStartupLocation = WindowStartupLocation.CenterScreen, Height = 200, Width = 200 }; window.Show(); }
private void btnBuildTask_Click(object sender, RoutedEventArgs e) { //VariableStorage.InitializeWithNull(); this.Cursor = Cursors.Wait; MetroWindow window = new MetroWindow() { Content = new SmartifyBotStudio.MainPage(), }; window.SizeToContent = SizeToContent.WidthAndHeight; //window.WindowState = WindowState.Normal; window.WindowState = WindowState.Maximized; window.Title = "Smartify Bot Studio - Main"; window.Show(); //(this.Parent as MetroWindow).Close(); this.Cursor = Cursors.Arrow; }
public static void MessageWindow(string title, string text, int showTime = 0, bool hasOwner = false, bool isDialog = false) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { MetroWindow mwin = new MetroWindow() { //Topmost = true, //Owner = MainWindow.CurrentWindow, ShowMinButton = false, ShowMaxRestoreButton = false, WindowStartupLocation = WindowStartupLocation.CenterScreen, Title = title, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, MinWidth = 240, Width = 240, MinHeight = 150, Height = GridLength.Auto.Value, ResizeMode = ResizeMode.NoResize, TitlebarHeight = 26, BorderThickness = new Thickness(1), BorderBrush = new SolidColorBrush(Color.FromRgb(65, 177, 225)), Icon = UtilsHelper.GetBitmapImage("Logo.ico"), }; if (hasOwner) { mwin.Owner = Application.Current.MainWindow; } mwin.Content = new TextBlock() { Width = 240, TextWrapping = TextWrapping.Wrap, Text = text, FontSize = 12, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Left }; mwin.Closed += (o, args) => mwin = null; mwin.Show(); if ((showTime / 1000) > 0) { timer = new Timer(showTime); timer.AutoReset = false; timer.Elapsed += new System.Timers.ElapsedEventHandler((s, e) => WinCloseTimer_Elapsed(s, e, mwin)); timer.Start(); } })); }
public void PopupWindowWithBorder(string title, string text) { if (m_PopupWin != null) { m_PopupWin.Close(); } m_PopupWin = new MetroWindow() { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner, Title = title, Width = 500, Height = 300 }; m_PopupWin.Closed += (o, args) => m_PopupWin = null; m_PopupWin.Content = new TextBlock() { Text = text, FontSize = 28, FontWeight = FontWeights.Light, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center }; m_PopupWin.BorderThickness = new Thickness(1); m_PopupWin.GlowBrush = null; m_PopupWin.SetResourceReference(MetroWindow.BorderBrushProperty, "AccentColorBrush"); m_PopupWin.Show(); }
private void ShowWindow(object content, string title, ResizeMode canResize = ResizeMode.CanResize, bool isModal = true) { var window = new MetroWindow() { Content = content, SizeToContent = SizeToContent.WidthAndHeight, Title = title, WindowStartupLocation = WindowStartupLocation.CenterScreen, ShowInTaskbar = false, ResizeMode = canResize, }; if (isModal) { window.ShowDialog(); } else { window.Show(); } }
private void ShowImage(string path) { if (string.IsNullOrWhiteSpace(path)) { return; } var imageDisplayer = new MetroWindow() { Content = new Image() { Source = new BitmapImage(new Uri(path)), Margin = new Thickness(5) }, Width = 400, Height = 400, BorderThickness = new Thickness(1, 0, 1, 1), BorderBrush = Brushes.Gray }; imageDisplayer.Show(); }
private void SettingsButtonClick(object sender, RoutedEventArgs e) { if (settingsWindow != null) { settingsWindow.Activate(); return; } settingsWindow = new SettingsWindow( this, BoardViewModelObject.Game.Board.Size, BoardViewModelObject.Game.Board.NumberOfWhitePiecesAtBeggining, BoardViewModelObject.Game.Board.NumberOfBlackPiecesAtBeggining, BoardViewModelObject.Game.Variant, BoardViewModelObject.Game.WhitePlayerEngine, BoardViewModelObject.Game.BlackPlayerEngine, BoardViewModelObject.MoveAnimationTime); settingsWindow.Owner = this; settingsWindow.Closed += (o, args) => settingsWindow = null; settingsWindow.Show(); }
private void seeMessage(String message, String status, int eID, String s, bool inInbox) { MetroWindow w = new MetroWindow { Height = 300, Width = 300 }; TextBox t = new TextBox { TextWrapping = TextWrapping.Wrap }; t.Text = message; w.Content = t; w.Show(); if (inInbox) { if (status.Equals("UNREAD")) { using (SqlConnection conn = new SqlConnection(connectionString)) { conn.Open(); SqlCommand command = new SqlCommand("UNI_ReadEmail", conn); command.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter id = new SqlParameter("@emailID", System.Data.SqlDbType.Int); id.Value = eID; command.Parameters.Add(id); SqlParameter sender = new SqlParameter("@sender", System.Data.SqlDbType.VarChar); sender.Value = s; command.Parameters.Add(sender); command.ExecuteNonQuery(); conn.Close(); } } } }
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(); } }
private void ConsoleButton_OnClick(object sender, RoutedEventArgs e) { _logWindow?.Close(); _logWindow = new LogViewer(); _logWindow.Show(); }