public void StartClock()
 {
     if (IsGameLoaded)
     {
         ClockTimer.Start();
     }
 }
    static void Main(string[] args)
    {
        var t = new ClockTimer();

        t.Start();
        var date = t.TimerTimesInstance.Start;     // getter Ok

        t.TimerTimesInstance.Start = DateTime.Now; // Error! setter denied
    }
Пример #3
0
        public void Add()
        {
            m_Clocks.Add(this);

            if (m_Timer == null)
            {
                m_Timer = new ClockTimer();
                m_Timer.Start();
            }
        }
Пример #4
0
		public void Add()
		{
			m_Clocks.Add( this );

			if ( m_Timer == null )
			{
				m_Timer = new ClockTimer();
				m_Timer.Start();
			}
		}
Пример #5
0
        public Clock()
        {
            InitializeComponent();
            SetHours();
            SetMinutes();
            SetSeconds();

            Text = DateTime.Now.ToString();

            ClockTimer.Start();
        }
Пример #6
0
        public Form1()
        {
            InitializeComponent();
            DoubleBuffered = true;

            //Create the timer and start it
            ClockTimer.Tick    += ClockTimer_Tick;
            ClockTimer.Enabled  = true;
            ClockTimer.Interval = 1;
            ClockTimer.Start();
        }
Пример #7
0
        public ClockControl()
        {
            InitializeComponent();

            //Set the double buffered to true to reduce flickering of the graphics
            DoubleBuffered = true;

            //Create the timer and start it
            ClockTimer.Tick    += ClockTimer_Tick;
            ClockTimer.Enabled  = true;
            ClockTimer.Interval = 1;
            ClockTimer.Start();
        }
Пример #8
0
        private void ClockButton_Click(object sender, EventArgs e)
        {
            if (clockLabel.Text != "Off")
            {
                ClockTimer.Stop();
                clockLabel.Text = "Off";
                return;
            }

            ClockTimer.Interval = 1000;
            ClockTimer.Start();
            clockLabel.Text = "On";
        }
Пример #9
0
        private async void ClockTimer_Tick(object sender, EventArgs e)
        {
            DateTime now = DateTime.UtcNow;

            if (now.Hour != clockHour && now.Minute == 0)
            {
                ClockTimer.Stop();
                clockLabel.Text = "dingdong";
                clockHour       = now.Hour;
                await ClockRun();

                clockLabel.Text = "On";
                ClockTimer.Start();
            }
        }
Пример #10
0
 /// <summary>
 /// Starts the timer on form load
 /// </summary>
 private void ClockForm_Load(object sender, EventArgs e)
 {
     ClockTimer.Start();
 }
