private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)HwndSource.FromVisual(App.Current.MainWindow));

            hotKeyHost.AddHotKey(new CustomHotKey("Execute", Key.F5, ModifierKeys.None, true, new EventHandler(delegate { btnExecute_Click(sender, e); })));
            this.LoadParamSet();
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)HwndSource.FromVisual(App.Current.MainWindow));

            hotKeyHost.AddHotKey(new CustomHotKey("SumClipboard", Key.F5, ModifierKeys.Control, true));
            hotKeyHost.AddHotKey(new CustomHotKey("AddClipboard", Key.F6, ModifierKeys.Control, true));
            hotKeyHost.HotKeyPressed += pressevent;
        }
Ejemplo n.º 3
0
        private void InitialiseHotKey(Window window)
        {
            _hotKeyHost = new HotKeyHost(window);
            _hotKeyHost.AddHotKey(_showCommandHotKey);
            _hotKeyHost.AddHotKey(_showProcessHotKey);
            _hotKeyHost.AddHotKey(_showClipboardHotKey);
            _hotKeyHost.AddHotKey(_showDirHotKey);
//            _hotKeyHost.AddHotKey(_showSettingsHotKey);
        }
Ejemplo n.º 4
0
        private void assignHotkeys(object sender, RoutedEventArgs e)
        {
            hotkeyHost = new HotKeyHost((HwndSource)HwndSource.FromVisual(this));
            hotkeyHost.AddHotKey(new ShowUserListHotkey("ShowUserListHotkey", Key.U, ModifierKeys.Control | ModifierKeys.Shift, true));
            hotkeyHost.AddHotKey(new ShowServerChatHotkey("ShowServerChatHotkey", Key.S, ModifierKeys.Shift | ModifierKeys.Control, true));
            hotkeyHost.AddHotKey(new ShowGameListHotkey("ShowGameListHotkey", Key.G, ModifierKeys.Shift | ModifierKeys.Control, true));
            hotkeyHost.AddHotKey(new BeginDisconnectHotkey("BeginDisconnectHotkey", Key.D, ModifierKeys.Control | ModifierKeys.Shift, true));
            hotkeyHost.AddHotKey(new MinimizeAllWindowsHotkey("MinimizeAllWindowsHotkey", Key.M, ModifierKeys.Shift | ModifierKeys.Control, true));

        }
Ejemplo n.º 5
0
        public void register_hotkey()
        {
            HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)HwndSource.FromVisual(this));
            HotKey     hotkey     = new HotKey(Key.P, ModifierKeys.Shift | ModifierKeys.Control, true);

            hotkey.HotKeyPressed += new EventHandler <HotKeyEventArgs>(delegate(Object o, HotKeyEventArgs e)
            {
                AppController.Current.open_compose_window();
            });
            hotKeyHost.AddHotKey(hotkey);
        }
Ejemplo n.º 6
0
        public Settings(Player player, Config config, HotKeyHost keyHost)
        {
            InitializeComponent();

            _config  = config;
            _player  = player;
            _keyHost = keyHost;
            HotKeyItems.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("HotKeys")
            {
                Source = _keyHost, NotifyOnSourceUpdated = true, Mode = BindingMode.OneWay
            });
        }
