Esempio 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();
            }
        }
Esempio 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();
            }
        }
Esempio 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();
            }
        }
Esempio 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;
                        }
                    }
                }
            }
        }
Esempio 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();
            }
        }
Esempio 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();
            }
        }