Пример #1
0
        void OpenVolumeControlWindow()
        {
            if (!ready)
            {
                return;
            }
            if (vcWindow != null)
            {
                if (!vcWindow.Activate())
                {
                    vcWindow.Close();
                }
                return;
            }
            vcWindow         = new VolumeControlWindow(viewModel);
            vcWindow.Closed += delegate { vcWindow = null; };
            ElementHost.EnableModelessKeyboardInterop(vcWindow);
            Rect wa = SystemParameters.WorkArea;

            vcWindow.Left = wa.Right - vcWindow.Width;
            vcWindow.Top  = wa.Bottom - vcWindow.Height;
            vcWindow.Show();
            if (!vcWindow.Activate())
            {
                vcWindow.Close();
            }
        }
Пример #2
0
 public void ShowConfigForm()
 {
     //check to see if they have already configured stuff. If so lets make sure they want to reconfigure settings.
     if (tweetManager.isConfigured)
     {
         reconfigConfirm         = new WpfFormLibrary.ReconfigConfirm();
         reconfigConfirm.Closed += reconfigConfirm_Closed; // avoid reshowing a disposed form
         ElementHost.EnableModelessKeyboardInterop(reconfigConfirm);
         if (reconfigConfirm.ShowDialog() == false)
         {
             return;
         }
     }
     //Show config Form
     configForm         = new WpfFormLibrary.ConfigForm();
     configForm.Closed += configForm_Closed; // avoid reshowing a disposed form
     ElementHost.EnableModelessKeyboardInterop(configForm);
     //check to make sure they didnt exit the prompt
     if (configForm.ShowDialog() == true)
     {
         tweetManager.isConfigured = true;
         this.OAuthManager         = configForm.OAuthz;
         this.SID            = configForm.SID;
         this.registeredTime = DateTime.Now.ToString("MM/dd/yy:HH:mm:ss");
         return;
     }
     else
     {
         ShowConfigForm();
     }
 }
Пример #3
0
        private void Righthand_item_Click(object sender, RoutedEventArgs e)
        {
            Item_form item_Form = new Item_form("右手物品信息", sender as Control);

            ElementHost.EnableModelessKeyboardInterop(GetWindow(item_Form));
            item_Form.Show();
        }
Пример #4
0
        private async Task InitializeAsync()
        {
            try
            {
                await Task.Run(() =>
                {
                    _audioSourceLoader.LoadAudioSources();
                    Options.ContextMenuItems = BuildContextMenu();
                    InitializeModels();
                }).ConfigureAwait(false);

                _settingsWindowVm = await SetupViewModels().ConfigureAwait(false);

                await _uiDispatcher.InvokeAsync(() =>
                {
                    _settingsWindow           = new SettingsWindow(_settingsWindowVm);
                    _settingsWindow.Saved    += Saved;
                    _settingsWindow.Canceled += Canceled;
                    ElementHost.EnableModelessKeyboardInterop(_settingsWindow);
                });

                await SelectAudioSourceFromSettings().ConfigureAwait(false);

                Logger.Debug("Initialization complete");
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }
        private static void OpenForm()
        {
            var form = new MainWindow();

            ElementHost.EnableModelessKeyboardInterop(form);
            form.Show();
        }
Пример #6
0
        private void importProductToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            var win = new SQSAdmin_WpfCustomControlLibrary.ImportValidation(int.Parse(MetriconCommon.UserState), MetriconCommon.UserCode);

            ElementHost.EnableModelessKeyboardInterop(win);
            win.Show();
        }
Пример #7
0
        public void Init()
        {
            //TODO:配置文件会被覆盖问题
            QuickConfig.ThisConfig.Reload();
            QuickConfig.ThisConfig.CurrentVersion = Application.ProductVersion;
            QuickConfig.ThisConfig.TrySave();

            m_quickModels = new Dictionary<string, QuickModel>();

            var globalModel = QuickModel.GetModel(QuickModel.GlobalModelName + ".xml");
            m_quickModels.Add(QuickModel.GlobalModelName, globalModel);    //添加全局Model

            foreach (var item in QuickConfig.ThisConfig.ModelName)
            {
                if (!m_quickModels.ContainsKey(item))
                {
                    m_quickModels.Add(item, QuickModel.GetModel(item + ".xml"));
                }
            }

            //装载插件
            QuickPluginLoader.AddAdditionQuickMethodTo(m_quickModels);

            m_quickContextWindowHandler = new QuickContextWindowHandler();
            m_quickContextWindow = new QuickContextWindow(m_quickContextWindowHandler);
            ElementHost.EnableModelessKeyboardInterop(m_quickContextWindow);
        }
