Ejemplo n.º 1
0
 private static Screen Wrap(WinForms.Screen screen)
 {
     if (screen == null)
         return null;
     else
         return new Screen(screen);
 }
Ejemplo n.º 2
0
		public MenuItemProvider (SWF.MenuItem menuItem) :
			base (menuItem)
		{
			this.menuItem = menuItem;
			parentMenu = mainMenu =	menuItem.GetMainMenu ();
			if (parentMenu == null)
				parentMenu = menuItem.GetContextMenu ();
		}
Ejemplo n.º 3
0
		public ListViewProvider (SWF.ListView listView) : base (listView)
		{
			this.listView = listView;

			lastView = listView.View;
			showGroups = listView.ShowGroups;
			groups = new Dictionary<SWF.ListViewGroup, ListViewGroupProvider> ();
		}
Ejemplo n.º 4
0
		public ComboBoxProvider (SWF.ComboBox combobox) : base (combobox)
		{
			comboboxControl = combobox;
			comboboxControl.DropDownStyleChanged += OnDropDownStyleChanged;

			listboxProvider = new ComboBoxProvider.ComboBoxListBoxProvider (comboboxControl,
			                                                                this);
		}
Ejemplo n.º 5
0
        /// <summary>
        /// メインウィンドウのステート変更イベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_StateChanged(object sender, EventArgs e)
        {
            // 最小化時にタスクバーから消し、アイコン化する
            if (WindowState == WindowState.Minimized)
            {
                ShowInTaskbar = false;

                if (notifyIcon == null)
                {
                    var icon = App.GetResourceStream(new Uri("Images/icon.ico", UriKind.Relative)).Stream;
                    var menu = new Forms.ContextMenuStrip();
                    menu.Items.Add(new Forms.ToolStripMenuItem("表示サイズ自動切り替え", null, (s, ev) =>
                    {
                        if (s is Forms.ToolStripMenuItem item)
                        {
                            item.Checked = !item.Checked;
                            var vm       = DataContext as MainViewModel;
                            if (vm != null)
                            {
                                vm.IsCheckedAutoSwitch = item.Checked;
                            }
                        }
                    }));
                    menu.Items.Add(new Forms.ToolStripSeparator());
                    menu.Items.Add(new Forms.ToolStripMenuItem("終了", null, (s, ev) =>
                    {
                        App.Current.Shutdown();
                    }));

                    notifyIcon = new Forms.NotifyIcon
                    {
                        Visible          = true,
                        Icon             = new System.Drawing.Icon(icon),
                        Text             = "UmaFull",
                        ContextMenuStrip = menu
                    };
                    notifyIcon.MouseClick += (s, ev) =>
                    {
                        if (ev.Button == Forms.MouseButtons.Left)
                        {
                            WindowState = WindowState.Normal;
                            Activate();
                        }
                    };
                }
            }
            else if (WindowState == WindowState.Normal)
            {
                // サイズ復元時にアイコン化を解除してタスクバーの表示を再開します
                if (notifyIcon != null)
                {
                    notifyIcon.Dispose();
                    notifyIcon = null;
                }
                ShowInTaskbar = true;
            }
        }
Ejemplo n.º 6
0
 private void OnVlcControlNeedsLibDirectory(object sender, Forms.VlcLibDirectoryNeededEventArgs e)
 {
     var currentAssembly = Assembly.GetEntryAssembly();
     var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
     if (currentDirectory == null)
         return;
     if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
         e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"..\..\..\lib\x86\"));
     else
         e.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, @"..\..\..\lib\x64\"));
 }
Ejemplo n.º 7
0
        private Screen(WinForms.Screen wfScreen)
        {
            if (wfScreen == null)
                throw new ArgumentNullException("wfScreen");
            _original = wfScreen;

            if (Environment.OSVersion.Platform == PlatformID.Win32NT &&
                Environment.OSVersion.Version >= Windows8)
            {
                var monitor = NativeMethods.MonitorFromPoint(
                    new System.Drawing.Point((int)WorkingArea.Left, (int)WorkingArea.Top), 2);
                NativeMethods.GetDpiForMonitor(monitor, DpiType.Effective, out _dpiX, out _dpiY);
            }
            else
            {
                var g = Graphics.FromHwnd(IntPtr.Zero);
                var desktop = g.GetHdc();

                _dpiX = (uint)NativeMethods.GetDeviceCaps(desktop, (int)DeviceCap.LOGPIXELSX);
                _dpiY = (uint)NativeMethods.GetDeviceCaps(desktop, (int)DeviceCap.LOGPIXELSY);
            }
        }
