示例#1
0
        public MainWindow()
        {
            InitializeComponent();

            HotkeysManager.SetupSystemHook();

            GlobalHotkey hotkey1 = new GlobalHotkey(ModifierKeys.Alt, Key.N, Hotkey1);
            GlobalHotkey hotkey2 = new GlobalHotkey(ModifierKeys.Alt, Key.M, Hotkey2);

            HotkeysManager.AddHotkey(hotkey1);
            HotkeysManager.AddHotkey(hotkey2);

            #region send application to tray

            System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();
            ni.Icon    = new System.Drawing.Icon("image.ico");
            ni.Visible = true;
            ni.Click  +=
                delegate(object sender, EventArgs e)
            {
                this.Show();
                this.WindowState = System.Windows.WindowState.Normal;
            };
            ni.DoubleClick +=
                delegate(object sender, EventArgs e)
            {
                this.WindowState = System.Windows.WindowState.Normal;
                close            = true;
                this.Close();
            };

            #endregion

            audioController = new CoreAudioController();
            defaultOutput   = audioController.DefaultPlaybackDevice;

            var OutputDevices = audioController.GetPlaybackDevices(DeviceState.Active);

            foreach (var device in OutputDevices)
            {
                dropDownMenu.Items.Add(device.FullName);
                dropDownMenu2.Items.Add(device.FullName);
            }

            data = SaveLoadManager.Load();


            if (data != null)
            {
                dropDownMenu.Text  = data.device1Name;
                dropDownMenu2.Text = data.device2Name;
            }

            AddHotKeys();
        }
示例#2
0
        public MainWindow()
        {
            InitializeComponent();

            // need to setup the global hook. this can go in
            // App.xaml.cs's constructor if you want
            HotkeysManager.SetupSystemHook();

            // You can create a globalhotkey object and pass it like so
            HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.Control, Key.S, () => { AddToList("Ctrl+S Fired"); }));

            // or do it like this. both end up doing the same thing, but this is probably simpler.
            HotkeysManager.AddHotkey(ModifierKeys.Control, Key.A, () => { AddToList("Ctrl+A Fired"); });
            HotkeysManager.AddHotkey(ModifierKeys.Control, Key.D, () => { AddToList("Ctrl+D Fired"); });
            HotkeysManager.AddHotkey(ModifierKeys.Shift, Key.D, () => { AddToList("Shift+D Fired"); });

            Closing += MainWindow_Closing;
        }
示例#3
0
        public MainWindow()
        {
            //Cache

            cacheCheck();

            //Cache


            //Context And Trayy
            contextMenu1.Items.Add("Epog");
            contextMenu1.Items.Add(System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString());
            contextMenu1.Items.Add("");

            contextMenu1.Items.Add("Cache");
            contextMenu1.Items.Add("Settings");
            contextMenu1.Items.Add("");
            contextMenu1.Items.Add("Exit");
            notifyIcon                  = new System.Windows.Forms.NotifyIcon();
            notifyIcon.Text             = "Print Screen";
            notifyIcon.Visible          = true;
            notifyIcon.Icon             = print_scrn.Properties.Resources.prntsc;
            contextMenu1.Opening       += new CancelEventHandler(contextMenu1_Opening);
            contextMenu1.ItemClicked   += new ToolStripItemClickedEventHandler(contextMenu1_ItemClicked);
            notifyIcon.ContextMenuStrip = contextMenu1;
            notifyIcon.Click           += new System.EventHandler(this.NotifyIcon_Click);
            //Context And Trayy

            InitializeComponent();
            //Keyboard Hook
            HotkeysManager.SetupSystemHook();
            HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.None, Key.PrintScreen, () => {
                if (!isActive)
                {
                    isActive = true; Form1 frm = new Form1(); frm.Show(); frm.FormClosing += new FormClosingEventHandler(frm_FormClosed);
                }
            }));
            //Keyboard Hook


            Closing += MainWindow_Closing;
        }
示例#4
0
        public CashierView()
        {
            InitializeComponent();
            this.Loaded += Load;

            togglebuttonScanner.IsChecked = Properties.Settings.Default.Setting_ScannerIsUsed;

            // set hotkey
            // key: +
            HotkeysManager.AddHotkey(ModifierKeys.None, Key.Add, () => {
                ButtonAutomationPeer peer  = new ButtonAutomationPeer(btnPayment);
                IInvokeProvider invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
                invokeProv.Invoke();
            });

            // key: ` (below esc)
            HotkeysManager.AddHotkey(ModifierKeys.None, Key.OemTilde, () => {
                tbBarcode.Focus();
            });
        }
示例#5
0
        //OnLoad
        public MainWindow()
        {
            InitializeComponent();

            //Bindings
            HotkeysManager.SetupSystemHook();

            //Add
            HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.Control, Key.Add, () => { Add(); }));
            HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.Control, Key.OemPlus, () => { Add(); }));
            HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.Control, Key.D1, () => { Add(); }));
            //Subtract
            HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.Control, Key.Subtract, () => { Subtract(); }));
            HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.Control, Key.OemMinus, () => { Subtract(); }));
            HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.Control, Key.OemTilde, () => { Subtract(); }));
            //Reset
            //HotkeysManager.AddHotkey(new GlobalHotkey(ModifierKeys.Control, Key.R, () => { Reset(); }));

            //stay at front
            this.Topmost = true;

            //for OnExit
            this.Closed += new EventHandler(MainWindow_Closed);

            //try reads the text file & catch creates one if one doesn't exist
            try
            {
                tb.Text = File.ReadAllText("xyz.txt");
                _value  = int.Parse(tb.Text);
            }
            catch
            {
                Write();
                tb.Text = "Welcome!";
            }
        }