Exemple #1
0
        public formMain(ModuleHandler _module, UtilityHandler _utility, KeyboardHook _hook)
        {
            utility = _utility;
            module  = _module;
            hook    = _hook;

            utility.IsDevUser = (Path.GetFileName(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)) == "Debug") ? true : false;

            SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch);
            AppDomain.CurrentDomain.FirstChanceException += new EventHandler <FirstChanceExceptionEventArgs>(FirstChance_Handler);
            hook.KeyPressed += new EventHandler <KeyPressedEventArgs>(hook_KeyPressed);

            InitializeComponent();
            startupTimer.Start();
            utility.LogEvent("Program probably started OK");

            // Create NotifyIcon to sit in system tray
            icon.Text             = "Jovo" + ((utility.IsDevUser) ? " Development Enviroment" : "");
            icon.Icon             = (utility.IsDevUser) ? Properties.Resources.Jovo_Logo_TestEnv : Properties.Resources.Jovo_Logo;
            icon.Visible          = true;
            icon.ContextMenuStrip = menu;
            icon.MouseDown       += icon_Click;

            UpdateWorker.WorkerReportsProgress = true;
            UpdateWorker.DoWork             += UpdateWorker_DoWork;
            UpdateWorker.RunWorkerCompleted += UpdateWorker_RunWorkerCompleted;
            UpdateWorker.ProgressChanged    += UpdateWorker_ProgressChanged;
            utility.LogEvent("Module Updater starting...");
            UpdateWorker.RunWorkerAsync(true);

            JovoUpdateWorker.DoWork             += JovoUpdateWorker_DoWork;
            JovoUpdateWorker.RunWorkerCompleted += JovoUpdateWorker_RunWorkerCompleted;
            utility.LogEvent("Jovo Updater Starting...");
            JovoUpdateWorker.RunWorkerAsync();

            ConnectionWorker.WorkerReportsProgress = true;
            ConnectionWorker.DoWork             += ConnectionWorker_DoWork;
            ConnectionWorker.RunWorkerCompleted += ConnectionWorker_RunWorkerCompleted;
        }
Exemple #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>

        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ModuleHandler  module  = new ModuleHandler();
            UtilityHandler utility = new UtilityHandler();
            KeyboardHook   hook    = new KeyboardHook();

            utility.ArchiveLog();

            utility.LogEvent("############################ Program starting... ############################", true, true);
            module.GetSetDirectoryStructure(System.Reflection.Assembly.GetEntryAssembly().Location);

            utility.LogEvent("Startup Args received : " + args.Length);

            //foreach (string arg in args)
            //{
            //    utility.LogEvent("Start Argument : " + arg);
            //}

            if (args.Length >= 2)
            {
                //Module_Update_Remote_Path
                string[] temp = args[1].Split('\\');
                temp[temp.Length - 1] = "modules";
                string module_path = String.Join("\\", temp);


                Jovo.Default.Jovo_Updater_Local_Path   = args[0].Trim('"');
                Jovo.Default.Jovo_Update_Remote_Path   = args[1].Trim('"');
                Jovo.Default.Module_Update_Remote_Path = module_path;
                Jovo.Default.Save();
            }

            Application.Run(new formMain(module, utility, hook));
        }