Пример #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SettingsWindow"/> class
        /// with the settings viewmodel.
        /// </summary>
        /// <param name="vm">The settings window viewmodel.</param>
        /// <param name="audioBandVM">The audioband view model</param>
        /// <param name="albumArtPopupVM">The album art popup view model</param>
        /// <param name="albumArtVM">The album art view model</param>
        /// <param name="customLabelsVM">The custom labels view model</param>
        /// <param name="aboutVm">The about dialog view model</param>
        /// <param name="nextButtonVM">The next button view model</param>
        /// <param name="playPauseButtonVM">The play/pause button view model</param>
        /// <param name="previousButtonVM">The previous button view model</param>
        /// <param name="progressBarVM">The progress bar view model</param>
        public SettingsWindow(
            SettingsWindowVM vm,
            AudioBandVM audioBandVM,
            AlbumArtPopupVM albumArtPopupVM,
            AlbumArtVM albumArtVM,
            CustomLabelsVM customLabelsVM,
            AboutVM aboutVm,
            NextButtonVM nextButtonVM,
            PlayPauseButtonVM playPauseButtonVM,
            PreviousButtonVM previousButtonVM,
            ProgressBarVM progressBarVM)
        {
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            ElementHost.EnableModelessKeyboardInterop(this);

            CancelCloseCommand = new RelayCommand(CancelCloseCommandOnExecute);
            SaveCloseCommand   = new RelayCommand(SaveCloseCommandOnExecute);

            AudioBandVM       = audioBandVM;
            AlbumArtPopupVM   = albumArtPopupVM;
            AlbumArtVM        = albumArtVM;
            CustomLabelsVM    = customLabelsVM;
            AboutVM           = aboutVm;
            NextButtonVM      = nextButtonVM;
            PlayPauseButtonVM = playPauseButtonVM;
            PreviousButtonVM  = previousButtonVM;
            ProgressBarVM     = progressBarVM;

            InitializeComponent();
            DataContext = vm;
            _vm         = vm;

            Activated += OnActivated;
        }
Пример #9
0
        public override bool Edit(IPolicyEditArgs policyEditArgs)
        {
            PageViewTelemetry pvt    = new PageViewTelemetry("BranchPolicyEdit");
            Stopwatch         pvtrak = new Stopwatch();

            pvtrak.Start();
            bool result = false;

            try
            {
                IBranchPatternsRepository repo = new BranchPatternsRepository(branchPatterns);
                var wpfwindow = new BranchLockPolicyEditorWindow(policyEditArgs, repo);
                ElementHost.EnableModelessKeyboardInterop(wpfwindow);
                wpfwindow.ShowDialog();
                branchPatterns = repo.FindAll().ToList();
                TellMe.Instance.TrackMetric("BranchPolicyCount", branchPatterns.Count);
                result = true;
            }
            catch (Exception ex)
            {
                TellMe.Instance.TrackException(ex);
                MessageBox.Show(string.Format("There was an error loading the Edit Vew for BranchPatternPolicy:/n/n {0}", ex.Message));
                result = false;
            }
            pvt.Duration = pvtrak.Elapsed;
            TellMe.Instance.TrackPageView(pvt);
            return(result);
        }
Пример #10
0
        private void rightModelessButton_Click(object sender, EventArgs e)
        {
            var wpfWindow = new SimpleWindow();

            ElementHost.EnableModelessKeyboardInterop(wpfWindow);
            wpfWindow.Show();
        }
 public ControllerClass()
 {
     storage            = StorageGetter.Storage;
     window             = new AppView();
     window.DataContext = new ViewModelLocator().AppViewModel;
     ElementHost.EnableModelessKeyboardInterop(window);
 }