Пример #11
0
        /// <summary>
        ///  Required method for Designer support - do not modify
        ///  the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components    = new System.ComponentModel.Container();
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize    = new System.Drawing.Size(800, 800);
            this.Text          = "Tạo hoá đơn mới";
            this.WindowState   = System.Windows.Forms.FormWindowState.Maximized;

            this.CustomerNameLabel.Location = new System.Drawing.Point(10, 10);
            this.CustomerNameLabel.Size     = new System.Drawing.Size(100, 30);
            this.CustomerNameLabel.Text     = "Tên khách hàng:";
            this.CustomerNameLabel.Font     = LabelFont;
            this.Controls.Add(this.CustomerNameLabel);

            this.CustomerName.Location        = new System.Drawing.Point(120, 10);
            this.CustomerName.Size            = new System.Drawing.Size(200, 30);
            this.CustomerName.PlaceholderText = "Nhập tên khách hàng";
            this.CustomerName.TextChanged    += new System.EventHandler(this.CustomerNameTextChanged);
            this.Controls.Add(this.CustomerName);

            this.IsWorkerLabel.Location = new System.Drawing.Point(325, 10);
            this.IsWorkerLabel.Size     = new System.Drawing.Size(30, 30);
            this.IsWorkerLabel.Text     = "Thợ";
            this.IsWorkerLabel.Font     = LabelFont;
            this.Controls.Add(this.IsWorkerLabel);


            this.IsWorker.Location = new System.Drawing.Point(360, 10);
            this.IsWorker.Size     = new System.Drawing.Size(30, 30);
            this.IsWorker.Checked  = true;
            this.Controls.Add(this.IsWorker);

            this.CustomerInformationLabel.Location = new System.Drawing.Point(10, 45);
            this.CustomerInformationLabel.Size     = new System.Drawing.Size(100, 30);
            this.CustomerInformationLabel.Text     = "Thông tin:";
            this.CustomerInformationLabel.Font     = LabelFont;
            this.Controls.Add(this.CustomerInformationLabel);

            this.CustomerInformation.Location        = new System.Drawing.Point(120, 45);
            this.CustomerInformation.Size            = new System.Drawing.Size(200, 30);
            this.CustomerInformation.PlaceholderText = "Nhập thông tin khách hàng";
            this.Controls.Add(this.CustomerInformation);

            this.CustomerDebtLabel.Location = new System.Drawing.Point(850, 10);
            this.CustomerDebtLabel.Size     = new System.Drawing.Size(200, 30);
            this.CustomerDebtLabel.Text     = "Nợ khách hàng";
            this.CustomerDebtLabel.Font     = LabelFont;
            this.Controls.Add(this.CustomerDebtLabel);

            this.DebtDataView.Location           = new System.Drawing.Point(850, 45);
            this.DebtDataView.Size               = new System.Drawing.Size(400, 200);
            this.DebtDataView.AllowUserToAddRows = false;
            this.DebtDataView.RowHeadersVisible  = false;
            this.Controls.Add(this.DebtDataView);

            this.CustomerHistoryLabel.Location = new System.Drawing.Point(850, 250);
            this.CustomerHistoryLabel.Size     = new System.Drawing.Size(200, 30);
            this.CustomerHistoryLabel.Text     = "Lịch sử mua hàng";
            this.CustomerHistoryLabel.Font     = LabelFont;
            this.Controls.Add(this.CustomerHistoryLabel);

            this.CustomerHistoryView.Location           = new System.Drawing.Point(850, 285);
            this.CustomerHistoryView.Size               = new System.Drawing.Size(500, 200);
            this.CustomerHistoryView.AllowUserToAddRows = false;
            this.CustomerHistoryView.RowHeadersVisible  = false;
            this.CustomerHistoryView.CellContentClick  += new System.Windows.Forms.DataGridViewCellEventHandler(this.CustomerHistoryViewCellContentClick);
            this.Controls.Add(this.CustomerHistoryView);

            this.InvoicePreview.Location = new System.Drawing.Point(850, 490);
            this.InvoicePreview.Size     = new System.Drawing.Size(800, 400);
            this.Controls.Add(this.InvoicePreview);


            this.MHLabel.Location = new System.Drawing.Point(10, 80);
            this.MHLabel.Size     = new System.Drawing.Size(50, 30);
            this.MHLabel.Text     = "MH:";
            this.MHLabel.Font     = LabelFont;
            this.Controls.Add(this.MHLabel);

            this.MH.Location        = new System.Drawing.Point(65, 80);
            this.MH.Size            = new System.Drawing.Size(150, 30);
            this.MH.PlaceholderText = "Nhập tên mặt hàng";
            this.MH.TextChanged    += new System.EventHandler(this.MHTextChanged);
            this.Controls.Add(this.MH);

            this.QuantityLabels.Location = new System.Drawing.Point(220, 80);
            this.QuantityLabels.Size     = new System.Drawing.Size(30, 30);
            this.QuantityLabels.Text     = "SL:";
            this.QuantityLabels.Font     = LabelFont;
            this.Controls.Add(this.QuantityLabels);

            this.Quantity.Location        = new System.Drawing.Point(255, 80);
            this.Quantity.Size            = new System.Drawing.Size(50, 30);
            this.Quantity.PlaceholderText = "Nhập SL";
            this.Controls.Add(this.Quantity);

            this.UnitLabel.Location = new System.Drawing.Point(310, 80);
            this.UnitLabel.Size     = new System.Drawing.Size(40, 30);
            this.UnitLabel.Text     = "ĐVT:";
            this.UnitLabel.Font     = LabelFont;
            this.Controls.Add(this.UnitLabel);

            this.Unit.Location        = new System.Drawing.Point(355, 80);
            this.Unit.Size            = new System.Drawing.Size(60, 30);
            this.Unit.PlaceholderText = "Nhập ĐVT";
            this.Controls.Add(this.Unit);

            this.UnitPriceLabel.Location = new System.Drawing.Point(420, 80);
            this.UnitPriceLabel.Size     = new System.Drawing.Size(30, 30);
            this.UnitPriceLabel.Text     = "ĐG:";
            this.UnitPriceLabel.Font     = LabelFont;
            this.Controls.Add(this.UnitPriceLabel);

            this.UnitPrice.Location        = new System.Drawing.Point(455, 80);
            this.UnitPrice.Size            = new System.Drawing.Size(100, 30);
            this.UnitPrice.PlaceholderText = "Nhập ĐG";
            this.Controls.Add(this.UnitPrice);

            this.NoticeLabel.Location = new System.Drawing.Point(560, 80);
            this.NoticeLabel.Size     = new System.Drawing.Size(60, 30);
            this.NoticeLabel.Text     = "Ghi chú:";
            this.NoticeLabel.Font     = LabelFont;
            this.Controls.Add(this.NoticeLabel);

            this.Notice.Location        = new System.Drawing.Point(625, 80);
            this.Notice.Size            = new System.Drawing.Size(100, 30);
            this.Notice.PlaceholderText = "Nhập ghi chú";
            this.Controls.Add(this.Notice);

            this.AddButton.Location = new System.Drawing.Point(730, 80);
            this.AddButton.Size     = new System.Drawing.Size(50, 30);
            this.AddButton.Text     = "Thêm";
            this.AddButton.Click   += new System.EventHandler(this.AddButtonClick);
            this.Controls.Add(AddButton);

            this.InvoiceDataView.Location = new System.Drawing.Point(10, 115);
            this.InvoiceDataView.Size     = new System.Drawing.Size(800, 500);
            this.InvoiceDataView.Columns.Add("Index", "STT");
            this.InvoiceDataView.Columns.Add("IdWareHouse", "IdWareHouse");
            this.InvoiceDataView.Columns["IdWareHouse"].Visible = false;
            this.InvoiceDataView.Columns.Add("GoodsCode", "Tên MH");
            this.InvoiceDataView.Columns.Add("Quantity", "Số lượng");
            this.InvoiceDataView.Columns.Add("Unit", "ĐVT");
            this.InvoiceDataView.Columns.Add("UnitPrice", "Đơn giá");
            this.InvoiceDataView.Columns.Add("Notice", "Ghi chú");
            this.InvoiceDataView.Columns.Add("TotalPrice", "Thành tiền");
            this.InvoiceDataView.AllowUserToAddRows = false;
            this.InvoiceDataView.RowHeadersVisible  = false;
            this.InvoiceDataView.CellContentClick  += new System.Windows.Forms.DataGridViewCellEventHandler(this.InvoiceDataViewDeleteButton);
            this.InvoiceDataView.CellValueChanged  += new System.Windows.Forms.DataGridViewCellEventHandler(this.InvoiceDataViewCellValueChanged);
            this.Controls.Add(this.InvoiceDataView);

            this.DepositLabel.Location = new System.Drawing.Point(10, 620);
            this.DepositLabel.Size     = new System.Drawing.Size(100, 30);
            this.DepositLabel.Text     = "Trả trước:";
            this.DepositLabel.Font     = LabelFont;
            this.Controls.Add(this.DepositLabel);

            this.Deposit.Location = new System.Drawing.Point(115, 620);
            this.Deposit.Size     = new System.Drawing.Size(100, 30);
            this.Deposit.Text     = "0";
            this.Controls.Add(this.Deposit);

            this.TotalCostInvoiceLabel.Location = new System.Drawing.Point(10, 655);
            this.TotalCostInvoiceLabel.Size     = new System.Drawing.Size(100, 30);
            this.TotalCostInvoiceLabel.Text     = "Tổng cộng đơn hàng:";
            this.TotalCostInvoiceLabel.Font     = LabelFont;
            this.Controls.Add(this.TotalCostInvoiceLabel);

            this.TotalCostInvoice.Location = new System.Drawing.Point(115, 655);
            this.TotalCostInvoice.Text     = "0";
            this.Controls.Add(this.TotalCostInvoice);

            this.TotalCostPlusDebtLabel.Location = new System.Drawing.Point(10, 690);
            this.TotalCostPlusDebtLabel.Size     = new System.Drawing.Size(100, 30);
            this.TotalCostPlusDebtLabel.Text     = "Tổng cộng đơn hàng + nợ:";
            this.TotalCostPlusDebtLabel.Font     = LabelFont;
            this.Controls.Add(this.TotalCostPlusDebtLabel);

            this.TotalCostPlusDebt.Location = new System.Drawing.Point(115, 690);
            this.TotalCostPlusDebt.Text     = "0";
            this.Controls.Add(this.TotalCostPlusDebt);

            this.SaveButton.Location = new System.Drawing.Point(300, 655);
            this.SaveButton.Size     = new System.Drawing.Size(100, 30);
            this.SaveButton.Text     = "Lưu và in";
            this.SaveButton.Click   += new System.EventHandler(this.SaveButtonClick);
            this.Controls.Add(this.SaveButton);

            this.ClockLabel.Location = new System.Drawing.Point(500, 10);
            this.ClockLabel.Size     = new System.Drawing.Size(200, 60);
            this.ClockLabel.Text     = System.DateTime.Now.ToString("HH:mm:ss");
            this.ClockLabel.Font     = ClockFont;
            this.Controls.Add(this.ClockLabel);



            ClockTimer.Interval = 1000;
            ClockTimer.Tick    += new System.EventHandler(this.ResetClock);
            ClockTimer.Start();
        }