Ejemplo n.º 7
0
        private void FinalLoad()
        {
            Version ver = Assembly.GetEntryAssembly().GetName().Version;
            if (_config.Fields.Elpis_Version == null || _config.Fields.Elpis_Version < ver)
            {
                _loadingPage.UpdateStatus("Running update logic...");

                string oldVer = _config.Fields.Elpis_Version.ToString();

                _config.Fields.Elpis_Version = ver;
                _config.SaveConfig();

            #if APP_RELEASE
                var post = new PostSubmitter(ReleaseData.AnalyticsPostURL);

                post.Add("guid", _config.Fields.Elpis_InstallID);
                post.Add("curver", oldVer);
                post.Add("newver", _config.Fields.Elpis_Version.ToString());
                post.Add("osver", SystemInfo.GetWindowsVersion());

                try
                {
                    post.Send();
                }
                catch(Exception ex)
                {
                    Log.O(ex.ToString());
                }
            #endif
            }

            _loadingPage.UpdateStatus("Loading audio engine...");
            try
            {
                _player = new Player();
                _player.Initialize(_bassRegEmail, _bassRegKey); //TODO - put this in the login sequence?
                if(_config.Fields.Proxy_Address != string.Empty)
                    _player.SetProxy(_config.Fields.Proxy_Address, _config.Fields.Proxy_Port,
                        _config.Fields.Proxy_User, _config.Fields.Proxy_Password);
                if (!_config.Fields.System_OutputDevice.IsNullOrEmpty())
                    _player.OutputDevice = _config.Fields.System_OutputDevice;
            }
            catch(Exception ex)
            {
                ShowError(ErrorCodes.ENGINE_INIT_ERROR, ex);
                return;
            }

            LoadLastFM();

            _player.AudioFormat = _config.Fields.Pandora_AudioFormat;
            _player.SetStationSortOrder(_config.Fields.Pandora_StationSortOrder);
            _player.Volume = _config.Fields.Elpis_Volume;
            _player.PauseOnLock = _config.Fields.Elpis_PauseOnLock;
            _player.MaxPlayed = _config.Fields.Elpis_MaxHistory;

            //_player.ForceSSL = _config.Fields.Misc_ForceSSL;

            _loadingPage.UpdateStatus("Setting up cache...");
            string cachePath = Path.Combine(Config.ElpisAppData, "Cache");
            if (!Directory.Exists(cachePath)) Directory.CreateDirectory(cachePath);
            _player.ImageCachePath = cachePath;

            _loadingPage.UpdateStatus("Starting Web Server...");

            startWebServer();

            _loadingPage.UpdateStatus("Setting up UI...");

            this.Dispatch(() => {
                _keyHost = new HotKeyHost(this);
                ConfigureHotKeys();
            });

            //this.Dispatch(SetupJumpList);

            this.Dispatch(SetupNotifyIcon);

            this.Dispatch(() => mainBar.DataContext = _player); //To bind playstate

            this.Dispatch(SetupPages);
            this.Dispatch(SetupUIEvents);
            this.Dispatch(SetupPageEvents);

            if (_config.Fields.Login_AutoLogin &&
                (!string.IsNullOrEmpty(_config.Fields.Login_Email)) &&
                (!string.IsNullOrEmpty(_config.Fields.Login_Password)))
            {
                _player.Connect(_config.Fields.Login_Email, _config.Fields.Login_Password);
            }
            else
            {
                transitionControl.ShowPage(_loginPage);
            }

            this.Dispatch(() => mainBar.Volume = _player.Volume);

            _finalComplete = true;
        }
Ejemplo n.º 8
0
		private void OverlayMenu_Click(object sender, RoutedEventArgs e)
		{
			overlay = new Overlay();
			overlay.SetCurrentClient(MyClient);
			overlay.Show();
			IEnumerable<Monitor> monitors = Monitor.AllMonitors;
			foreach (Monitor mymonitor in monitors)
			{
				if (mymonitor.IsPrimary == true)
				{
					overlay.Left = mymonitor.Bounds.Right - overlay.Width;
					overlay.Top = mymonitor.Bounds.Top;
				}
			}
			overlay.Topmost = true;
			HotKeyHost hotKeyHost = new HotKeyHost((HwndSource) PresentationSource.FromVisual(Application.Current.MainWindow));
			hotKeyHost.AddHotKey(new CustomHotKey("ToggleOverlay", Key.O, ModifierKeys.Control | ModifierKeys.Alt, true));
			hotKeyHost.HotKeyPressed += handleHotkeyPress;
		}
Ejemplo n.º 9
0
 public void register_hotkey()
 {
     HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)HwndSource.FromVisual(this));
     HotKey hotkey = new HotKey(Key.P, ModifierKeys.Shift|ModifierKeys.Control, true);
     hotkey.HotKeyPressed += new EventHandler<HotKeyEventArgs>(delegate(Object o, HotKeyEventArgs e)
     {
         AppController.Current.open_compose_window();
     });
     hotKeyHost.AddHotKey(hotkey);
 }
