Exemplo n.º 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var builder = new ContainerBuilder();

            builder.RegisterType <NaudioPlayer>().As <IAudioPlayer>();
            builder.RegisterType <TulpepPopupEngine>().As <IPopupEngine>();
            builder.RegisterType <LocalPathAlertScanner>().As <IAlertScanner>();

            var container = builder.Build();
            var scanner   = container.Resolve <IAlertScanner>();

            try
            {
                if (!scanner.StartScan())
                {
                    MessageBox.Show(scanner.LastError, "Cannot Start Program", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Fatal Error Starting Program", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            using (ProcessIcon pi = new ProcessIcon())
            {
                pi.Display();
                Application.Run();
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);

            using (ProcessIcon processIcon = new ProcessIcon())
            {
                processIcon.Display();
                UI ui = new UI();
                Application.Run();
            }
        }
Exemplo n.º 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var statusChangerService = StatusServiceFactory.Get();

            using (var pi = new ProcessIcon(statusChangerService))
            {
                pi.Display();
                Application.Run();
            }
        }
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Show the system tray icon.
            using (ProcessIcon pi = new ProcessIcon())
            {
                pi.Display();

                // Make sure the application runs!
                Application.Run();
            }
        }
Exemplo n.º 5
0
        static void Main()
        {
            bool createdNew = true;

            using (Mutex mutex = new Mutex(true, "Hostplus", out createdNew))
            {
                if (createdNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    WindowsPrincipal principal          = new WindowsPrincipal(WindowsIdentity.GetCurrent());
                    bool             administrativeMode = principal.IsInRole(WindowsBuiltInRole.Administrator);

                    if (!administrativeMode)
                    {
                        ProcessStartInfo startInfo = new ProcessStartInfo();
                        startInfo.Verb     = "runas";
                        startInfo.FileName = Application.ExecutablePath;
                        try
                        {
                            Process.Start(startInfo);
                        }
                        catch
                        {
                            return;
                        }
                        return;
                    }
                    ProcessIcon processIcon = new ProcessIcon();
                    processIcon.Display();

                    Application.Run();
                }
                else
                {
                    Process current = Process.GetCurrentProcess();
                    foreach (Process process in Process.GetProcessesByName(current.ProcessName))
                    {
                        if (process.Id != current.Id)
                        {
                            SetForegroundWindow(process.MainWindowHandle);
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 6
0
        static void Main()
        {
            ContextMenus a = new ContextMenus();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            using (ProcessIcon pi = new ProcessIcon())
            {
                if (a.actvate)
                {
                    pi.Display();
                }
                // Make sure the application runs!
                Application.Run();
            }
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            var container = TinyIoCContainer.Current;
            IoC.ConfigureContainer(container);

            var skypeClient = container.Resolve<ISkypeClient>();
            container.BuildUp(skypeClient);

            skypeClient.StartClient();

            using (var icon = new ProcessIcon(skypeClient))
            {
                icon.Display();

                Application.Run();
            }
        }
Exemplo n.º 8
0
        static void Main()
        {
            settings = new Settings();
            settings.Load();
            isp = new AbloadService(settings.Cookies);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (ProcessIcon pi = new ProcessIcon(settings, isp))
            {
                kcm      = new KeyControlManager();
                selector = new Windows10RegionSelector(kcm.GlobalHook);
                ic       = new NQuantImageCreator();

                kcm.RegionShotStart = selector.Start;
                kcm.AbortRegionShot = selector.Abort;

                selector.RegionFinished += new EventHandler <RegionSelector.Region>(
                    (sender, region) =>
                {
                    Stream image = ic.CreateFromScreenRegion(region);
                    isp.Upload(image);
                }
                    );

                isp.UploadFinished += new EventHandler <UploadResult>(
                    (sender, result) =>
                {
                    Clipboard.SetText(result.ImageUrl);
                    pi.NotifyUser(Enum.GetName(typeof(UploadResult.UploadStatus), result.Status), result.ImageUrl, result.ImageUrl);
                }
                    );

                Application.Run();
            }
        }
Exemplo n.º 9
0
        //private IEnumerable<Module> _modules;

        #endregion

        #region Instance Creation

        public ProcessToBeHookedOnStart(string aPath, ISpyManager aSpyManager, int platformBits)
            : base(aSpyManager, platformBits, System.IO.Path.GetFileName(aPath), aPath, ProcessIcon.IconFrom(aPath))
        {
        }
Exemplo n.º 10
0
        static void Main()
        {
            bool isAlreadyRunning = System.Diagnostics.Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetEntryAssembly().Location)).Length > 1;

            if (isAlreadyRunning)
            {
                return;
            }

#if !DEBUG
            try
#endif
            {
                settings = new Config();
                settings.Load();
                isp = new AbloadService(settings.Cookies);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                using (ProcessIcon pi = new ProcessIcon(settings, isp))
                {
                    kcm      = new KeyControlManager();
                    selector = new Windows10RegionSelector(kcm.GlobalHook);
                    ic       = new NQuantImageCreator();

                    // Tie display shot to key action
                    kcm.DisplayShot = new Action(() =>
                    {
                        Region region = selector.GetAllScreenRegion();
                        Stream image  = ic.CreateFromScreenRegion(region);
                        SaveAndUpload(image);
                    });

                    // Tie single display shot to key action
                    kcm.SingleDisplayShot = new Action(() =>
                    {
                        Region region = selector.GetCurrentScreenRegion();
                        Stream image  = ic.CreateFromScreenRegion(region);
                        SaveAndUpload(image);
                    });

                    // Tie window shot to key action
                    kcm.WindowShot = new Action(() =>
                    {
                        Region region = selector.GetCurrentWindowRegion();
                        Stream image  = ic.CreateFromScreenRegion(region);
                        SaveAndUpload(image);
                    });

                    // Tie region selector to key events
                    kcm.RegionShotStart = selector.Start;
                    kcm.AbortRegionShot = selector.Abort;

                    selector.RegionFinished += new EventHandler <Region>(
                        (sender, region) =>
                    {
                        Stream image = ic.CreateFromScreenRegion(region);
                        SaveAndUpload(image);
                    }
                        );

                    isp.UploadFinished += new EventHandler <UploadResult>(
                        (sender, result) =>
                    {
                        if (result.Status == UploadResult.UploadStatus.Succeeded)
                        {
                            Clipboard.SetText(result.ImageUrl);
                            pi.NotifyUserSuccess(
                                Enum.GetName(typeof(UploadResult.UploadStatus), result.Status),
                                result.ImageUrl,
                                (string)result.Reason
                                );
                        }
                        else
                        {
                            var ex = result.Reason as Exception;
                            pi.NotifyUserFail(
                                Enum.GetName(typeof(UploadResult.UploadStatus), result.Status),
                                ex.Message,
                                ex.InnerException.Message
                                );
                        }
                    }
                        );

                    Application.Run();
                }
            }
#if !DEBUG
            catch (Exception ex)
            {
                MessageBox.Show(null, ex.Message + "\r\n\r\nIf this is helpful for you, here is the stack trace:\r\n\r\n" + ex.GetType().ToString() + ex.StackTrace, ex.GetType().ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
#endif
        }