Пример #12
0
 /// <summary>
 /// Loads the main GUI form
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void Form1_Load(object sender, EventArgs e)
 {
     ClockTimer.Start();
     DateLabel.Text = DateTime.Now.ToLongDateString();
     TimeLabel.Text = DateTime.Now.ToLongTimeString();
 }
Пример #13
0
 private void StartButton_Click(object sender, EventArgs e)
 {
     ClockTimer.Start();
     StartButton.Text = "Start";
 }
Пример #14
0
 public Taskbar()
 {
     InitializeComponent();
     Width             = SystemParameters.PrimaryScreenWidth;
     Top               = SystemParameters.PrimaryScreenHeight - Height;
     Left              = 0;
     IsVisibleChanged += Taskbar_IsVisibleChanged;
     //Visibility = Visibility.Hidden;
     InitialPopulateTaskbar();
     ClockTimer.Elapsed += delegate
     {
         Dispatcher.Invoke(new Action(() =>
         {
             ClockTime.Content = DateTime.Now.ToShortTimeString();
             ClockDate.Content = DateTime.Now.ToShortDateString();
         }));
     };
     ClockTimer.Start();
     ProgramWindow.WindowOpened += InsertCreatedWindow;
     ProgramWindow.WindowClosed += RemoveClosedWindow;
     _activeWindowTimer.Elapsed += delegate
     {
         Dispatcher.Invoke(new Action(() =>
         {
             var active = MiscTools.GetForegroundWindow();
             foreach (TaskbarGroupStackPanel t in Taskband.Children)
             {
                 try
                 {
                     if (t.ForceCombine | (Config.GroupingMode == TaskbarGroupingMode.Combine))
                     {
                         var isAnythingActive = false;
                         foreach (var b in t.ProgramWindowsList)
                         {
                             if (b.Hwnd == active)
                             {
                                 isAnythingActive = true;
                             }
                         }
                         if (isAnythingActive)
                         {
                             t.RunningBackgroundButton.IsActiveWindow = true;
                         }
                         else
                         {
                             t.RunningBackgroundButton.IsActiveWindow = false;
                         }
                     }
                     else
                     {
                         foreach (TaskItemButton b in t.Buttons.Children)
                         {
                             if ((b.Tag as ProgramWindow).Hwnd == active)
                             {
                                 b.IsActiveWindow = true;
                             }
                             else
                             {
                                 b.IsActiveWindow = false;
                             }
                         }
                     }
                 }
                 catch (Exception ex)
                 {
                     Debug.WriteLine(ex);
                 }
             }
         }));
     };
     _activeWindowTimer.Start();
     Debug.WriteLine(MainTools.GetFixedModule("Test Module").ModuleName + " FOUND!");
 }
Пример #15
0
 private void FrmMain_Load(object sender, EventArgs e)
 {
     ClockTimer.Start();
     mainMenuStrip.BackColor = Color.FromArgb(64, 64, 64);
     mainMenuStrip.ForeColor = Color.White;
 }