Ejemplo n.º 10
0
        public Settings(Player player, Config config, HotKeyHost keyHost)
        {
            InitializeComponent();

            _config = config;
            _player = player;
            _keyHost = keyHost;
            HotKeyItems.SetBinding(ItemsControl.ItemsSourceProperty, new Binding("HotKeys") {Source = _keyHost, NotifyOnSourceUpdated=true, Mode=BindingMode.OneWay });
        }
Ejemplo n.º 11
0
		private void OverlayMenu_Click(object sender, RoutedEventArgs e)
		{
			if (_overlay == null)
			{
				_overlay = new Overlay();
				_overlay.SetCurrentClient(MyClient);
				_overlay.Show();
				IEnumerable<Monitor> monitors = Monitor.AllMonitors;
				if (Settings.Default.OverlayMonitor != "")
				{
					Logger.Debug("Overlaymonitor is" + Settings.Default.OverlayMonitor);
					foreach (Monitor mymonitor in monitors)
					{
						if (mymonitor.Name == Settings.Default.OverlayMonitor)
						{
							_overlay.Left = mymonitor.Bounds.Right - _overlay.Width;
							_overlay.Top = mymonitor.Bounds.Top;
							_overlay.Topmost = true;
							Logger.Debug("Overlay coordinates set to " + _overlay.Left + " x " + _overlay.Top);
							HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)PresentationSource.FromVisual(Application.Current.MainWindow));
							//hotKeyHost.AddHotKey(new CustomHotKey("ToggleOverlay", Key.O, ModifierKeys.Control | ModifierKeys.Alt , true));
							//hotKeyHost.AddHotKey(new CustomHotKey("CopyClientSystemname", Key.C, ModifierKeys.Control | ModifierKeys.Alt , true));
							//hotKeyHost.HotKeyPressed += HandleHotkeyPress;
                            // Broken all of a sudden? May require recode.
						}
					}
				}
				else
				{
					foreach (Monitor mymonitor in monitors)
					{
						Logger.Debug("Monitor ID: " + mymonitor.Name);
						if (mymonitor.IsPrimary)
						{
							_overlay.Left = mymonitor.Bounds.Right - _overlay.Width;
							_overlay.Top = mymonitor.Bounds.Top;
						}
					}
					_overlay.Topmost = true;
					HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)PresentationSource.FromVisual(Application.Current.MainWindow));
					hotKeyHost.AddHotKey(new CustomHotKey("ToggleOverlay", Key.O, ModifierKeys.Control | ModifierKeys.Alt, true));
					hotKeyHost.AddHotKey(new CustomHotKey("CopyClientSystemname", Key.C, ModifierKeys.Control | ModifierKeys.Alt, true));
					hotKeyHost.HotKeyPressed += HandleHotkeyPress;
				}
			}
			else {
				_overlay.Close();
			}
		}
