private void ToggleWidgetWindow(WidgetWindow widgetWindow) { /* * widgetWindow.Owner = m_MainWindow; * if (widgetWindow.Visibility != Visibility.Visible) * { * widgetWindow.Opacity = 1.0f; * widgetWindow.Show(); * * WindowHelper.SetTopMostTransparent(widgetWindow); * } * else * { * widgetWindow.Opacity = 0.0f; * widgetWindow.Hide(); * } */ if (widgetWindow.Visibility != Visibility.Visible) { widgetWindow.Owner = m_MainWindow; widgetWindow.Show(); widgetWindow.Owner = null; WindowHelper.SetTopMostTransparent(widgetWindow); } else { widgetWindow.Hide(); } }
private void OnWidgetWindowDestroyed(WidgetWindow w) { if (_widgetWindows.Contains(w)) { _widgetWindows.Remove(w); } }
private void ApplicationStartup(object sender, StartupEventArgs e) { WidgetWindowViewModel widgetWindowViewModel = new WidgetWindowViewModel(); WidgetWindow widgetWindow = new WidgetWindow(widgetWindowViewModel); widgetWindow.Show(); MainWindowVIewModel mainWindowVIewModel = new MainWindowVIewModel(); MainWindow mainWindow = new MainWindow(mainWindowVIewModel); }
public override void CreateWidget() { if (CreateUI == false) { return; } _widgetWindow = new WidgetWindow { DataContext = _widgetWindowViewModel }; _gearsetUI.StackPanel.Children.Add(_widgetWindow); }
private Window CreateWidget(WidgetDescription widgetDescription) { Window widgedWindow; if (widgetDescription.ResizeToContent) { widgedWindow = new AutoSizableWidgetWindow { Title = widgetDescription.Description, Left = widgetDescription.Left, Top = widgetDescription.Top, Content = widgetDescription.Control, Tag = widgetDescription, }; } else { widgedWindow = new WidgetWindow { Height = widgetDescription.Height, Width = widgetDescription.Width, Title = widgetDescription.Description, Left = widgetDescription.Left, Top = widgetDescription.Top, Content = widgetDescription.Control, Tag = widgetDescription, }; } widgedWindow.Owner = this; var menuItem = new MenuItem() { Header = widgetDescription.Description, Tag = widgedWindow, }; var visibleBinding = new Binding("IsVisible") { Source = widgedWindow, Mode = BindingMode.OneWay, }; menuItem.SetBinding(MenuItem.IsCheckedProperty, visibleBinding); menuItem.Click += HandleHideShowWidget; _viewMenuItem.Items.Add(menuItem); widgedWindow.Show(); return(widgedWindow); }
private void ToggleWidgetWindow(WidgetWindow widgetWindow) { if (widgetWindow.Visibility != Visibility.Visible) { widgetWindow.Owner = m_MainWindow; widgetWindow.Show(); widgetWindow.Owner = null; WindowHelper.SetTopMostTransparent(widgetWindow); } else { widgetWindow.Hide(); } }
public override void CreateWidget() { if (CreateUI == false) { return; } _widgetViewModel = new WidgetViewModel(); _widgetWindow = new WidgetWindow { DataContext = GearsetSettings.Instance }; _widgetWindow.ButtonList.ItemsSource = _widgetViewModel.ButtonActions; _widgetWindow.Show(); _windows.Add(_widgetWindow); }
public TestWindow() : base(WindowFlags.None) { Size = new Vector2(2048, 2048.0f * WindowController.Instance.ScreenHeight / WindowController.Instance.ScreenWidth); Scale = WindowController.Instance.ScreenHeight / Size.Y; WidgetPanel panel = new WidgetWindow(); panel.Size = new Vector2(600, 760); panel.Scale = WindowController.Instance.ScreenScale; panel.Position = Size / 2 - panel.Size * panel.Scale / 2; AddChild(panel); WidgetPanel back = new WidgetPanel(WidgetManager.GetStyle("back_pattern")); back.Size = panel.Size; panel.AddChild(back); WidgetLabel title = new WidgetLabel(); title.Text = ResourceLoader.Instance.GetString("login_title"); title.Size = new Vector2(panel.Size.X, 60); title.Position = new Vector2(0, 50); title.FontSize = WidgetManager.FontScale * 1.5f; title.TextAlign = WidgetAlign.Top | WidgetAlign.HorizontalCenter; panel.AddChild(title); WidgetLabel loginLabel = new WidgetLabel(); loginLabel.Text = ResourceLoader.Instance.GetString("login_login"); loginLabel.Position = new Vector2(50, 160); loginLabel.FontSize = WidgetManager.FontScale * 1.25f; panel.AddChild(loginLabel); m_loginEdit = new WidgetTextEdit(); m_loginEdit.Text = DefaultLogin; m_loginEdit.Size = new Vector2(500, 45); m_loginEdit.Position = new Vector2(50, 200); m_loginEdit.FontSize = WidgetManager.FontScale * 1.25f; m_loginEdit.OnTextEntered += HandleLoginEntered; panel.AddChild(m_loginEdit); m_loginEdit.SetFocused(true); WidgetLabel passLabel = new WidgetLabel(); passLabel.Text = ResourceLoader.Instance.GetString("login_password"); passLabel.Position = new Vector2(50, 260); passLabel.FontSize = WidgetManager.FontScale * 1.25f; panel.AddChild(passLabel); m_passEdit = new WidgetTextEdit(); m_passEdit.Text = DefaultPassword; m_passEdit.Size = new Vector2(500, 45); m_passEdit.Position = new Vector2(50, 300); m_passEdit.FontSize = WidgetManager.FontScale * 1.25f; m_passEdit.MaskChar = "*"; m_passEdit.OnTextEntered += HandlePassEntered; panel.AddChild(m_passEdit); m_passEdit.SetFocused(false); WidgetLabel localLabel = new WidgetLabel(); localLabel.Text = ResourceLoader.Instance.GetString("login_local"); localLabel.Position = new Vector2(90, 360); localLabel.Color = 0xcceeff; localLabel.FontSize = WidgetManager.FontScale * 1.0f; panel.AddChild(localLabel); m_localCheckBox = new WidgetCheckBox(true); m_localCheckBox.Position = new Vector2(50, 360); m_localCheckBox.Checked = false; localLabel.Visible = true; m_localCheckBox.OnChecked += delegate(WidgetCheckBox cb) { m_localEdit.Visible = cb.Checked; }; panel.AddChild(m_localCheckBox); m_localCheckBox.LinkedLabel = localLabel; m_localEdit = new WidgetTextEdit(); m_localEdit.Text = "127.0.0.1"; m_localEdit.Size = new Vector2(500, 45); m_localEdit.Position = new Vector2(50, 100); m_localEdit.FontSize = WidgetManager.FontScale * 1.25f; m_localEdit.Visible = m_localCheckBox.Checked && m_localCheckBox.Visible; m_localEdit.OnTextEntered += delegate { HandleLoginPress(null); }; m_localEdit.OnValidateInput += HandleValidateIpInput; panel.AddChild(m_localEdit); m_localEdit.SetFocused(false); WidgetButton webSiteButton = new WidgetButton(WidgetManager.GetStyle("text_button"), ResourceLoader.Instance.GetString("login_register")); webSiteButton.Position = new Vector2(50, 360 + (m_localCheckBox.Visible ? 40 : 0)); webSiteButton.FontSize = WidgetManager.FontScale * 1.0f; webSiteButton.OnPress += delegate { HandleWebSitePress(null); }; panel.AddChild(webSiteButton); m_loginButton = new WidgetButton(ResourceLoader.Instance.GetString("login_connect")); m_loginButton.Size = new Vector2(160, 48); m_loginButton.FontSize = WidgetManager.FontScale * 1.25f; m_loginButton.Position = new Vector2(panel.Size.X / 2 - m_loginButton.Size.X / 2, 460); m_loginButton.Enabled = false; m_loginButton.OnPress += delegate { HandleLoginPress(null); }; m_loginButton.Tooltip = "@tooltip_connect"; panel.AddChild(m_loginButton); WidgetImage logoImage = new WidgetImage(WidgetBackgroundStyle.ImageFit, "settings_icon"); logoImage.Size = new Vector2(64, 64); logoImage.Position = new Vector2(20, 15); panel.AddChild(logoImage); WidgetTextField textTextField = new WidgetTextField(WidgetManager.GetStyle("default_textedit")); textTextField.Size = new Vector2(500, 225); textTextField.Position = new Vector2(50, 520); textTextField.FontSize = WidgetManager.FontScale * 1.25f; textTextField.Visible = true; textTextField.Text = "WidgetTextField textTextField = new WidgetTextField(WidgetManager.GetStyle(\"default_textedit\"));\n textTextField.Size = new Vector2(500, 225);\n textTextField.Position = new Vector2(50, 520);\n textTextField.FontSize = WidgetManager.FontScale * 1.25f;\n textTextField.Visible = true"; panel.AddChild(textTextField); m_fpsLabel = new WidgetLabel(); m_fpsLabel.Text = "1"; m_fpsLabel.Position = new Vector2(440, 20); m_fpsLabel.FontSize = WidgetManager.FontScale * 0.75f; panel.AddChild(m_fpsLabel); }