Пример #12
0
        /// <summary> 新しいオーバーレイカスタムウィンドウを作成し、表示します。
        /// </summary>
        /// <param name="pOverlayViewComponent"> カスタム対象のオーバーレイコンポーネント </param>
        public void NewOverlayCustomWindowOpen(CommonDataModel pCommonDM, OverlayViewComponent pOverlayViewComponent)
        {
            pOverlayViewComponent.OverlayDataModel.OverlayViewData.OverlayCustomClosed = false;

            OverlayCustomWindow window = new OverlayCustomWindow();

            ElementHost.EnableModelessKeyboardInterop(window);
            var vm = window.DataContext as OverlayCustomWindowViewModel;

            if (vm == null)
            {
                return;
            }

            vm.OverlayViewComponent = pOverlayViewComponent;

            if (pOverlayViewComponent.CommonDataModel.AppStatusData.AppMode != AppMode.Desing)
            {
                window.Show();
            }

            // ViewのIntPtrを採取
            IntPtr intPtr = new WindowInteropHelper(window).Handle;

            if (!pCommonDM.AppCommonData.ViewIntPtrList.Contains(intPtr))
            {
                pCommonDM.AppCommonData.ViewIntPtrList.Add(intPtr);
            }
        }
        private void cameraPropertiesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CameraPropertiesWindow cameraPropertiesWindow = new CameraPropertiesWindow(ReactiveHud.Self);

            ElementHost.EnableModelessKeyboardInterop(cameraPropertiesWindow);
            cameraPropertiesWindow.Show();
        }
Пример #14
0
 private void RootCommand_Click(object sender, System.EventArgs e)
 {
     View.CustomPropEditorWindow mw = new View.CustomPropEditorWindow();
     //PropEditorWindow mw = new PropEditorWindow();
     ElementHost.EnableModelessKeyboardInterop(mw);
     mw.Show();
 }
Пример #15
0
        /// <summary>
        /// Start Qlip
        /// </summary>
        private void ShowQlipForm()
        {
            if (qlipForm == null)
            {
                if (model != null)
                {
                    model.Reset();
                }
                qlipForm = new Qlip.MainWindow(model);

                qlipForm.Closed += qlipProcess_Closed; // avoid reshowing a disposed form
                ElementHost.EnableModelessKeyboardInterop(qlipForm);
                qlipForm.Show();
                StartStopText = "Stop";
            }
            else if (StartStopText.Equals("Start"))
            {
                qlipForm.Activate();
                StartStopText = "Stop";
            }
            else
            {
                qlipForm.Close();
                StartStopText = "Start";
            }
        }
Пример #16
0
        public void Startup()
        {
            Window mainWindow = _unity.Resolve <IViewFor <IMainWindowViewModel> >() as Window;

            ElementHost.EnableModelessKeyboardInterop(mainWindow);
            mainWindow.ShowDialog();
        }
Пример #17
0
        /// <summary>
        /// Sets up the window.
        /// </summary>
        private void SetupWin()
        {
            //try closing a window if it's already up
            try
            {
                mw?.Close();
            }
            catch { }

            mw = new MainWindow();
            //Add a listener for window close
            mw.Closed += mw_Closed;

            //set ownership based on child status
            SetChildStatus(mw, winChildStatus);

            ElementHost.EnableModelessKeyboardInterop(mw);

            // 6 April 2021 - S. Baer
            // Check for the possibility of a null canvas. If the window is only
            // shown using the Grasshopper Player and Grasshopper itself has never
            // been run, then there is no canvas.
            var canvas = Grasshopper.Instances.ActiveCanvas;

            if (canvas != null)
            {
                //make sure to hide the window when the user switches active GH document.
                canvas.DocumentChanged -= HideWindow;
                canvas.DocumentChanged += HideWindow;
            }
        }
Пример #18
0
        public override void CreateFinder(Components.Finder.Finder finder)
        {
            if (CreateUI == false)
            {
                return;
            }

            _finderConfig = finder.Config;

            _finderWindow = new FinderWindow
            {
                Top         = finder.Config.Top,
                Left        = finder.Config.Left,
                Width       = finder.Config.Width,
                Height      = finder.Config.Height,
                DataContext = finder
            };

            _finderWindow.IsVisibleChanged += (sender, args) => _finderConfig.Visible = _finderWindow.IsVisible;
            _finderWindow.LocationChanged  += (sender, args) => _finderLocationJustChanged = true;
            _finderWindow.SizeChanged      += (sender, args) => _finderLocationJustChanged = true;
            _finderWindow.ObjectSelected   += (sender, args) => { GearsetResources.Console.Inspect(args.Name, args.Object); };

            if (_finderConfig.Visible)
            {
                _finderWindow.Show();
            }

            _windows.Add(_finderWindow);

            WindowHelper.EnsureOnScreen(_finderWindow);
            ElementHost.EnableModelessKeyboardInterop(_finderWindow);
        }