Ejemplo n.º 12
0
        private void FinalLoad()
        {
            Version ver = Assembly.GetEntryAssembly().GetName().Version;

            if (_config.Fields.Elpis_Version == null || _config.Fields.Elpis_Version < ver)
            {
                _loadingPage.UpdateStatus("Running update logic...");

                string oldVer = _config.Fields.Elpis_Version.ToString();

                _config.Fields.Elpis_Version = ver;
                _config.SaveConfig();

#if APP_RELEASE
                var post = new PostSubmitter(ReleaseData.AnalyticsPostURL);

                post.Add("guid", _config.Fields.Elpis_InstallID);
                post.Add("curver", oldVer);
                post.Add("newver", _config.Fields.Elpis_Version.ToString());
                post.Add("osver", SystemInfo.GetWindowsVersion());

                try
                {
                    post.Send();
                }
                catch (Exception ex)
                {
                    Log.O(ex.ToString());
                }
#endif
            }

            _loadingPage.UpdateStatus("Loading audio engine...");
            try
            {
                _player = new Player();
                _player.Initialize(_bassRegEmail, _bassRegKey); //TODO - put this in the login sequence?
                if (_config.Fields.Proxy_Address != string.Empty)
                {
                    _player.SetProxy(_config.Fields.Proxy_Address, _config.Fields.Proxy_Port,
                                     _config.Fields.Proxy_User, _config.Fields.Proxy_Password);
                }
            }
            catch (Exception ex)
            {
                ShowError(ErrorCodes.ENGINE_INIT_ERROR, ex);
                return;
            }

            LoadLastFM();

            _player.AudioFormat = _config.Fields.Pandora_AudioFormat;
            _player.SetStationSortOrder(_config.Fields.Pandora_StationSortOrder);
            _player.Volume      = _config.Fields.Elpis_Volume;
            _player.PauseOnLock = _config.Fields.Elpis_PauseOnLock;
            _player.MaxPlayed   = _config.Fields.Elpis_MaxHistory;

            //_player.ForceSSL = _config.Fields.Misc_ForceSSL;


            _loadingPage.UpdateStatus("Setting up cache...");
            string cachePath = Path.Combine(Config.ElpisAppData, "Cache");
            if (!Directory.Exists(cachePath))
            {
                Directory.CreateDirectory(cachePath);
            }
            _player.ImageCachePath = cachePath;

            _loadingPage.UpdateStatus("Starting Web Server...");

            startWebServer();

            _loadingPage.UpdateStatus("Setting up UI...");

            this.Dispatch(() => {
                _keyHost = new HotKeyHost(this);
                ConfigureHotKeys();
            });

            //this.Dispatch(SetupJumpList);

            this.Dispatch(SetupNotifyIcon);

            this.Dispatch(() => mainBar.DataContext = _player); //To bind playstate

            this.Dispatch(SetupPages);
            this.Dispatch(SetupUIEvents);
            this.Dispatch(SetupPageEvents);

            if (_config.Fields.Login_AutoLogin &&
                (!string.IsNullOrEmpty(_config.Fields.Login_Email)) &&
                (!string.IsNullOrEmpty(_config.Fields.Login_Password)))
            {
                _player.Connect(_config.Fields.Login_Email, _config.Fields.Login_Password);
            }
            else
            {
                transitionControl.ShowPage(_loginPage);
            }

            this.Dispatch(() => mainBar.Volume = _player.Volume);

            _finalComplete = true;
        }
