/// <summary> /// Triggered when Run button is clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> virtual protected void RunButton_Click(object sender, RoutedEventArgs e) { m_progressRing.IsActive = true; if (RunButtonClicked != null) { m_runButton.IsEnabled = false; RunButtonClicked.Invoke(m_skillBinding); } }
public MainToolbar(Gtk.Window window) { gtkWindow = window; widget = new NSToolbar(MainToolbarId) { DisplayMode = NSToolbarDisplayMode.Icon, }; awesomeBar = new AwesomeBar(); awesomeBar.RunButton.Activated += (o, e) => { RunButtonClicked?.Invoke(o, e); }; awesomeBar.RunButton.UnfocusToolbar += (o, e) => { awesomeBar.Window.MakeFirstResponder(null); exitAction(Gtk.DirectionType.TabBackward); }; // Remove the focus from the Gtk system when Cocoa has focus // Fixes BXC #29601 awesomeBar.SearchBar.GainedFocus += (o, e) => IdeApp.Workbench.RootWindow.Focus = null; AttachToolbarEvents(awesomeBar.SearchBar); selectorView.ConfigurationChanged += (sender, e) => { if (ConfigurationChanged != null) { ConfigurationChanged(sender, e); } }; selectorView.RunConfigurationChanged += (sender, e) => { if (RunConfigurationChanged != null) { RunConfigurationChanged(sender, e); } }; selectorView.RuntimeChanged += (sender, ea) => { if (RuntimeChanged != null) { RuntimeChanged(sender, ea); } }; widget.WillInsertItem = (tool, id, send) => { switch (id) { case AwesomeBarId: return(new NSToolbarItem(AwesomeBarId) { View = awesomeBar, MinSize = new CGSize(MacSystemInformation.OsVersion < MacSystemInformation.Mojave ? 1024: 600, AwesomeBar.ToolbarWidgetHeight), MaxSize = new CGSize(float.PositiveInfinity, AwesomeBar.ToolbarWidgetHeight) }); default: throw new NotImplementedException(); } }; // We can't use the events that Xamarin.Mac adds for delegate methods as they will overwrite // the delegate that Gtk has added NSWindow nswin = GtkMacInterop.GetNSWindow(window); // The way how sizing of the NSToolbar is implemented seems to have changen in Mojave. // Previously we had to track the window size and update our MinSize to prevent NSToolbar // from removing the item automatically. Now the same logic has the opposite effect on Mojave. // Additionally AwesomeBar has no active window, after being removed from the NSToolbar, making // the required size calculation much more complex. However letting NSToolbar do the magic // internally works on Mojave correctly. if (MacSystemInformation.OsVersion < MacSystemInformation.Mojave) { Action <NSNotification> resizeAction = notif => Runtime.RunInMainThread(() => { var win = awesomeBar.Window; if (win == null) { return; } var item = widget.Items [0]; var abFrameInWindow = awesomeBar.ConvertRectToView(awesomeBar.Frame, null); var awesomebarHeight = AwesomeBar.ToolbarWidgetHeight; var size = new CGSize(win.Frame.Width - abFrameInWindow.X - 4, awesomebarHeight); if (item.MinSize != size) { item.MinSize = size; } }); NSNotificationCenter.DefaultCenter.AddObserver(NSWindow.DidResizeNotification, resizeAction, nswin); NSNotificationCenter.DefaultCenter.AddObserver(NSWindow.DidEndLiveResizeNotification, resizeAction, nswin); } NSNotificationCenter.DefaultCenter.AddObserver(NSWindow.WillEnterFullScreenNotification, (note) => IsFullscreen = true, nswin); NSNotificationCenter.DefaultCenter.AddObserver(NSWindow.WillExitFullScreenNotification, (note) => IsFullscreen = false, nswin); }
public void OnRunButtonClicked() { RunButtonClicked?.Invoke(StoredGame); }
private void RunButtonOnClick() => RunButtonClicked?.Invoke(this, selectedSceneToRun);