예제 #1
0
        /// <summary>
        /// Initializes T7EBackground.
        /// </summary>
        public Primary()
        {
            InitializeComponent();
            PrimaryIcon   = new Icon(Resource1.PrimaryIcon, 256, 256);
            this.Icon     = PrimaryIcon;
            TrayIcon.Icon = PrimaryIcon;
            //MessageBox.Show("fucik");
#if DEBUG
            LogTxtFile = new StreamWriter(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "T7EBackgroundLog_" + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + ".txt"));
#endif
            //MessageBox.Show("fidld");
            CommonLog("Starting T7EBackground Primary Form", 1);

            // Initialize variables
            Common.WindowHandle_Primary = this.Handle;

            DisableShortcutChanging = false; // (Environment.OSVersion.Version.Major >= 10);
            DisableShortcutHooking  = false; // DisableShortcutChanging;

            // Sets handler for Ctrl+C on console
            Interop.SetConsoleCtrlHandler(new Interop.ConsoleCtrlDelegate(ConsoleCtrlCheck), true);

            // Initializes common AppPairsChangesList, for Window handling to refer from
            // since, because I use Interop.EnumWindows() to cycle through each open
            // window, I need to store the changesList commonly, so EnumWindows can refer to it.
            Window_AppPairsChangesList    = new Dictionary <string, string> [2];
            Window_AppPairsChangesList[0] = new Dictionary <string, string>(); // AppPairs[0] is an "added appIds" list
            Window_AppPairsChangesList[1] = new Dictionary <string, string>(); // AppPairs[1] is a "deleted appIds" list

            // Set up AppList and LNK watchers
            LnkWatcher     = new FileSystemWatcher();
            AppListWatcher = new FileSystemWatcher();

            // Read AppList.xml and do initial assigning of appids
            CommonLog("Reading AppList.xml, and assigning AppIds and Windows");
            ReadAppList();
            AssignAppIdsToShortcuts(); // Shortcuts _BEFORE_ windows
            AssignAppIdsToWindows();
            CommonLog("Done assigning AppIds and Windows");

            // Hook shortcuts, windows, and AppList.xml to detect further changes.
            CommonLog("Starting hooks");
            HookShortcut();
            HookWindows();
            HookAppList();
            CommonLog("Finished starting hooks");

            TrayIconPath = Common.WebPath_DonateSite;

            // Hook the update timer -- every 24 hours
            CommonLog("Starting update check sequence");
            CheckUpdateString();
            StartUpdateTimer();
            CommonLog("Finished update check sequence");

            DonateTimer.Start();

            CommonLog("Finished Primary Form start-up.", 0);
        }
예제 #2
0
 private void DonateTimer_Tick(object sender, EventArgs e)
 {
     DonateTimer.Stop();
     ShowDonateBalloon();
 }