Example #1
0
        private void GotoTimeline(UserLoginSetting userlogin)
        {
            if (clientProcess != null && !clientProcess.HasExited)
            {
                Debug.Assert(userlogin != null, "param userlogin cannot be empty when timeline opened");

                if (userlogin.Email == userloginContainer.GetLastUserLogin().Email)
                {
                    IntPtr handle = Win32Helper.FindWindow(null, CLIENT_TITLE);
                    Win32Helper.SetForegroundWindow(handle);
                    Win32Helper.ShowWindow(handle, 1);
                    return;
                }
                else
                {
                    uictrlWavefaceClient.Terminate();
                }
            }

            if (userlogin != null && userlogin.RememberPassword)
            {
                LaunchWavefaceClient(userlogin);
                Close();
                return;
            }

            GotoTabPage(tabSignIn, userlogin);
        }
Example #2
0
        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();

            bool isFirstCreated;

            //Create a new mutex using specific mutex name
            Mutex m = new Mutex(false, "StationSystemTray", out isFirstCreated);

            if (!isFirstCreated)
            {
                var currentProcess = Process.GetCurrentProcess();
                var processes      = Process.GetProcessesByName(Assembly.GetExecutingAssembly().GetName().Name);

                foreach (var process in processes)
                {
                    if (process.Id == currentProcess.Id)
                    {
                        continue;
                    }

                    IntPtr handle = Win32Helper.FindWindow(null, CLIENT_TITLE);
                    if (handle == IntPtr.Zero)
                    {
                        handle = Win32Helper.FindWindow(null, "Log In - Waveface");
                    }

                    if (handle == IntPtr.Zero)
                    {
                        return;
                    }

                    Win32Helper.SetForegroundWindow(handle);
                    Win32Helper.ShowWindow(handle, 1);
                    return;
                }
                return;
            }

            ApplyInstalledCulture();

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

            bool initMinimized = (args != null && args.Length > 0 && args[0] == "--minimized");

            Application.Run(new MainForm(initMinimized));
        }