private void HandleViewAnimationsClick(object sender, EventArgs e) { if (mMainWindow == null || mMainWindow.IsVisible == false) { SettingsManager.Self.LoadOrCreateSettings(); mMainWindow = new StateAnimationPlugin.Views.MainWindow(); var settings = SettingsManager.Self.GlobalSettings; mMainWindow.FirstRowWidth = new GridLength((double)settings.FirstToSecondColumnRatio, GridUnitType.Star); mMainWindow.SecondRowWidth = new GridLength(1, GridUnitType.Star); // This fixes an issue where embedded wpf text boxes don't get input, as explained here: // http://stackoverflow.com/questions/835878/wpf-textbox-not-accepting-input-when-in-elementhost-in-window-forms //ElementHost.EnableModelessKeyboardInterop(mMainWindow); //mMainWindow.Show(); //mMainWindow.Closed += (not, used) => Gum.ToolStates.SelectedState.Self.CustomCurrentStateSave = null; mMainWindow.AddStateKeyframeClicked += HandleAddStateKeyframe; mMainWindow.AnimationColumnsResized += HandleAnimationColumnsResized; } GumCommands.Self.GuiCommands.AddControl(mMainWindow, "Animations", TabLocation.RightBottom); GumCommands.Self.GuiCommands.ShowControl(mMainWindow); // forces a refresh: mCurrentViewModel = new ElementAnimationsViewModel(); RefreshViewModel(); }
private void HandleViewAnimationsClick(object sender, EventArgs e) { if (SelectedState.Self.SelectedScreen == null && SelectedState.Self.SelectedElement == null) { MessageBox.Show("You need to select a Screen or Component first"); } else { if(mMainWindow == null || mMainWindow.IsVisible == false) { mMainWindow = new MainWindow(); ElementHost.EnableModelessKeyboardInterop(mMainWindow); mMainWindow.Show(); } else { mMainWindow.Focus(); } RefreshViewModel(); } }