Ejemplo n.º 13
0
        ///////////////////////////////////////////

        #endregion


        #region Event Handlers
        // Loaded event for this MainWindow [E]
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            #region HotKeys Registrtion
            // Associate Hot Keys >>>
            HotKeyHost KeyHost = new HotKeyHost((HwndSource)HwndSource.FromVisual(this));
            HotKey[]   hotKeys = new HotKey[11];

            hotKeys[0]  = new HotKey(Key.Home, ModifierKeys.Control | ModifierKeys.Alt, true);
            hotKeys[1]  = new HotKey(Key.PageDown, ModifierKeys.Control | ModifierKeys.Alt, true);
            hotKeys[2]  = new HotKey(Key.PageUp, ModifierKeys.Control | ModifierKeys.Alt, true);
            hotKeys[3]  = new HotKey(Key.Right, ModifierKeys.Control | ModifierKeys.Alt, true);
            hotKeys[4]  = new HotKey(Key.Left, ModifierKeys.Control | ModifierKeys.Alt, true);
            hotKeys[5]  = new HotKey(Key.Up, ModifierKeys.Control | ModifierKeys.Alt, true);
            hotKeys[6]  = new HotKey(Key.Down, ModifierKeys.Control | ModifierKeys.Alt, true);
            hotKeys[7]  = new HotKey(Key.MediaPlayPause, ModifierKeys.None, true);
            hotKeys[8]  = new HotKey(Key.MediaNextTrack, ModifierKeys.None, true);
            hotKeys[9]  = new HotKey(Key.MediaPreviousTrack, ModifierKeys.None, true);
            hotKeys[10] = new HotKey(Key.End, ModifierKeys.Alt | ModifierKeys.Control, true); // <---

            hotKeys[0].HotKeyPressed  += (o, s) => { PlayPause(); };
            hotKeys[1].HotKeyPressed  += (o, s) => { PlayNext(); };
            hotKeys[2].HotKeyPressed  += (o, s) => { PlayPrevious(); };
            hotKeys[3].HotKeyPressed  += (o, s) => { seekForward(2000); };
            hotKeys[4].HotKeyPressed  += (o, s) => { seekBackword(2000); };
            hotKeys[5].HotKeyPressed  += (o, s) => { VolumeUp(); };
            hotKeys[6].HotKeyPressed  += (o, s) => { VolumeDown(); };
            hotKeys[7].HotKeyPressed  += (o, s) => { PlayPause(); };
            hotKeys[8].HotKeyPressed  += (o, s) => { PlayNext(); };
            hotKeys[9].HotKeyPressed  += (o, s) => { PlayPrevious(); };
            hotKeys[10].HotKeyPressed += (o, s) => { StopPlay(); };

            foreach (HotKey hKey in hotKeys)
            {
                try  { KeyHost.AddHotKey(hKey); }
                catch { continue; }
            }
            #endregion

            // Reading User Preferences from Registry >>>
            ReadRegistrys();

            // Window DragMove Logic >>>
            this.MouseLeftButtonDown += (o, s) => { if (s.LeftButton == MouseButtonState.Pressed)
                                                    {
                                                        this.DragMove();
                                                    }
            };

            // initialize ISoundEngine instance...!
            soundEngine = new ISoundEngine();

            // initialize PlayerEvents class instance with event handlers...!
            player_events = new PlayerEvents();
            player_events.TimerInterval    = TimeSpan.FromSeconds(0.8);
            player_events.IsTimerEnable    = false;
            player_events.OnTimerTick     += player_events_OnTimerTick;
            player_events.OnSoundFinished += player_events_OnSoundFinished;

            // initialize HoverCountdown instance, to manage visibility for elements...!
            HoverVisibility                = new HoverCountdown(this, TimeSpan.FromSeconds(5));
            HoverVisibility.OnMouseMove   += HoverVisibility_OnMouseMove;
            HoverVisibility.OnTimeElapsed += HoverVisibility_OnTimeElapsed;

            // Adding command arguments to the play list >>
            string[] cmdArg = Environment.GetCommandLineArgs();
            if (cmdArg.Length > 1)
            {
                //////////////////////////////////////////////
                fileManager.AddFiles(cmdArg, false, true);
                //////////////////////////////////////////////
            }
        }
Ejemplo n.º 14
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     HotKeyHost hotKeyHost = new HotKeyHost((HwndSource)HwndSource.FromVisual(App.Current.MainWindow));
     hotKeyHost.AddHotKey(new CustomHotKey("ToggleOverlay", Key.F1, ModifierKeys.None, true,this));
     hotKeyHost.AddHotKey(new CustomHotKey("ToggleBot", Key.F2, ModifierKeys.None, true, this));
     hotKeyHost.AddHotKey(new CustomHotKey("ChangeBotMode", Key.F3, ModifierKeys.None, true, this));
     backgroundWorker.WorkerReportsProgress = true;
     backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
     backgroundWorker.WorkerSupportsCancellation = true;
     backgroundWorker.DoWork += backgroundWorker_DoWork;
     backgroundWorker.ProgressChanged += backgroundWorker_ProgressChanged;
     LoadBots();
     var le = new LogEntry();
     le.BotScriptInfo = "init";
     le.EnemyScriptInfo = "init";
     le.Message = "Loaded!";
     log.Insert(0, le);
     System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
     dispatcherTimer.Tick += dispatcherTimer_Tick;
     dispatcherTimer.Interval = new TimeSpan(0, 0, 5);
    // dispatcherTimer.Start();
 }