Exemple #1
0
 private void CancelPendingClose()
 {
     if (_closeTimer.IsValueCreated)
     {
         CloseTimer.Stop();
     }
 }
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Form.Closed" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> that contains the event data.</param>
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            CloseTimer.Stop();
            MoveTimer.Stop();
        }
Exemple #3
0
        public void OpenClose()
        {
            if (ItemID == m_ClosedID)
            {
                ItemID = m_OpenedID;
                X     += m_ChangeBy.X;
                Y     += m_ChangeBy.Y;
                Z     += m_ChangeBy.Z;

                if (Timer != null)
                {
                    Timer.Stop();
                }

                Timer = new CloseTimer(this);
                Timer.Start();
            }
            else
            {
                ItemID = m_ClosedID;
                X     -= m_ChangeBy.X;
                Y     -= m_ChangeBy.Y;
                Z     -= m_ChangeBy.Z;

                if (Timer != null)
                {
                    Timer.Stop();
                }
            }
        }
Exemple #4
0
        private void HandleClose(bool hideOnly)
        {
            TimeSpan elapsed = DateTime.Now - _lastShowTime;

            if (elapsed >= DelayInterval)
            {
                // if the dialog has been shown for more than 500ms, just close it
                if (_currentWindow != null && _currentWindow.IsVisible)
                {
                    if (hideOnly)
                    {
                        _currentWindow.Hide();
                    }
                    else
                    {
                        _currentWindow.ForceClose();
                    }
                }
            }
            else
            {
                CloseTimer.Tag = hideOnly;
                // otherwise, set a timer so that we close it after it has been shown for 500ms
                CloseTimer.Interval = DelayInterval - elapsed;
                CloseTimer.Start();
            }
        }
 protected override void OnParentChanged()
 {
     base.OnParentChanged();
     if (Parent != null && CloseTimer != null)
     {
         CloseTimer.Start();
     }
 }
Exemple #6
0
 private void OnHover(object sender, EventArgs e)
 {
     if (!CloseTimer.Enabled)
     {
         CloseTimer.Start();
     }
     sec     = 0;
     Opacity = 1;
 }
Exemple #7
0
 // בודק האם החלון לא בשימוש ומפעיל את הטיימר במידה ונעצר
 private void MainForm_Deactivate(object sender, EventArgs e)
 {
     RefreshTimer.Start();
     CloseTimer.Start();
     panel1.BackColor      = Color.FromArgb(50, 50, 55);
     MinBt.BackColor       = Color.FromArgb(50, 50, 55);
     MinToTrayBt.BackColor = Color.FromArgb(50, 50, 55);
     CloseBt.BackColor     = Color.FromArgb(50, 50, 55);
 }
Exemple #8
0
 // בודק האם החלון בשימוש ועוצר את הטיימר במידה והופעל
 private void MainForm_Activated(object sender, EventArgs e)
 {
     RefreshTimer.Stop();
     CloseTimer.Stop();
     panel1.BackColor      = Color.FromArgb(40, 40, 45);
     MinBt.BackColor       = Color.FromArgb(40, 40, 45);
     MinToTrayBt.BackColor = Color.FromArgb(40, 40, 45);
     CloseBt.BackColor     = Color.FromArgb(40, 40, 45);
 }
Exemple #9
0
        // סוגר את החלון ומפעיל חלון כניסה ממוזער כאשר החלון ללא שימוש זמן מסויים
        private void CloseTimer_Tick(object sender, EventArgs e)
        {
            CloseTimer.Stop();
            LoginForm login;

            login = new LoginForm();
            Hide();
            login.Closed += (s, args) => Close();
            login.Show();
            login.WindowState = FormWindowState.Minimized;
        }
