private void TranslucentControlsButton_PreviewMouseLeftButtonUp(
     object sender,
     MouseButtonEventArgs e)
 {
     RegistryManager.Instance.ShowKeyControlsOverlay        = true;
     RegistryManager.Instance.OverlayAvailablePromptEnabled = false;
     KMManager.ShowOverlayWindow(this.ParentWindow, true, true);
     this.mChangeTransparencyPopup.PlacementTarget = (UIElement)this.mTranslucentControlsButtonFullScreen;
     this.mChangeTransparencyPopup.IsOpen          = true;
 }
 private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     KMManager.ChangeTransparency(this.ParentWindow, this.transSlider.Value);
     if (this.transSlider.Value == 0.0)
     {
         if (!RegistryManager.Instance.ShowKeyControlsOverlay)
         {
             KMManager.ShowOverlayWindow(this.ParentWindow, false, false);
         }
         this.ParentWindow.mCommonHandler.OnOverlayStateChanged(false);
     }
     else
     {
         KMManager.ShowOverlayWindow(this.ParentWindow, true, false);
         this.ParentWindow.mCommonHandler.OnOverlayStateChanged(true);
     }
     this.lastSliderValue = this.transSlider.Value;
 }
 internal void ShowGLWindow()
 {
     if (this.CanfrontendBeResizedAndFocused())
     {
         this.ResizeWindow();
     }
     else if (this.ParentWindow.mFrontendGrid.IsVisible)
     {
         if (this.ParentWindow.Handle.ToString().Equals("0", StringComparison.OrdinalIgnoreCase))
         {
             return;
         }
         this.sIsfrontendAlreadyVisible = true;
         if (this.mFrontendHandle == IntPtr.Zero)
         {
             ThreadPool.QueueUserWorkItem((WaitCallback)(obj =>
             {
                 try
                 {
                     this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                     {
                         Rectangle windowRectangle = this.GetWindowRectangle();
                         Dictionary <string, string> dict = new Dictionary <string, string>()
                         {
                             {
                                 "ParentHandle",
                                 !this.ParentWindow.mStreamingModeEnabled ? this.ParentWindow.Handle.ToString() : "0"
                             },
                             {
                                 "X",
                                 windowRectangle.X.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                             },
                             {
                                 "Y",
                                 windowRectangle.Y.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                             },
                             {
                                 "Width",
                                 windowRectangle.Width.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                             },
                             {
                                 "Height",
                                 windowRectangle.Height.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                             },
                             {
                                 "isMute",
                                 this.ParentWindow.IsMuted.ToString((IFormatProvider)CultureInfo.InvariantCulture)
                             }
                         };
                         if (windowRectangle.Width == 0 || windowRectangle.Height == 0)
                         {
                             this.sIsfrontendAlreadyVisible = false;
                         }
                         else
                         {
                             ThreadPool.QueueUserWorkItem((WaitCallback)(obj1 =>
                             {
                                 try
                                 {
                                     lock (this.mLockObject)
                                     {
                                         if (!(this.mFrontendHandle == IntPtr.Zero))
                                         {
                                             return;
                                         }
                                         JObject jobject = JObject.Parse(JArray.Parse(this.SendFrontendRequest("setParent", dict))[0].ToString());
                                         if (jobject["success"].ToObject <bool>())
                                         {
                                             this.mFrontendHandle = new IntPtr(jobject["frontendhandle"].ToObject <int>());
                                         }
                                         System.Action <MainWindow> reparentingCompletedAction = this.ReparentingCompletedAction;
                                         if (reparentingCompletedAction != null)
                                         {
                                             reparentingCompletedAction(this.ParentWindow);
                                         }
                                         Logger.Debug("Set parent call completed. handle: " + this.mFrontendHandle.ToString());
                                     }
                                 }
                                 catch (Exception ex)
                                 {
                                     Logger.Error("Failed to send Show event to engine... err : " + ex.ToString());
                                 }
                             }));
                         }
                     }));
                 }
                 catch (Exception ex)
                 {
                     Logger.Error("Failed to send Show event to engine... err : " + ex.ToString());
                 }
             }));
         }
         else
         {
             this.ResizeWindow();
         }
     }
     else
     {
         this.sIsfrontendAlreadyVisible = false;
         if (!(this.mFrontendHandle != IntPtr.Zero))
         {
             return;
         }
         InteropWindow.ShowWindow(this.mFrontendHandle, 0);
         if (!KMManager.dictOverlayWindow.ContainsKey(this.ParentWindow) || this.ParentWindow.WindowState == WindowState.Maximized)
         {
             return;
         }
         KMManager.ShowOverlayWindow(this.ParentWindow, false, false);
     }
 }