Пример #1
0
 void InitialShow()
 {
     NativeWindow owner = new NativeWindow();
     owner.AssignHandle(((HwndSource)HwndSource.FromVisual(_owner)).Handle);
     _form.Show(owner);
     owner.ReleaseHandle();
 }
Пример #2
0
        public IDoxSession CreateAuthenticatedSession(string defaultUserEmail)
        {
            var outlookWindow = new NativeWindow();
            try
            {
                outlookWindow.AssignHandle(FindWindowEx(IntPtr.Zero, IntPtr.Zero, "rctrl_renwnd32", null));
                _loginUi.NativeWindow = outlookWindow;
                _loginUi.LoginFieldEnabled = true;
                _loginUi.RegisterTabVisible = true;

                IAuthenticator authenticator = new Authenticator(_loginUi);
                authenticator.Api = new DoxApi(OptionApi.GetString("SendLinkServiceUrl"));
                string username = OptionApi.GetString("SendLinkCloudStorageLoginName");
                username = string.IsNullOrEmpty(username) ? defaultUserEmail : username;

                string deviceToken = OptionApi.GetEncrypted("SendLinkDeviceToken", _entropy);
                bool cancelled;
                var session = authenticator.Authenticate(username, deviceToken, out cancelled);
                if (cancelled)
                {
                    throw new AbortSendLinkException("User cancelled Sendlink", false);
                }
                return session;
            }
            finally
            {
                if (outlookWindow != null)
                {
                    // TFS 6777: Outlook 2010 + Interwoven EMM: On cancel, Mail Inspector "Send" button inoperable, outlook remains in memory.
                    outlookWindow.ReleaseHandle();
                }
            }
        }
Пример #3
0
 void InitialShow()
 {
     //create new NativeWindow
     var nativeWindow = new NativeWindow();
     //extract HwndSource from WPF Window
     var hwndSource = (HwndSource)PresentationSource.FromVisual(_WpfWindow);
     if (hwndSource != null)
     {
         //assign handle to NativeWindow
         nativeWindow.AssignHandle(hwndSource.Handle);
     }
     _WinForm.Opacity = 0;
     //show WinForm settin newly created NativeWindow as owner
     _WinForm.Show(nativeWindow);
     //release NativeWindow handle
     nativeWindow.ReleaseHandle();
 }
Пример #4
0
        private void Application_WindowActivate(Word.Document Doc, Word.Window Wn)
        {
            // for User Testing
            endSwitchTime = DateTime.Now;
            appendSwitchWindowString();

            // Track the handle ID for the text editor (Microsoft Word)
            int tempHandle = (int)GetActiveWindow();
            if (handle != tempHandle)
            {
                handle = (int)GetActiveWindow();
                currentSelection = Application.Selection;

                // Retrieve handle of the Microsoft Word window.
                wordMain = new NativeWindow();
                wordMain.AssignHandle(new IntPtr(handle));

                // Hide the form off the screen
                autoCompleteForm.Location = new Point(-1000, -1000);
                notificationForm.Location = new Point(-1000, -1000);
                extendSuggestionForm.Location = new Point(-1000, -1000);

                // Reassign forms' parent
                autoCompleteForm.Visible = false;
                autoCompleteForm.showForm(wordMain); // Assign the form parent to the current active window
                autoCompleteForm.Focus(); // In order to make the child form appear infront of the parent form
                autoCompleteForm.Hide();

                notificationForm.Visible = false;
                notificationForm.Show(wordMain); // Assign the form parent to the current active window
                notificationForm.Focus(); // In order to make the child form appear infront of the parent form
                notificationForm.Hide();

                extendSuggestionForm.Visible = false;
                extendSuggestionForm.Show(wordMain);
                extendSuggestionForm.Focus();
                extendSuggestionForm.Hide();

                wordMain.ReleaseHandle();
            }

            if (!isEnabled && isDisablePopUp)
            {
                Globals.ThisAddIn.Dispatcher.Invoke(new displayMessageDelegate(displayMessage), new Object[] { ERROR_CONNECTION });

                // Disable the pop-up
                isDisablePopUp = false;
            }

            BackgroundWorker b = new BackgroundWorker();
            b.DoWork += delegate(object sender2, DoWorkEventArgs e2)
            {
                try
                {
                    if (isEnabled)
                    {
                        // Inform ACP to change destination document
                        logic.setDestinationDocument(handle);
                    }
                }
                catch (SocketException e)
                {
                    Globals.ThisAddIn.Dispatcher.Invoke(new displayMessageDelegate(displayMessage), new Object[] { ERROR_CONNECTION });
                    markServerDown();
                }
            };
            b.RunWorkerAsync();

            updateApplicationSizeDetail();
            SetActiveWindow(new IntPtr(tempHandle));
        }
Пример #5
0
 /// <summary>
 /// Initials the show.
 /// </summary>
 private void InitialShow()
 {
     var owner = new NativeWindow();
     owner.AssignHandle(((HwndSource)HwndSource.FromVisual(this.owner)).Handle);
     BrowserOverlayContainer.Show(owner);
     owner.ReleaseHandle();
 }