Exemple #10
0
        private void StartForm_Load(object sender, EventArgs e)
        {
            try
            {
                SoundPlayer player = new SoundPlayer("..//..//..//source//sound.wav");
                player.Play();
            }
            catch
            {
            };

            CloseTimer.Start();
        }
        /// <summary>
        /// Called when the splash screen is loaded.
        /// </summary>
        /// <param name="sender">Form</param>
        /// <param name="e">Event arguments</param>
        private void SplashScreenForm_Load(object sender, EventArgs e)
        {
            if (File.Exists(SPLASHSCREEN_IMAGE))
            {
                PanelSplashImage.BackgroundImage = Image.FromFile(SPLASHSCREEN_IMAGE);
            }

            LabelVersion.Text = $"Version {BriefingRoom.BRIEFINGROOM_VERSION}\r\nfor DCS World {BriefingRoom.TARGETED_DCS_WORLD_VERSION}";
#if DEBUG
            LabelVersion.Text = $"DEBUG BUILD\r\n" + LabelVersion.Text;
#endif

            CloseTimer.Start();
            LoadTimer.Start();
        }
 /// <summary>
 /// Handles the Tick event of the MoveTimer control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void MoveTimer_Tick(object sender, EventArgs e)
 {
     OpacityValue += OpacityStep;
     if (Location.Y > Screen.PrimaryScreen.WorkingArea.Height - Height)
     {
         Location = new Point(Location.X, Location.Y - 2);
     }
     else
     {
         if (OpacityValue == 1.0)
         {
             MoveTimer.Stop();
             CloseTimer.Start();
         }
     }
 }
Exemple #13
0
        private void UpdateNotfication_Shown(object sender, EventArgs e)
        {
            Screen Screen = Screen.FromControl(this);

            if ((Screen.AllScreens.Length > 1 && Screen.FromControl(this).Primary))
            {
                //Show rotated version
                NotificationNormal.Visible   = false;
                NoticficationRotated.Visible = true;
            }
            else
            {
                //Show normal version
                NotificationNormal.Visible   = true;
                NoticficationRotated.Visible = false;
            }

            this.BringToFront();
            CloseTimer.Start();
            TopTimer.Start();
        }
Exemple #14
0
 public LoadLevelForm(string levelname, string scenario)
 {
     InitializeComponent();
     CenterToParent();
     Localize();
     LevelName = levelname;
     DoClose   = false;
     LevelTimer.Start();
     TalkTimer.Start();
     CloseTimer.Start();
     rand     = new Random((int)StringToHash(LevelName));
     Scenario = scenario;
     if (Scenario.Equals("LoadLevel"))
     {
         Text = LoadingLevelText;
     }
     else if (Scenario.Equals("GenDatabase"))
     {
         Text = DatabaseGeneratingText;
     }
 }