Ejemplo n.º 8
0
 private void OnMouseUp(object sender, Forms.MouseEventArgs e)
 {
     if (e.Button == Forms.MouseButtons.Right)
     {
         ShowContextMenu();
     }
     OnRaiseEvent(MouseUpEvent, new MouseButtonEventArgs(
         InputManager.Current.PrimaryMouseDevice, 0, ToMouseButton(e.Button)));
 }
Ejemplo n.º 9
0
		public ToolTipProvider (SWF.ToolTip tooltip) : base (tooltip)
		{
			this.tooltip = tooltip;
		}
 private void trayicon_Click(object sender, WinForms.MouseEventArgs e)
 {
     if (e.Button == WinForms.MouseButtons.Left)
     {
         NotifyCtr.Instance.DisplayNotification(TwitchDataHandler.Instance.CurrentInfo, ConfigMgnr.I.NotificationScreenTime);
     }
     else if (e.Button == WinForms.MouseButtons.Middle)
     {
         trayicon_OpenMainWindow(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 11
0
		protected override string GetTextFromControl (SWF.Control control)
		{
			return tooltip.GetToolTip (control);
		}
Ejemplo n.º 12
0
 private void OnMouseUp(object sender, Forms.MouseEventArgs e)
 {
     OnRaiseEvent(MouseUpEvent, new MouseButtonEventArgs(
         InputManager.Current.PrimaryMouseDevice, 0, ToMouseButton(e.Button)));
 }
Ejemplo n.º 13
0
        private void OnMouseUp(object sender, Forms.MouseEventArgs args) {

            if(args.Button == Forms.MouseButtons.Right) {

                ContextMenu.IsOpen = true;
                ContextMenu.StaysOpen = false;
            }

            RaiseEvent(CreateMouseButtonEventArgs(MouseUpEvent, args.Button));
        }
Ejemplo n.º 14
0
        private static MouseButtonEventArgs CreateMouseButtonEventArgs(RoutedEvent handler, Forms.MouseButtons button) {
            MouseButton mouse_button;

            if(button == Forms.MouseButtons.Left) {
                mouse_button = MouseButton.Left;

            } else if(button == Forms.MouseButtons.Right) {
                mouse_button = MouseButton.Right;

            } else if(button == Forms.MouseButtons.Middle) {
                mouse_button = MouseButton.Middle;

            } else if(button == Forms.MouseButtons.XButton1) {
                mouse_button = MouseButton.XButton1;

            } else if(button == Forms.MouseButtons.XButton2) {
                mouse_button = MouseButton.XButton2;

            } else {
                throw new InvalidOperationException();
            }

            return new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice, 0, mouse_button) {
                RoutedEvent = handler
            };
        }
Ejemplo n.º 15
0
 private void wbLogin_Navigating(object sender, wf.WebBrowserNavigatingEventArgs e)
 {
     this.btnLoggedIn.IsEnabled = false;
 }
Ejemplo n.º 16
0
		public static WPF_Ribbon create(WinForms.Control control, string title)
		{
			var ribbon = control.add_Ribbon_WithLogViewer(title);       
			ribbon.title(title);    
			return ribbon;
		}
Ejemplo n.º 17
0
 private static Screen Wrap(WinForms.Screen screen)
 {
     return screen == null ? null : new Screen(screen);
 }
Ejemplo n.º 18
0
 private void wbLogin_DocumentCompleted(object sender, wf.WebBrowserDocumentCompletedEventArgs e)
 {
     this.btnLoggedIn.IsEnabled = true;
     this.ProcessDom();
     this.ProcessCookies(this.wbLogin.Document.Cookie, Encoding.GetEncoding(this.wbLogin.Document.Encoding));
     this.wbLogin.Document.Window.Focus();
 }
Ejemplo n.º 19
0
 protected override void OnPaint(SWF.PaintEventArgs e)
 {
 }
Ejemplo n.º 20
0
 private void wbLogin_ProgressChanged(object sender, wf.WebBrowserProgressChangedEventArgs e)
 {
     if (e.CurrentProgress < e.MaximumProgress)
     {
         this.Title = string.Format(
             "Manual Login [{0:N}%]",
             (double)e.CurrentProgress / ((double)e.MaximumProgress / 100)
         );
     }
     else
     {
         this.Title = "Manual Login";
     }
 }
Ejemplo n.º 21
0
 protected override void OnPaintBackground(SWF.PaintEventArgs e)
 {
 }
Ejemplo n.º 22
0
 private void OnMouseDoubleClick(object sender, Forms.MouseEventArgs args) {
     RaiseEvent(CreateMouseButtonEventArgs(MouseDoubleClickEvent, args.Button));
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Responds to key down in hiddenwindow 
        /// </summary>
        //
        void directPlayWindow_KeyDown(object sender, WindowsForms.KeyEventArgs e)
        {
            if (_keyDown != null)
            {
                _logger.Debug("directPlayWindow_KeyDown {0}", e.KeyCode);
                // map from System.Windows.Forms to System.Windows.Input key event
                var window = _presenationManager.MainApplicationWindow;
                
                window.Dispatcher.InvokeAsync(() =>
                {
                    var source = (HwndSource)PresentationSource.FromVisual(window);
                    if (source != null)
                    {
                        var key = KeyInterop.KeyFromVirtualKey((int)e.KeyCode);
                        var keyEventArg = new KeyEventArgs(Keyboard.PrimaryDevice, source, 0, key);

                        _keyDown.Invoke(null, keyEventArg);
                        e.Handled = keyEventArg.Handled;
                    }
                });
            }
        }
Ejemplo n.º 24
0
		/// <remarks>Only works with Windows.Forms.Keys. The WPF Key enum seems to be horribly distorted!</remarks>
		public static string KeyToUnicode(WinForms.Keys key)
		{
			StringBuilder sb = new StringBuilder(256);
			IntPtr hkl = GetKeyboardLayout(0);
			
			uint scanCode = MapVirtualKeyEx((uint)key, 0, hkl);
			if (scanCode < 1) return null;
			
			ClearKeyboardBuffer(hkl);
			int len = ToUnicodeEx((uint)key, scanCode, new byte[256], sb, sb.Capacity, 0, hkl);
			if (len > 0)
				return sb.ToString(0, len).ToUpper();
			
			ClearKeyboardBuffer(hkl);
			return null;
		}
Ejemplo n.º 25
0
 /// <summary>
 /// Responds to key down in hiddenwindow 
 /// </summary>
 //
 void directPlayWindow_MouseMove(object sender, WindowsForms.MouseEventArgs e)
 {
     if (_mouseMove != null)
     {
         //_logger.Debug("directPlayWindow_MouseMove");
         // map from System.Windows.Forms to System.Windows.Input mouse move event
           var window = _presenationManager.MainApplicationWindow.Dispatcher.InvokeAsync(() =>
           {
             var mouseEventArgs = new MouseButtonEventArgs(WindowsInput.InputManager.Current.PrimaryMouseDevice,
                 0,
                 ConvertMouseButton(e.Button));
               if(_mouseMove != null) //experienced an issue when closing the app where _mouseMove went away b/w the test above and when the async exec occured
                 _mouseMove.Invoke(null, mouseEventArgs);
           });
     }
 }
Ejemplo n.º 26
0
 private Screen(WinForms.Screen wfScreen)
 {
     if (wfScreen == null)
         throw new ArgumentNullException("wfScreen");
     this.original = wfScreen;
 }
Ejemplo n.º 27
0
 private WindowsInput.MouseButton ConvertMouseButton(WindowsForms.MouseButtons button)
 {
     switch (button)
     {
         case WindowsForms.MouseButtons.Left:
             return WindowsInput.MouseButton.Left;
         case WindowsForms.MouseButtons.Right:
             return WindowsInput.MouseButton.Right;
         case WindowsForms.MouseButtons.Middle:
             return WindowsInput.MouseButton.Middle;
         case WindowsForms.MouseButtons.XButton1:
             return WindowsInput.MouseButton.XButton1;
         case WindowsForms.MouseButtons.XButton2:
             return WindowsInput.MouseButton.XButton2;
         // can't map none & can't access MouseButtonEventArgs.ButtonState
         // todo - use reflection to set button sate, join new MouseButtonEventArgs call & and this method 
         case WindowsForms.MouseButtons.None:
             return WindowsInput.MouseButton.XButton2; 
     }
     throw new InvalidOperationException();
 }
Ejemplo n.º 28
0
 private MouseButton ToMouseButton(Forms.MouseButtons button)
 {
     switch (button)
     {
         case Forms.MouseButtons.Left:
             return MouseButton.Left;
         case Forms.MouseButtons.Right:
             return MouseButton.Right;
         case Forms.MouseButtons.Middle:
             return MouseButton.Middle;
         case Forms.MouseButtons.XButton1:
             return MouseButton.XButton1;
         case Forms.MouseButtons.XButton2:
             return MouseButton.XButton2;
     }
     throw new InvalidOperationException();
 }
 public WinFormsMouseEventArgs(WinForms.MouseEventArgs e)
 {
     this.eventArgs = e;
 }
Ejemplo n.º 30
0
		public MessageBoxFormProvider (SWF.MessageBox.MessageBoxForm form) : base (form)
		{
			this.form = form;
		}
Ejemplo n.º 31
0
 private void OnMouseMove(object sender, Forms.MouseEventArgs e)
 {
     OnRaiseEvent(MouseMoveEvent, new MouseButtonEventArgs(
         InputManager.Current.PrimaryMouseDevice, 0, MouseButton.Left));
 }