Пример #19
0
        private void SetupQuickMainWindowAndHandler(object obj, QuickContext quickContext, IntPtr windowPtr, bool isGlobal, Process currentProcess)
        {
            if (m_handlerMap == null)
                m_handlerMap = new Dictionary<QuickModel, QuickMainWindowHandler>();
            if (m_windowMap == null)
                m_windowMap = new Dictionary<QuickMainWindowHandler, QuickMainWindow>();

            QuickMainWindowHandler handler = null;
            if (m_handlerMap.ContainsKey(m_currentModel))
            {
                handler = m_handlerMap[m_currentModel];
            }
            else
            {
                handler = new QuickMainWindowHandler(obj, m_currentModel, quickContext, windowPtr, isGlobal, currentProcess);
                m_handlerMap.Add(m_currentModel, handler);
            }

            if (m_windowMap.ContainsKey(handler))
            {
                m_quickMainWindow = m_windowMap[handler];
            }
            else
            {
                m_quickMainWindow = new QuickMainWindow(handler);
                ElementHost.EnableModelessKeyboardInterop(m_quickMainWindow);
                m_windowMap.Add(handler, m_quickMainWindow);
            }

            System.Windows.Media.Color bgColor = System.Windows.Media.Color.FromRgb((byte)m_currentModel.BorderColorR, (byte)m_currentModel.BorderColorG, (byte)m_currentModel.BorderColorB);
            m_quickMainWindow.SetBackgroundColor(bgColor);
        }
Пример #20
0
        public bool Edit(IWin32Window owner, ITranslationProvider translationProvider, LanguagePair[] languagePairs, ITranslationProviderCredentialStore credentialStore)
        {
            var editProvider = translationProvider as DeepLMtTranslationProvider;

            if (editProvider == null)
            {
                return(false);
            }

            //get saved key if there is one and put it into options
            var savedCredentials = GetCredentials(credentialStore, "deeplprovider:///");

            if (savedCredentials != null)
            {
                editProvider.Options.ApiKey = savedCredentials.Credential;
            }

            var dialog = new DeepLWindow(editProvider.Options, savedCredentials, languagePairs);

            ElementHost.EnableModelessKeyboardInterop(dialog);
            dialog.ShowDialog();
            if (dialog.DialogResult.HasValue && dialog.DialogResult.Value)
            {
                editProvider.Options = dialog.Options;
                var apiKey = editProvider.Options.ApiKey;
                SetDeeplCredentials(credentialStore, apiKey, true);
                return(true);
            }
            return(false);
        }
Пример #21
0
        private void btnCustomPropEditor_Click(object sender, EventArgs e)
        {
            var form = new CustomPropEditorWindow();

            ElementHost.EnableModelessKeyboardInterop(form);
            form.ShowDialog();
        }
Пример #22
0
        private object FindRoot()
        {
            object root = null;

            if (SnoopModes.MultipleDispatcherMode)
            {
                foreach (PresentationSource presentationSource in PresentationSource.CurrentSources)
                {
                    if
                    (
                        presentationSource.RootVisual != null &&
                        presentationSource.RootVisual is UIElement &&
                        ((UIElement)presentationSource.RootVisual).Dispatcher.CheckAccess()
                    )
                    {
                        root = presentationSource.RootVisual;
                        break;
                    }
                }
            }
            else if (Application.Current != null)
            {
                root = Application.Current;
            }
            else
            {
                // if we don't have a current application,
                // then we must be in an interop scenario (win32 -> wpf or windows forms -> wpf).


                // in this case, let's iterate over PresentationSource.CurrentSources,
                // and use the first non-null, visible RootVisual we find as root to inspect.
                foreach (PresentationSource presentationSource in PresentationSource.CurrentSources)
                {
                    if
                    (
                        presentationSource.RootVisual != null &&
                        presentationSource.RootVisual is UIElement &&
                        ((UIElement)presentationSource.RootVisual).Visibility == Visibility.Visible
                    )
                    {
                        root = presentationSource.RootVisual;
                        break;
                    }
                }


                if (System.Windows.Forms.Application.OpenForms.Count > 0)
                {
                    // this is windows forms -> wpf interop

                    // call ElementHost.EnableModelessKeyboardInterop to allow the Snoop UI window
                    // to receive keyboard messages. if you don't call this method,
                    // you will be unable to edit properties in the property grid for windows forms interop.
                    ElementHost.EnableModelessKeyboardInterop(this);
                }
            }

            return(root);
        }