Exemple #15
0
        private void DialogNotifier_Load(object sender, EventArgs e)
        {
            Rectangle screen = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea;

            switch (DialogData.Alignment)
            {
            case NotifierDialogAlignment.TopLeft:
                Location = new Point(screen.X, screen.Y);
                break;

            case NotifierDialogAlignment.TopCenter:
                Location = new Point(screen.X + (screen.Width - Width) / 2, screen.Y);
                break;

            case NotifierDialogAlignment.TopRight:
                Location = new Point(screen.Right - Width, screen.Y);
                break;

            case NotifierDialogAlignment.MiddleLeft:
                Location = new Point(screen.X, screen.Y + (screen.Height - Height) / 2);
                break;

            case NotifierDialogAlignment.MiddleCenter:
                Location = new Point(screen.X + (screen.Width - Width) / 2, screen.Y + (screen.Height - Height) / 2);
                break;

            case NotifierDialogAlignment.MiddleRight:
                Location = new Point(screen.Right - Width, screen.Y + (screen.Height - Height) / 2);
                break;

            case NotifierDialogAlignment.BottomLeft:
                Location = new Point(screen.X, screen.Bottom - Height);
                break;

            case NotifierDialogAlignment.BottomCenter:
                Location = new Point(screen.X + (screen.Width - Width) / 2, screen.Bottom - Height);
                break;

            case NotifierDialogAlignment.BottomRight:
                Location = new Point(screen.Right - Width, screen.Bottom - Height);
                break;

            case NotifierDialogAlignment.Custom:
            case NotifierDialogAlignment.CustomRelative:
                Location = new Point(DialogData.Location.X, DialogData.Location.Y);
                break;
            }

            if (IsLayeredWindow)
            {
                Size size = DialogData.Image?.Size ?? new Size(300, 100);

                // メッセージを書き込んだうえでレイヤードウィンドウ化する
                using (var bmp = new Bitmap(size.Width, size.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
                {
                    using (var g = Graphics.FromImage(bmp))
                    {
                        g.Clear(Color.FromArgb(0, 0, 0, 0));
                        g.SmoothingMode   = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                        g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

                        if (DialogData.Image != null)
                        {
                            g.DrawImage(DialogData.Image, new Rectangle(0, 0, bmp.Width, bmp.Height));
                        }
                        else
                        {
                            g.Clear(DialogData.BackColor);
                        }
                        //DrawMessage( g );

                        //*/
                        if (DialogData.DrawsMessage)
                        {
                            // fixme: どうしても滑らかにフォントが描画できなかったので超絶苦肉の策

                            using (var path = new GraphicsPath())
                            {
                                path.AddString(DialogData.Message, Font.FontFamily, (int)Font.Style, Font.Size, new RectangleF(Padding.Left, Padding.Top, ClientSize.Width - Padding.Horizontal, ClientSize.Height - Padding.Vertical), StringFormat.GenericDefault);

                                using (var brush = new SolidBrush(ForeColor))
                                {
                                    g.FillPath(brush, path);
                                }
                            }
                        }
                        //*/
                    }

                    SetLayeredWindow(bmp);
                }
            }

            if (DialogData.ClosingInterval > 0)
            {
                CloseTimer.Interval = DialogData.ClosingInterval;
                CloseTimer.Start();
            }
        }
        private void DialogNotifier_Load(object sender, EventArgs e)
        {
            if (DialogData.DrawsImage && DialogData.Image != null)
            {
                ClientSize = DialogData.Image.Size;
            }

            if (!DialogData.HasFormBorder)
            {
                FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            }

            //TopMost = DialogData.TopMost;


            Rectangle screen = System.Windows.Forms.Screen.PrimaryScreen.Bounds;

            switch (DialogData.Alignment)
            {
            case NotifierDialogAlignment.TopLeft:
                Location = new Point(screen.X, screen.Y);
                break;

            case NotifierDialogAlignment.TopCenter:
                Location = new Point(screen.X + (screen.Width - Width) / 2, screen.Y);
                break;

            case NotifierDialogAlignment.TopRight:
                Location = new Point(screen.Right - Width, screen.Y);
                break;

            case NotifierDialogAlignment.MiddleLeft:
                Location = new Point(screen.X, screen.Y + (screen.Height - Height) / 2);
                break;

            case NotifierDialogAlignment.MiddleCenter:
                Location = new Point(screen.X + (screen.Width - Width) / 2, screen.Y + (screen.Height - Height) / 2);
                break;

            case NotifierDialogAlignment.MiddleRight:
                Location = new Point(screen.Right - Width, screen.Y + (screen.Height - Height) / 2);
                break;

            case NotifierDialogAlignment.BottomLeft:
                Location = new Point(screen.X, screen.Bottom - Height);
                break;

            case NotifierDialogAlignment.BottomCenter:
                Location = new Point(screen.X + (screen.Width - Width) / 2, screen.Bottom - Height);
                break;

            case NotifierDialogAlignment.BottomRight:
                Location = new Point(screen.Right - Width, screen.Bottom - Height);
                break;

            case NotifierDialogAlignment.Custom:
                Location = new Point(DialogData.Location.X, DialogData.Location.Y);
                break;
            }

            if (DialogData.ClosingInterval > 0)
            {
                CloseTimer.Interval = DialogData.ClosingInterval;
                CloseTimer.Start();
            }
        }
Exemple #17
0
 public void Close()
 {
     CloseTimer.Dispose();
 }
 public void SetLocation(int PassedInterval, int PointX = 0, int PointY = 0)
 {
     this.Location       = new Point(Module_CursorLock.WarframeAreaRectangle.X + PointX, Module_CursorLock.WarframeAreaRectangle.Y + 264 + PointY);
     CloseTimer.Interval = PassedInterval;
     CloseTimer.Start();
 }
Exemple #19
0
 private void ResetTimer(object sender, EventArgs e)
 {
     CloseTimer.Start();
 }
Exemple #20
0
 public void OnClosed()
 {
     CloseTimer.Stop();
     AutoCloseWatch.Stop();
 }
		public void OpenClose()
		{
			if ( ItemID == m_ClosedID )
			{
				ItemID = m_OpenedID;
				X += m_ChangeBy.X;
				Y += m_ChangeBy.Y;
				Z += m_ChangeBy.Z;

				if ( Timer != null )
					Timer.Stop();

				Timer = new CloseTimer( this );
				Timer.Start();
			}
			else
			{
				ItemID = m_ClosedID;
				X -= m_ChangeBy.X;
				Y -= m_ChangeBy.Y;
				Z -= m_ChangeBy.Z;

				if ( Timer != null )
					Timer.Stop();
			}
		}