コード例 #1
0
        public static TimerForm Instance(Mainform frmMain)
        {
            if (sForm == null)
            {
                sForm = new TimerForm(frmMain);
            }

            else
            {
                sForm.Close();
                sForm = new TimerForm(frmMain);
            }

            return(sForm);
        }
コード例 #2
0
        public override void EndScene()
        {
            try
            {
                if (form.Settings.RecentSplits.Any())
                {
                    config.SetString("splitspath", form.Settings.RecentSplits.Last().Path);
                }
                if (form.Settings.RecentLayouts.Any())
                {
                    config.SetString("layoutpath", form.Settings.RecentLayouts.Last());
                }

                var    sem             = new Semaphore(0, 1);
                Action formCloseAction = () =>
                {
                    form.TopMost = false;

                    while (form.Visible)
                    {
                        form.Close();
                    }
                    sem.Release();
                };

                if (form.InvokeRequired)
                {
                    form.Invoke(formCloseAction);
                }
                else
                {
                    formCloseAction();
                }

                sem.WaitOne();
            }
            catch (Exception ex)
            {
                Log.Error(ex);

                API.Instance.Log(ex.Message);
                API.Instance.Log(ex.StackTrace);
            }
        }