Пример #23
0
        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();
                    // 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();
                }
                else
                {
                    mMainWindow.Focus();
                }

                // forces a refresh:
                mCurrentViewModel = new ElementAnimationsViewModel();

                RefreshViewModel();
            }
        }
Пример #24
0
        public Finder()
            : base(GearsetSettings.Instance.FinderConfig)
        {
            Config = GearsetSettings.Instance.FinderConfig;

            Window = new FinderWindow();
            ElementHost.EnableModelessKeyboardInterop(Window);
            Window.SizeChanged      += new System.Windows.SizeChangedEventHandler(Window_SizeChanged);
            Window.IsVisibleChanged += new DependencyPropertyChangedEventHandler(Window_IsVisibleChanged);
            Window.LocationChanged  += new EventHandler(Window_LocationChanged);
            Window.DataContext       = this;
            Window.Top    = Config.Top;
            Window.Left   = Config.Left;
            Window.Width  = Config.Width;
            Window.Height = Config.Height;

            WindowHelper.EnsureOnScreen(Window);

            if (Config.Visible)
            {
                Window.Show();
            }

            Config.SearchTextChanged += new EventHandler(Config_SearchTextChanged);
            searchDelay = .25f;
        }
Пример #25
0
        public TimelineImageNoticeOverlay()
        {
            ElementHost.EnableModelessKeyboardInterop(this);
            this.InitializeComponent();
            this.LoadConfigViewResources();

            this.ToNonActive();

            this.MouseLeftButtonDown += (x, y) => this.DragMove();

            this.Opacity        = 0;
            this.Topmost        = false;
            this.OverlayVisible = false;

            this.Loaded += (x, y) =>
            {
                this.IsClickthrough = this.Config.Clickthrough;
                this.SubscribeZOrderCorrector();
                this.EnsureTopMost();
            };

#if DEBUG
            if (WPFHelper.IsDesignMode)
            {
                this.Model     = TimelineImageNoticeModel.DummyNotice;
                this.DummyMode = true;
            }
#endif
        }
Пример #26
0
 public ConnectionInfoView(ConnectionInfoViewModel connectionInfoViewModel) : this()
 {
     DataContext = connectionInfoViewModel;
     connectionInfoViewModel.CloseRequest += (sender, e) => this.Close();
     WindowStartupLocation = WindowStartupLocation.CenterScreen;
     ElementHost.EnableModelessKeyboardInterop(this);
 }
Пример #27
0
        //盔甲架生成器
        public void ArmorStandSpawner(Form obj, SoundPlayer click_sound)
        {
            Window as_form = new ArmorStandForm(obj);

            ElementHost.EnableModelessKeyboardInterop(as_form);
            as_form.Show();
        }
Пример #28
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            var wpfwindow = new WpfApp.MainWindow();

            //wpfwindow.bla = new Reports.XtraReport1();
            ElementHost.EnableModelessKeyboardInterop(wpfwindow);
            wpfwindow.Show();
        }
 static CiscoObjectsWindow()
 {
     //System.Windows.Forms.Application.OpenForms[0].Invoke(() =>
     //{
     This = new CiscoObjectsWindow();
     ElementHost.EnableModelessKeyboardInterop(This);
     //});
 }
Пример #30
0
 public static void Show(this Window window, bool enableModelessKeyboardInterop)
 {
     if (enableModelessKeyboardInterop)
     {
         ElementHost.EnableModelessKeyboardInterop(window);
     }
     window.Show();
 }