Start() public method

public Start ( ) : void
return void
Esempio n. 1
0
        public TimerLogic()
        {
            m_timer = new Timer();
            m_timer.Interval = m_tick;

            m_timer.Tick += delegate
            {
                m_log.Debug("Tick event happened");
                m_timer.Stop();
                // Commented until find bugs
            //				if(MousePositionHelper.MouseNotMoving == false)
            //				{
                    List<Task> tasksToShow = new DbHelper().LoadTasksForShowing();
                    m_log.DebugFormat("Loaded {0} tasks for showing", tasksToShow.Count);
                    foreach (Task task in tasksToShow)
                    {
                        new TaskShowController(task).PrepareWindow(); //Įkėliau viską į preparerį.
                        m_log.DebugFormat("Showed task with id {0}, name {1}, showTime {2}",
                                          task.Id, task.Text, DBTypesConverter.ToFullDateStringByCultureInfo(task.DateRemainder));
                    }
            //				}

                SetNewTimerInterval();
                m_timer.Start();
            };

            m_timer.Start();
        }
 public void CanTimerBeRestarted() {
     //Arrange
     var timer = new Timer();
     timer.Interval = 1000*3;
     //Act
     timer.Start();
     timer.Start();
     //Assert
     Assert.IsNotNull(timer);
 }
Esempio n. 3
0
        private void Home2_Load(object sender, EventArgs e)
        {
            Timer tmr = new Timer();
            tmr.Interval = 1000;//ticks every 1 second
            tmr.Tick += new EventHandler(timer1_Tick);
            tmr.Start();

               tmr.Start();
            //   pictureBox1.Image = Image.FromFile("images/" + pictures[0]);
        }
Esempio n. 4
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            Description fileHeader = new Description(txtProgramName.Text,txtProgramName.Text,txtAuthorName.Text,txtDescription.Text);
            fileHeader.GenerateOutput( this.getFillerCharacter() );

            Clipboard.SetText( fileHeader.Output );

            lblStatus.ForeColor = SystemColors.ControlText;

            Output popup = new Output();
            popup.Show();
            popup.txtOutput.Text = fileHeader.Output;

            Timer fadeTimer = new Timer();
            int i = 0;

            fadeTimer.Interval = 1500;
            fadeTimer.Tick += (sa, aeaa) =>
            {
                fadeTimer.Interval = 10;
                i++;

                lblStatus.ForeColor = Program.Lerp(SystemColors.ControlText, SystemColors.Control, (float)i / 100.0f);

                lblStatus.Invalidate();

                if (i == 100 )
                {
                    fadeTimer.Stop();
                }
            };

            fadeTimer.Start();
        }
Esempio n. 5
0
        private void Billingform_Load(object sender, EventArgs e)
        {
            this.KeyPreview = true;
            this.textBox2.KeyDown += new KeyEventHandler(textBox2_KeyDown);
            this.textBox3.KeyDown += new KeyEventHandler(textBox3_KeyDown);
            this.txtBoxDescription.KeyDown += new KeyEventHandler(txtBoxDescription_KeyDown);
            this.txtBoxCode.KeyDown += new KeyEventHandler(txtBoxCode_KeyDown);
            this.dataGridView1.KeyDown += new KeyEventHandler(dataGridView1_KeyDown);



            this.ActiveControl = txtBoxCode;
            //this.ActiveControl = txtBoxDescription; //focus on Description textbox
            BillGeneration bf = new BillGeneration();
            textBox1.Text = bf.BillNoGen(this).ToString(); //call to BillNoGen function


            timer1 = new Timer();
            timer1.Interval = 1000;
            timer1.Tick += new EventHandler(timer1_Tick);
            timer1.Start(); //initialize timer


            label16.Text = user_name;





        }
Esempio n. 6
0
        private void btn_BLKWHTAUTO_Click(object sender, EventArgs e)
        {
            //:Let them know this is a larger operation.
              this.Text = "Please be patient, this is a larger comparison.";

              //:We do NOT want them clicking while the thread is running.
              ButtonsEnabled(false);
              btn_Refresh.Enabled    = false;
              btn_newIMG.Enabled     = false;
              btn_Export.Enabled     = false;
              btn_GRYSCL.Enabled     = false;
              btn_BLKWHT.Enabled     = false;
              nud_BWSCALE.Enabled    = false;
              btn_BLKWHTAUTO.Enabled = false;
              ready = false; //:Not ready to continue other functions. [excluding this]

              //:Start a timer along with a thread to multithread the process gargling AutoBW
              System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();
              t.Interval = 1000;
              t.Tick += new EventHandler(t_Tick);

              Thread th = new Thread(new ThreadStart(BWAUTO_TH));
              t.Start();
              th.Start();
        }
 private void Car_Rate_Details_Load(object sender, EventArgs e)
 {
     Timer tmr = new Timer();
     tmr.Interval = 1000;//ticks every 1 second
     tmr.Tick += new EventHandler(timer1_Tick);
     tmr.Start();
 }
Esempio n. 8
0
		public MainForm(MainModel model)
			: this()
		{
			_model = model;
			_model.TrayIcon = _trayIcon;
			_presenter = new MainPresenter(this, model, SynchronizationContext.Current);
			_presenter.ConnectEvents();
			this.Closing += (sender, args) => _presenter.DisconnectEvents();
			
            _trayIconTimer = new Timer();
            _trayIconTimer.Interval = 750;
            _trayIconTimer.Tick += OnTrayIconTimerTick;

		    _shutdownTimer = new Timer();
		    _shutdownTimer.Interval = 20000;
            _shutdownTimer.Tick += ShutdownTimerOnTick;

			_progressView = new ProgressView(new ProgressModel(model.UploadManager));
			_processing = true;
			_trayIconTimer.Start();

			Logger.LogInfo("MainForm initialized.");
			if (_trayIcon != null)
				_trayIcon.SetTrayIconVisibility(true);

        }
Esempio n. 9
0
 private void InitTimeRemainingTimer()
 {
     Timer singleQuestionTimer = new Timer();
     singleQuestionTimer.Interval = 100;
     singleQuestionTimer.Tick += singleQuestionTimer_Tick;
     singleQuestionTimer.Start();
 }
Esempio n. 10
0
 private void start(int speed)
 {
     Timer timer = new Timer();
     timer.Tick += (object sender, EventArgs e) => { updateTimer(); };
     timer.Interval = speed;
     timer.Start();
 }
Esempio n. 11
0
 /// <summary>
 /// Starts the timer.
 /// </summary>
 public void StartTimer()
 {
     timer = new Timer();
     timer.Interval = 250;
     timer.Tick += new EventHandler(Timer_Tick);
     timer.Start();
 }
Esempio n. 12
0
        public frmSplash()
        {
            InitializeComponent();
            label1.Parent = pictureBox1;
            label1.BackColor = Color.Transparent;
            label2.Parent = pictureBox1;
            label2.BackColor = Color.Transparent;
            label3.Parent = pictureBox1;
            label3.BackColor = Color.Transparent;
            label4.Parent = pictureBox1;
            label4.BackColor = Color.Transparent;
            label5.Parent = pictureBox1;
            label5.BackColor = Color.Transparent;

            version.Parent = pictureBox1;
            version.BackColor = Color.Transparent;
            lblbuilddate.Parent = pictureBox1;
            lblbuilddate.BackColor = Color.Transparent;

            version.Text = "Version " + Application.ProductVersion;
            lblbuilddate.Text = "Build Date: " + Utility.RetrieveLinkerTimestamp().ToString();

            LoadPluginSplash();
            m_timer = new Timer();
            m_timer.Interval = 20;
            m_timer.Tick += new EventHandler(m_timer_Tick);
            m_timer.Start();

            Opacity = 0.0;
        }
Esempio n. 13
0
 public void InitTimer()
 {
     _timer = new Timer();
     _timer.Tick += new EventHandler(button1_Click);
     _timer.Interval = Convert.ToInt32(Options.Instance.TimerInterval);
     _timer.Start();
 }
Esempio n. 14
0
 public void InitTimerValidation()
 {
     _timerAuth = new Timer();
     _timerAuth.Tick += new EventHandler(InvokeValidation);
     _timerAuth.Interval = 21600000; //6h
     _timerAuth.Start();
 }
Esempio n. 15
0
        //obiekt przechowujący obiekty ubiegające się o dostęp do wątku
        //private Object Sync;
        public MainForm()
        {
            InitializeComponent();

            //Sync = new Object();

            //domyślnie serwer jest wyłączony
            isRunning = false;
            timer = new System.Windows.Forms.Timer();
            timer.Interval = 1000;
            timer.Tick += new EventHandler(DisplayServerTime);
            timer.Start();

            //utworzenie gniazda serwera
            try
            {
                server = new TcpListener(IPAddress.Any, 8001);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Nie udało się utworzyć gniazda serwera. Dalsze korzystanie z aplikacji może generować błędy! Uruchom aplikację jeszcze raz.\nDebuger message:\n" + ex.ToString(), "Błąd tworzenia gniazda serwera!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            dataBase = new GlobalMySql();

            try
            {
                dataBase.Connection.Open();
            }
            catch
            {
                AddLog("Nie udało się nawiązać połączenia z bazą danych. Aplikacja nie będzie działać poprawanie.");
            }
        }
Esempio n. 16
0
        public Form1()
        {
            InitializeComponent();
            ControlledProcess = new Process();
            Temperature = new TemperatureWorker(1000);      //refresh time = 1000ms
            TimerInt =  new Timer();
            TimerInt.Interval = 1000;
            TimerInt.Tick += new EventHandler(timer_tick);
            TimerInt.Start();

            statusStrip1.Text = "statusStrip1";
            statusStrip1.Items.Add("Core 1:");
            statusStrip1.Items[0].AutoSize = false;
            statusStrip1.Items[0].Size = new Size(statusStrip1.Width / 5, 1);

            statusStrip1.Items.Add("Core 2:");
            statusStrip1.Items[1].AutoSize = false;
            statusStrip1.Items[1].Size = new Size(statusStrip1.Width / 5, 1);

            statusStrip1.Items.Add("Core 3:");
            statusStrip1.Items[2].AutoSize = false;
            statusStrip1.Items[2].Size = new Size(statusStrip1.Width / 5, 1);

            statusStrip1.Items.Add("Core 4:");
            statusStrip1.Items[3].AutoSize = false;
            statusStrip1.Items[3].Size = new Size(statusStrip1.Width / 5, 1);
        }
Esempio n. 17
0
        private void MainForm_Load(Object sender, EventArgs e)
        {
            // bind connection Strings to the dropdown lists
            cboPersistenceService.DisplayMember = "Name";
            cboTrackingService.DisplayMember = "Name";
            foreach (ConnectionStringSettings connectionStringSetting in ConfigurationManager.ConnectionStrings)
            {
                cboPersistenceService.Items.Add(connectionStringSetting);
                cboTrackingService.Items.Add(connectionStringSetting);
            }

            cboTrackingService.Items.Insert(0, "None");

            if (cboPersistenceService.Items.Count > 0)
                cboPersistenceService.SelectedIndex = 0;

            if (cboTrackingService.Items.Count > 0)
                cboTrackingService.SelectedIndex = 0;

            // configure delegate trace listener
            DelegateTraceListener traceListener = new DelegateTraceListener();
            traceListener.WriteDelegate += traceListener_WriteDelegate;
            traceListener.WriteLineDelegate += traceListener_WriteDelegate;
            Trace.Listeners.Add(traceListener);

            // and the timer to flush messages to the message box
            traceDelegate = traceToMessageBox;
            timer = new Timer();
            timer.Interval = 1000;
            timer.Tick += timer_Tick;
            timer.Start();
        }
        private void startButton_Click(object sender, EventArgs e)
        {
            SynchronizationContext ctx = SynchronizationContext.Current;
            

            // Save the new gesture name to gestureInfoNew.data
            string name = gestureName.Text;
            Gestures.addNewGesture(name);
            Gestures.saveData(GestureStudio.GesturesDataPathNew);
            Gestures.loadData(GestureStudio.GesturesDataPathNew);

            // Count down 5.
            int countDown = 5;
            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = 1000;
            timer.Tick += (o, src) =>
                {
                    countDown--;
                    ctx.Post((state) =>
                        {
                            this.countDownLabel.Text = countDown.ToString();
                        }, null);

                    if (countDown == 0)
                    {
                        this.OnStart();
                        timer.Stop();
                        countDown = 5;
                        this.countDownLabel.Text = countDown.ToString();
                        this.gestureName.Text = "Name of the new gesture.";
                    }
                };

            timer.Start();
        }
Esempio n. 19
0
        public PwBar()
        {
            InitializeComponent();
            tas = Program.TasClient;
            timerLabel.AutoSize = true;
            headerLabel.AutoSize = true;

            timer = new Timer();
            timer.Interval = 1000;
            timer.Tick += (sender, args) =>
            {
                if (Program.NotifySection.Contains(this)) timerLabel.Text = ZkData.Utils.PrintTimeRemaining((int)deadline.Subtract(DateTime.Now).TotalSeconds);
            };
            timer.Start();

            pnl.Controls.Add(timerLabel);
            pnl.Controls.Add(headerLabel);

            // TODO pw handling 
            /*tas.Extensions.JsonDataReceived += (sender, e) =>
            {
                var newPw = e as PwMatchCommand;
                if (newPw != null)
                {
                    pw = newPw;
                    UpdateGui();
                }
            };*/

            tas.MyUserStatusChanged += (sender, args) => UpdateGui();
        }
Esempio n. 20
0
 /// <summary>
 /// フォームのロード時
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MainForm_Load(object sender, EventArgs e)
 {
     m_timer = new Timer();
     m_timer.Tick += this.timerTickHandler;
     m_timer.Interval = this.calcInterval();
     m_timer.Start();
 }
Esempio n. 21
0
        public SysTrayContext()
        {
            container = new System.ComponentModel.Container();

              notifyIcon = new NotifyIcon(this.container);
              notifyIcon.Icon = forever.icon;

              notifyIcon.Text = "Forever";
              notifyIcon.Visible = true;

              //Instantiate the context menu and items
              contextMenu = new ContextMenuStrip();
              menuItemExit = new ToolStripMenuItem();

              //Attach the menu to the notify icon
              notifyIcon.ContextMenuStrip = contextMenu;

              menuItemExit.Text = "Exit";
              menuItemExit.Click += new EventHandler(menuItemExit_Click);
              contextMenu.Items.Add(menuItemExit);

              timer = new Timer(this.container);
              timer.Interval = 1000;
              timer.Tick += new EventHandler(timer_Tick);
              timer.Start();
        }
Esempio n. 22
0
        public GraphicsDeviceControl()
        {
            // Don't initialize the graphics device if we are running in the designer.
            if (!DesignMode)
            {
                graphicsDeviceService = GraphicsDeviceService.AddRef(Handle,
                                                                     ClientSize.Width,
                                                                     ClientSize.Height);

                // Register the service, so components like ContentManager can find it.
                services.AddService<IGraphicsDeviceService>(graphicsDeviceService);

                // We used to just invalidate on idle, which ate up the CPU.
                // Instead, I'm going to put it on a 30 fps timer
                //Application.Idle += delegate { Invalidate(); };
                mTimer = new Timer();
                // If the user hasn't set DesiredFramesPerSecond
                // this will just set it to 30 and it will set the
                // interval.  If the user has, then this will use the
                // custom value set.
                DesiredFramesPerSecond = mDesiredFramesPerSecond;
                mTimer.Tick += delegate { Invalidate(); };
                mTimer.Start();

                // Give derived classes a chance to initialize themselves.
                Initialize();
            }
        }
Esempio n. 23
0
 /// <summary>
 /// Setups the timer that triggers the update loop
 /// </summary>
 private void SetupDrawLoop()
 {
     Timer timer = new Timer();
     timer.Interval = _updateIntervalMills;
     timer.Tick += TimerTick;
     timer.Start();
 }
Esempio n. 24
0
 public StatusBar()
 {
     _timer = new Timer();
     _timer.Interval = 900;
     _timer.Tick += OnTimerTick;
     _timer.Start();
 }
Esempio n. 25
0
        public void ShowData()
        {
            if (dataShowed) return;
            dataShowed = true;

            // timer
            timerRefresh = new Timer();
            timerRefresh.Interval = 5000;
            timerRefresh.Tick += TimerRefresh;
            timerRefresh.Start();

            for (int i = 0; i < 3; i++)
            {
                FlowLayoutPanel panel = new FlowLayoutPanel();

                panel.Dock = DockStyle.Fill;
                this.panelClient.Controls.Add(panel);
                monitorNavs[i] = panel;
            }

            // now only process Normal
            foreach (Monitor monitor in strategy.GetMonitorEnumerator())
            {
                MonitorUC uc = new MonitorUC(monitor);
                uc.Parent = this;

                flowLayoutPanel1.Controls.Add(uc);
                monitorNavs[monitor.Category].Controls.Add(uc);

            }

            // default is Observe Nav
            btnObserve_Click(this, null);
        }
Esempio n. 26
0
        public frmChatProperties(BitChat chat)
        {
            InitializeComponent();

            _chat = chat;

            if (_chat.NetworkType == BitChatClient.Network.BitChatNetworkType.PrivateChat)
            {
                label1.Text = "Peer's Email Address";
                txtNetwork.Text = chat.PeerEmailAddress.Address;
            }
            else
            {
                txtNetwork.Text = chat.NetworkName;
            }

            foreach (TrackerClient tracker in _chat.GetTrackers())
            {
                ListViewItem item = lstTrackerInfo.Items.Add(tracker.TrackerUri.AbsoluteUri);
                item.Tag = tracker;

                item.SubItems.Add("");
                item.SubItems.Add("");
                item.SubItems.Add("");
            }

            _timer = new Timer();
            _timer.Interval = 1000;
            _timer.Tick += _timer_Tick;
            _timer.Start();
        }
Esempio n. 27
0
 private void InitTimer()
 {
     timer = new Timer();
     timer.Tick += new EventHandler(btnUpdateAPI_Click);
     timer.Interval = Convert.ToInt32(txtRefreshRate.Text) * 60000;
     timer.Start();
 }
Esempio n. 28
0
        public UploadForm(bool keepAlive, Rectangle canvas)
        {
            InitializeComponent();

            this.ResizeRedraw = true;

            Main.Panel1Collapsed = !keepAlive;
            int height = keepAlive ? 23 : 0;
            Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            UploadSettingsConfigSection section = (UploadSettingsConfigSection)configuration.GetSection("UploadSettings");
            if (section != null) {
                foreach (UploadElement uploadElement in section.UploadSettings) {
                    UploadPanel panel = new UploadPanel();
                    panel.BackColor = Color.FromArgb(uploadElement.Color);
                    panel.Dock = DockStyle.Top;
                    panel.Height = 50;
                    panel.Width = 100;
                    panel.Upload += new UploadAction(panel_Upload);
                    panel.Description = uploadElement.Description;
                    Main.Panel2.Controls.Add(panel);
                    height += 50;
                }
            }

            SetDesktopBounds(canvas.Right - 150, canvas.Bottom - height, 100, height);

            fadeTimer = new Timer();
            fadeTimer.Interval = 5000;
            fadeTimer.Tick += new EventHandler(fadeTimer_Tick);
            if (!keepAlive)
                fadeTimer.Start();
        }
Esempio n. 29
0
        /// <summary>
        /// Launch the Lean Engine Primary Form:
        /// </summary>
        /// <param name="engine">Accept the engine instance we just launched</param>
        public LeanEngineWinForm(Engine engine)
        {
            _engine = engine;
            //Setup the State:
            _resultsHandler = engine.AlgorithmHandlers.Results;

            //Create Form:
            Text = "QuantConnect Lean Algorithmic Trading Engine: v" + Constants.Version;
            Size = new Size(1024,768);
            MinimumSize = new Size(1024, 768);
            CenterToScreen();
            WindowState = FormWindowState.Maximized;
            Icon = new Icon("../../../lean.ico");

            //Setup Console Log Area:
            _console = new RichTextBox();
            _console.Parent = this;
            _console.ReadOnly = true;
            _console.Multiline = true;
            _console.Location = new Point(0, 0);
            _console.Dock = DockStyle.Fill;
            _console.KeyUp += ConsoleOnKeyUp;
            
            //Form Events:
            Closed += OnClosed;

            //Setup Polling Events:
            _polling = new Timer();
            _polling.Interval = 1000;
            _polling.Tick += PollingOnTick;
            _polling.Start();
        }
Esempio n. 30
0
        public ToolTabs()
        {
        	toolStrip.BackColor = Program.Conf.BgColor;
        	toolStrip.ForeColor = Program.Conf.TextColor;
            BackColor = Program.Conf.BgColor; //for any child control to inherit it
            ForeColor = Program.Conf.TextColor;

            //set colour for overflow button:
            var ovrflwBtn = toolStrip.OverflowButton;
            ovrflwBtn.BackColor = Color.DimGray; //note: the colour of arrow on OverFlow button can't be set, that's why we couldn't use User's theme

            Controls.Add(panel);
            Controls.Add(toolStrip);

            var timer = new Timer { Interval = 1000 };

            timer.Tick += (s, e) =>
                {
                    foreach (var button in toolStrip.Items.OfType<ToolStripButton>())
                    {
                        if (button.Tag is HiliteLevel && ((HiliteLevel)button.Tag) == HiliteLevel.Flash) button.BackColor = button.BackColor == Color.SkyBlue ? Color.Empty : Color.SkyBlue;
                    }
                };

            timer.Start();
        }
Esempio n. 31
0
        public SystemClock()
        {
            Name = "Clock";

            this.InitializeMe();
            tmrClockTimer?.Start();

            this.Load      += (s, e) => SetDisplay();
            this.Shown     += (s, e) => LoadLayout();
            this.ResizeEnd += (s, e) => SaveLayout();
        }
Esempio n. 32
0
        private void OnTimerTick(object sender, EventArgs e)
        {
            Timer timer = (Timer)sender;

            timer?.Stop();
            Application.DoEvents();
            _proxyEnabled    = ProxyEnabled();
            _proxyServer     = ProxyServer();
            _notifyIcon.Icon = _proxyEnabled ? _onIcon : _offIcon;
            _notifyIcon.Text = (_proxyEnabled ? "Proxy is ON" : "Proxy is OFF") + $"\r\nProxy: { _proxyServer}";
            timer?.Start();
        }
Esempio n. 33
0
 private void listViewAaxFiles_SizeChanged(object sender, EventArgs e)
 {
     if (_fileItems.Count > 0)
     {
         return;
     }
     _resizeTimer?.Stop();
     if (_resizeFlag)
     {
         return;
     }
     _resizeTimer?.Start();
 }
Esempio n. 34
0
 public static void InitTimers(Label labelMoex, Label labelLocal)
 {
     _labelMoex = labelMoex;
     _timerMoex = new System.Windows.Forms.Timer
     {
         Interval = 1000
     };
     _timerMoex.Start();
     _timerMoex.Tick += TimerMoexTick;
     _labelLocal      = labelLocal;
     _timerLocal      = new System.Windows.Forms.Timer
     {
         Interval = 1000
     };
     _timerLocal.Start();
     _timerLocal.Tick += TimerLocalTick;
 }
Esempio n. 35
0
    /// <summary>
    /// 1 フレームの時間とフレーム数を指定してアニメーション機能を提供します。
    /// </summary>
    /// <param name="interval">1 フレームの時間をミリ秒単位で指定します。</param>
    /// <param name="frequency">
    /// frequency はコールバックが呼ばれる回数から 1 を引いたものです。例えば frequency が 10 の時には 11 回呼ばれます。
    /// </param>
    /// <param name="callback">
    /// bool callback(int frame, int frequency) の形でコールバックを指定します。
    /// frame は 0 から frequency の値まで 1 ずつ増加します。
    /// frequency は引数と同じものです。
    /// </param>
    public static void Animate(int interval, int frequency, Func <int, int, bool> callback)
    {
        var timer = new System.Windows.Forms.Timer();

        timer.Interval = interval;
        int frame = 0;

        timer.Tick += (sender, e) =>
        {
            if (callback(frame, frequency) == false || frame >= frequency)
            {
                timer.Stop();
            }
            frame++;
        };
        timer.Start();
    }
Esempio n. 36
0
    public BitTorrentManager()
    {
        torrentList = new List <Torrent>();

        downloadGraphData = new PointPairList();
        uploadGraphData   = new PointPairList();

        // Dll callbacks
        torrentAddedDelegate   = new AddTorrentAdded_Delegate(TorrentAddedCallback);
        torrentRemovedDelegate = new AddTorrentRemoved_Delegate(TorrentRemovedCallback);
        AddTorrentAddedCallback(torrentAddedDelegate);
        AddTorrentRemovedCallback(torrentRemovedDelegate);

        oneSecondTimer          = new System.Windows.Forms.Timer();
        oneSecondTimer.Tick    += new EventHandler(TimerEventOneSecond);
        oneSecondTimer.Interval = 1000;
        oneSecondTimer.Start();


        oneMinuteTimer          = new System.Windows.Forms.Timer();
        oneMinuteTimer.Tick    += new EventHandler(TimerEventOneMinute);
        oneMinuteTimer.Interval = 1000 * 60;
        oneMinuteTimer.Start();
    }
Esempio n. 37
0
        public Form1()
        {
            InitializeComponent();
            mainForm = this;
            ListenToParent();                      //stdin listen pipe.

            if (args.Length == 3)                  //args[0] = application.exe
            {
                if (String.IsNullOrEmpty(args[1])) //url
                {
                    if (Application.MessageLoop)
                    {
                        Application.Exit();
                    }
                    else
                    {
                        Environment.Exit(1); //if msgloop not ready
                    }
                }
                else if (String.IsNullOrEmpty(args[2])) //local-file/online-url flag
                {
                    if (Application.MessageLoop)
                    {
                        Application.Exit();
                    }
                    else
                    {
                        Environment.Exit(1);
                    }
                }
            }
            else if (args.Length == 4)
            {
                if (String.IsNullOrEmpty(args[3])) //audio visualiser flag
                {
                    if (Application.MessageLoop)
                    {
                        Application.Exit();
                    }
                    else
                    {
                        Environment.Exit(1); //if msgloop not ready
                    }
                }
                else if (String.Equals("audio", args[3], StringComparison.InvariantCultureIgnoreCase))
                {
                    enableCSCore = true;
                }
            }
            else
            {
                if (Application.MessageLoop)
                {
                    Application.Exit();
                }
                else
                {
                    Environment.Exit(1);
                }
            }
            path        = args[1];
            htmlPath    = path;
            originalUrl = args[1];

            if (enableCSCore)
            {
                CSCoreInit();        //audio analyser
                //timer, audio sends audio data etc
                timer.Interval = 33; //30fps
                timer.Tick    += Timer_Tick1;
                timer.Start();
            }

            if (args[2] == "local")
            {
                linkType = LinkType.local;
            }
            else if (args[2] == "online")
            {
                if (path.Contains("shadertoy.com/view"))
                {
                    linkType = LinkType.shadertoy;
                }
                else
                {
                    linkType = LinkType.online;
                }
            }
            else if (args[2] == "deviantart")
            {
                linkType = LinkType.deviantart;

                this.FormBorderStyle = FormBorderStyle.Sizable;
                this.WindowState     = FormWindowState.Maximized;
                //this.SizeGripStyle = SizeGripStyle.Show;
                this.ShowInTaskbar = true;
                this.MaximizeBox   = true;
                this.MinimizeBox   = true;
            }

            try
            {
                WidgetData.LoadLivelyProperties(Path.Combine(Path.GetDirectoryName(Form1.htmlPath), "LivelyProperties.json"));
            }
            catch
            {
                //can be non-customisable wp, file missing/corrupt error: skip.
            }

            InitializeChromium();
        }
Esempio n. 38
0
 private void SlideMaxItems_Scroll(object sender, EventArgs e)
 {
     slidetimer.Start();
 }
Esempio n. 39
0
        private void Form2_Load(object sender, EventArgs e)
        {
            //intialise variables
            Globals.maxn   = 0;
            Globals.cardid = 0;
            Globals.pop    = 50;
            Globals.wealth = 50;

            //setup popularity and earnings counters
            popularity_score.Text = Globals.pop.ToString();
            wealth_score.Text     = Globals.wealth.ToString();

            //get id of last card from database
            Globals.conn.Open();
            string     selectmax = "Select MAX(id) FROM dbo.DogeCards;";
            SqlCommand Command1  = new SqlCommand(selectmax);

            Command1.Connection = Globals.conn;

            SqlDataReader dataR;

            dataR = Command1.ExecuteReader();

            while (dataR.Read())
            {
                //sets the id of the last card as the ma number of cards
                Globals.maxn = Int32.Parse(dataR[0].ToString());
            }


            dataR.Close();
            Globals.conn.Close();
            //checks to make sure max no of cards has not yet been reached
            if (Globals.cardid < Globals.maxn)
            {
ExistCheck3:
                Globals.cardid = Globals.cardid + 1;

                //gets data for next card
                Globals.conn.Open();
                string     selectText = "Select * from dbo.DogeCards where id = " + Globals.cardid + ";";
                SqlCommand Command2   = new SqlCommand(selectText);
                Command2.Connection = Globals.conn;
                //returns value of next id in database (if row doesn't exist then returns 0)
                int exists = System.Convert.ToInt32(Command2.ExecuteScalar());

                //if value exists
                if (exists > 0)
                {
                    Globals.cardid = System.Convert.ToInt32(Command2.ExecuteScalar());//change cardid to id from execute scalar

                    SqlDataReader dataR2;
                    dataR2 = Command2.ExecuteReader();
                    //get all card data
                    while (dataR2.Read())
                    {
                        Globals.id      = dataR2[6].ToString();
                        Globals.cardid  = System.Convert.ToInt32(dataR2[0]);
                        Globals.url     = dataR2[5].ToString();
                        Globals.wealthy = System.Convert.ToInt32(dataR2[1]);
                        Globals.wealthn = System.Convert.ToInt32(dataR2[2]);
                        Globals.popy    = System.Convert.ToInt32(dataR2[3]);
                        Globals.popn    = System.Convert.ToInt32(dataR2[4]);
                    }
                    dataR2.Close();
                    Globals.conn.Close();
                }
                //if executescalar returns null then go back and try again with next row in database
                else if (exists == 0)
                {
                    Globals.conn.Close();
                    goto ExistCheck3;
                }
                //display all card data
                image_card.ImageLocation = Globals.url;
                image_description.Text   = Globals.id;



                //loads name onto form
                player_namem.Text = Globals.usernamesend.ToString();



                //initialise the timer
                timer1          = new System.Windows.Forms.Timer();
                timer1.Tick    += new EventHandler(timer1_Tick);
                timer1.Interval = 60000; // 1 minute
                timeLeft        = 29;
                timer.Text      = "30";
                timer1.Start();
            }
        }
Esempio n. 40
0
    public wheelchair_race()
    {
        end.Left   = 500;
        end.Width  = 700;
        end.Height = 80;
        end.Font   = new Font("SansSerif", 40);



        //学校
        emblem.Image = Image.FromFile(@"Z:\パソコン部\文化祭発表用フォルダ\exes\kurumaisuImages\ddd.jpg");
        point.Font   = new Font("SansSerif", 50);
        //フォームを真ん中に設定
        this.StartPosition = FormStartPosition.Manual;
        this.Location      = new Point(0, (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2);

        this.Width  = Screen.PrimaryScreen.Bounds.Width;         //フォームの幅をパソコン画面と同じに設定
        this.Height = 300;

        this.Text = "wheelchair_race";

        //ポイント部分
        point.Left   = this.Right - point.Width - 300;
        point.Height = 100;
        point.Width  = 600;
        point.Text   = "血圧: " + points;

        //ボタン部分、ゲーム開始後はボタンが消える
        GameStart.Text   = "はじめる";
        GameStart.Left   = (this.Width - GameStart.Width) / 2;          //真ん中に配置
        GameStart.Top    = 10;
        GameStart.Click += delegate
        {
            tm.Start();
        };

        //ジャンプ配置
        this.KeyDown += delegate(Object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Up)
            {
                OnOff = "ON";
            }
        };

        //車椅
        wheelchair.Image  = Image.FromFile(@"Z:\パソコン部\文化祭発表用フォルダ\exes\kurumaisuImages\weelcar.png");
        wheelchair.Parent = this;
        wheelchair.Left   = 30;
        wheelchair.Top    = this.Height - 100;
        wheelchair.Height = 44;
        wheelchair.Width  = 50;
        //爺さん呼び出し
        MoreImages();
        Ura();
        kai3();
        kai4();
        kai5();
        kai6();



        //画面描画処理
        tm.Interval = 1;
        tm.Tick    += delegate
        {
            NowTime += 1;
            GAMEMAIN();
            encountObject();
            Movewheelchair();
            //最後の画像が1000を超えたとき
            if (Pict[4].Left <= 1200)
            {
                MoveUra();
                speed = 10;
            }

            //ウラの最後の画像が1100を超えたとき
            if (PictUra[4].Left <= 1100)
            {
                Movekai3();
                speed = 20;
            }

            if (Pict3[4].Left <= 1200)
            {
                Movekai4();
                speed = 10;
            }

            if (Pictt[4].Left <= 1200)
            {
                Movekai5();
                speed = 10;
            }

            if (Pictd[4].Left <= 0)
            {
                wheelchair.Left = 500;
                emblem.Width    = 300;
                emblem.Height   = 300;

                Movekai6();
                speed = 10;
            }
        };


        //Parent
        point.Parent     = this;
        GameStart.Parent = this;
    }
Esempio n. 41
0
 private void FormIMU_Load(object sender, EventArgs e)
 {
     formUpdateTimer.Interval = 25;
     formUpdateTimer.Tick    += new EventHandler(formUpdateTimer_Tick);
     formUpdateTimer.Start();
 }
Esempio n. 42
0
        // This is a single shot _benchmarkTimer
        private void StartupTimer_Tick(object sender, EventArgs e)
        {
            StartupTimer.Stop();
            StartupTimer = null;

            // Internals Init
            // TODO add loading step
            MinersSettingsManager.Init();

            if (!Helpers.Is45NetOrHigher())
            {
                MessageBox.Show(International.GetText("NET45_Not_Installed_msg"),
                                International.GetText("Warning_with_Exclamation"),
                                MessageBoxButtons.OK);

                this.Close();
                return;
            }

            if (!Helpers.Is64BitOperatingSystem)
            {
                MessageBox.Show(International.GetText("Form_Main_x64_Support_Only"),
                                International.GetText("Warning_with_Exclamation"),
                                MessageBoxButtons.OK);

                this.Close();
                return;
            }

            // 3rdparty miners check scope #1
            {
                // check if setting set
                if (ConfigManager.GeneralConfig.Use3rdPartyMiners == Use3rdPartyMiners.NOT_SET)
                {
                    // Show TOS
                    Form tos = new Form_3rdParty_TOS();
                    tos.ShowDialog(this);
                }
            }

            // Query Avaliable ComputeDevices
            ComputeDeviceManager.Query.QueryDevices(LoadingScreen);
            _isDeviceDetectionInitialized = true;

            /////////////////////////////////////////////
            /////// from here on we have our devices and Miners initialized
            ConfigManager.AfterDeviceQueryInitialization();
            LoadingScreen.IncreaseLoadCounterAndMessage(International.GetText("Form_Main_loadtext_SaveConfig"));

            // All devices settup should be initialized in AllDevices
            devicesListViewEnableControl1.ResetComputeDevices(ComputeDeviceManager.Avaliable.AllAvaliableDevices);
            // set properties after
            devicesListViewEnableControl1.SaveToGeneralConfig = true;

            LoadingScreen.IncreaseLoadCounterAndMessage(International.GetText("Form_Main_loadtext_CheckLatestVersion"));

            MinerStatsCheck          = new Timer();
            MinerStatsCheck.Tick    += MinerStatsCheck_Tick;
            MinerStatsCheck.Interval = ConfigManager.GeneralConfig.MinerAPIQueryInterval * 1000;

            SMAMinerCheck          = new Timer();
            SMAMinerCheck.Tick    += SMAMinerCheck_Tick;
            SMAMinerCheck.Interval = ConfigManager.GeneralConfig.SwitchMinSecondsFixed * 1000 + R.Next(ConfigManager.GeneralConfig.SwitchMinSecondsDynamic * 1000);
            if (ComputeDeviceManager.Group.ContainsAMD_GPUs)
            {
                SMAMinerCheck.Interval = (ConfigManager.GeneralConfig.SwitchMinSecondsAMD + ConfigManager.GeneralConfig.SwitchMinSecondsFixed) * 1000 + R.Next(ConfigManager.GeneralConfig.SwitchMinSecondsDynamic * 1000);
            }

            LoadingScreen.IncreaseLoadCounterAndMessage(International.GetText("Form_Main_loadtext_GetNiceHashSMA"));
            // Init ws connection
            NiceHashStats.OnBalanceUpdate         += BalanceCallback;
            NiceHashStats.OnSMAUpdate             += SMACallback;
            NiceHashStats.OnVersionUpdate         += VersionUpdateCallback;
            NiceHashStats.OnConnectionLost        += ConnectionLostCallback;
            NiceHashStats.OnConnectionEstablished += ConnectionEstablishedCallback;
            NiceHashStats.OnVersionBurn           += VersionBurnCallback;
            NiceHashStats.StartConnection(Links.NHM_Socket_Address);

            // increase timeout
            if (Globals.IsFirstNetworkCheckTimeout)
            {
                while (!Helpers.WebRequestTestGoogle() && Globals.FirstNetworkCheckTimeoutTries > 0)
                {
                    --Globals.FirstNetworkCheckTimeoutTries;
                }
            }

            LoadingScreen.IncreaseLoadCounterAndMessage(International.GetText("Form_Main_loadtext_GetBTCRate"));

            BitcoinExchangeCheck          = new Timer();
            BitcoinExchangeCheck.Tick    += BitcoinExchangeCheck_Tick;
            BitcoinExchangeCheck.Interval = 1000 * 3601; // every 1 hour and 1 second
            BitcoinExchangeCheck.Start();
            BitcoinExchangeCheck_Tick(null, null);

            LoadingScreen.IncreaseLoadCounterAndMessage(International.GetText("Form_Main_loadtext_SetEnvironmentVariable"));
            Helpers.SetDefaultEnvironmentVariables();

            LoadingScreen.IncreaseLoadCounterAndMessage(International.GetText("Form_Main_loadtext_SetWindowsErrorReporting"));

            Helpers.DisableWindowsErrorReporting(ConfigManager.GeneralConfig.DisableWindowsErrorReporting);

            LoadingScreen.IncreaseLoadCounter();
            if (ConfigManager.GeneralConfig.NVIDIAP0State)
            {
                LoadingScreen.SetInfoMsg(International.GetText("Form_Main_loadtext_NVIDIAP0State"));
                try {
                    ProcessStartInfo psi = new ProcessStartInfo();
                    psi.FileName        = "nvidiasetp0state.exe";
                    psi.Verb            = "runas";
                    psi.UseShellExecute = true;
                    psi.CreateNoWindow  = true;
                    Process p = Process.Start(psi);
                    p.WaitForExit();
                    if (p.ExitCode != 0)
                    {
                        Helpers.ConsolePrint("NICEHASH", "nvidiasetp0state returned error code: " + p.ExitCode.ToString());
                    }
                    else
                    {
                        Helpers.ConsolePrint("NICEHASH", "nvidiasetp0state all OK");
                    }
                } catch (Exception ex) {
                    Helpers.ConsolePrint("NICEHASH", "nvidiasetp0state error: " + ex.Message);
                }
            }

            LoadingScreen.FinishLoad();

            bool runVCRed = !MinersExistanceChecker.IsMinersBinsInit() && !ConfigManager.GeneralConfig.DownloadInit;

            // standard miners check scope
            {
                // check if download needed
                if (!MinersExistanceChecker.IsMinersBinsInit() && !ConfigManager.GeneralConfig.DownloadInit)
                {
                    Form_Loading downloadUnzipForm = new Form_Loading(new MinersDownloader(MinersDownloadManager.StandardDlSetup));
                    SetChildFormCenter(downloadUnzipForm);
                    downloadUnzipForm.ShowDialog();
                }
                // check if files are mising
                if (!MinersExistanceChecker.IsMinersBinsInit())
                {
                    var result = MessageBox.Show(International.GetText("Form_Main_bins_folder_files_missing"),
                                                 International.GetText("Warning_with_Exclamation"),
                                                 MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (result == DialogResult.Yes)
                    {
                        ConfigManager.GeneralConfig.DownloadInit = false;
                        ConfigManager.GeneralConfigFileCommit();
                        Process PHandle = new Process();
                        PHandle.StartInfo.FileName = Application.ExecutablePath;
                        PHandle.Start();
                        Close();
                        return;
                    }
                }
                else if (!ConfigManager.GeneralConfig.DownloadInit)
                {
                    // all good
                    ConfigManager.GeneralConfig.DownloadInit = true;
                    ConfigManager.GeneralConfigFileCommit();
                }
            }
            // 3rdparty miners check scope #2
            {
                // check if download needed
                if (ConfigManager.GeneralConfig.Use3rdPartyMiners == Use3rdPartyMiners.YES)
                {
                    if (!MinersExistanceChecker.IsMiners3rdPartyBinsInit() && !ConfigManager.GeneralConfig.DownloadInit3rdParty)
                    {
                        Form_Loading download3rdPartyUnzipForm = new Form_Loading(new MinersDownloader(MinersDownloadManager.ThirdPartyDlSetup));
                        SetChildFormCenter(download3rdPartyUnzipForm);
                        download3rdPartyUnzipForm.ShowDialog();
                    }
                    // check if files are mising
                    if (!MinersExistanceChecker.IsMiners3rdPartyBinsInit())
                    {
                        var result = MessageBox.Show(International.GetText("Form_Main_bins_folder_files_missing"),
                                                     International.GetText("Warning_with_Exclamation"),
                                                     MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (result == DialogResult.Yes)
                        {
                            ConfigManager.GeneralConfig.DownloadInit3rdParty = false;
                            ConfigManager.GeneralConfigFileCommit();
                            Process PHandle = new Process();
                            PHandle.StartInfo.FileName = Application.ExecutablePath;
                            PHandle.Start();
                            Close();
                            return;
                        }
                    }
                    else if (!ConfigManager.GeneralConfig.DownloadInit3rdParty)
                    {
                        // all good
                        ConfigManager.GeneralConfig.DownloadInit3rdParty = true;
                        ConfigManager.GeneralConfigFileCommit();
                    }
                }
            }

            if (runVCRed)
            {
                Helpers.InstallVcRedist();
            }


            if (ConfigManager.GeneralConfig.AutoStartMining)
            {
                // well this is started manually as we want it to start at runtime
                IsManuallyStarted = true;
                if (StartMining(true) != StartMiningReturnType.StartMining)
                {
                    IsManuallyStarted = false;
                    StopMining();
                }
            }
        }
Esempio n. 43
0
 private void Typewrite()
 {
     actionButton.Enabled   = false;
     CbPlayerCombat.Enabled = false;
     timer1.Start();
 }
Esempio n. 44
0
 void ResetTimer(System.Windows.Forms.Timer timer)
 {
     timer.Stop();
     timer.Start();
 }
Esempio n. 45
0
 public void OnInstallHook(byte[] data)
 {
     parentWindow = (IntPtr)BitConverter.ToInt32(data, 0);
     spyWindow    = (IntPtr)BitConverter.ToInt32(data, 4);
     timer1.Start();
 }
Esempio n. 46
0
        private void transition_Click(object sender, EventArgs e)
        {
            timer1          = new System.Windows.Forms.Timer();
            timer1.Tick    += new EventHandler(timer1_Tick);
            timer1.Interval = 1000; // 1 second


            if (Login.Text == "AdminKnor1")
            {
                if (Pass.Text == "college1234567")
                {
                    Korpus_value = " ='Кнорина' ";
                    StreamWriter SW = new StreamWriter(new FileStream("Korpus.file", FileMode.Create, FileAccess.Write));

                    SW.Write(Korpus_value);
                    SW.Close();

                    counter = 1;
                    timer1.Start();
                }

                else
                {
                    Pass.Text                   = "";
                    Login.Text                  = "";
                    Error.Visible               = true;
                    Pass.BorderColorFocused     = Color.FromArgb(168, 0, 0);
                    Pass.BorderColorIdle        = Color.FromArgb(168, 0, 0);
                    Pass.BorderColorMouseHover  = Color.FromArgb(168, 0, 0);
                    Login.BorderColorFocused    = Color.FromArgb(168, 0, 0);
                    Login.BorderColorIdle       = Color.FromArgb(168, 0, 0);
                    Login.BorderColorMouseHover = Color.FromArgb(168, 0, 0);
                }
            }
            else if (Login.Text == "AdminKazin2")
            {
                if (Pass.Text == "college7654321")
                {
                    Korpus_value = " ='Казинца' ";

                    StreamWriter SW = new StreamWriter(new FileStream("Korpus.file", FileMode.Create, FileAccess.Write));

                    SW.Write(Korpus_value);
                    SW.Close();

                    counter = 1;
                    timer1.Start();
                }

                else
                {
                    Pass.Text                   = "";
                    Login.Text                  = "";
                    Error.Visible               = true;
                    Pass.BorderColorFocused     = Color.FromArgb(168, 0, 0);
                    Pass.BorderColorIdle        = Color.FromArgb(168, 0, 0);
                    Pass.BorderColorMouseHover  = Color.FromArgb(168, 0, 0);
                    Login.BorderColorFocused    = Color.FromArgb(168, 0, 0);
                    Login.BorderColorIdle       = Color.FromArgb(168, 0, 0);
                    Login.BorderColorMouseHover = Color.FromArgb(168, 0, 0);
                }
            }
            else if (Login.Text == "Admin")
            {
                if (Pass.Text == "admin")

                {
                    Korpus_value = " is NOT NULL ";

                    StreamWriter SW = new StreamWriter(new FileStream("Korpus.file", FileMode.Create, FileAccess.Write));

                    SW.Write(Korpus_value);
                    SW.Close();

                    counter = 1;
                    timer1.Start();
                }

                else
                {
                    Pass.Text                   = "";
                    Login.Text                  = "";
                    Error.Visible               = true;
                    Pass.BorderColorFocused     = Color.FromArgb(168, 0, 0);
                    Pass.BorderColorIdle        = Color.FromArgb(168, 0, 0);
                    Pass.BorderColorMouseHover  = Color.FromArgb(168, 0, 0);
                    Login.BorderColorFocused    = Color.FromArgb(168, 0, 0);
                    Login.BorderColorIdle       = Color.FromArgb(168, 0, 0);
                    Login.BorderColorMouseHover = Color.FromArgb(168, 0, 0);
                }
            }
            else
            {
                Pass.Text                   = "";
                Login.Text                  = "";
                Error.Visible               = true;
                Pass.BorderColorFocused     = Color.FromArgb(168, 0, 0);
                Pass.BorderColorIdle        = Color.FromArgb(168, 0, 0);
                Pass.BorderColorMouseHover  = Color.FromArgb(168, 0, 0);
                Login.BorderColorFocused    = Color.FromArgb(168, 0, 0);
                Login.BorderColorIdle       = Color.FromArgb(168, 0, 0);
                Login.BorderColorMouseHover = Color.FromArgb(168, 0, 0);
            }
        }
Esempio n. 47
0
        private void AdminDashboard_Load(object sender, EventArgs e)
        {
            //set the opacity of the form to 0
            Opacity = 0;
            //set the interval of the timer
            t1.Interval = 15;
            //tick the timer
            t1.Tick += new EventHandler(fadeIn);
            //start the timer
            t1.Start();


            //filling data grids etc

            // TODO: This line of code loads data into the 'registerdUsersDataSet1.HolidayLeave' table. You can move, or remove it, as needed.
            this.holidayLeaveTableAdapter3.Fill(this.registerdUsersDataSet1.HolidayLeave);
            // TODO: This line of code loads data into the 'holidayLeaveApproval.HolidayLeave' table. You can move, or remove it, as needed.
            this.holidayLeaveTableAdapter2.Fill(this.holidayLeaveApproval.HolidayLeave);
            // TODO: This line of code loads data into the 'holidayDataDash.HolidayLeave' table. You can move, or remove it, as needed.
            this.holidayLeaveTableAdapter1.Fill(this.holidayDataDash.HolidayLeave);
            // TODO: This line of code loads data into the 'dashTasks.TaskSchedule' table. You can move, or remove it, as needed.
            this.taskScheduleTableAdapter1.Fill(this.dashTasks.TaskSchedule);
            // TODO: This line of code loads data into the 'departmentTableData1.Departments' table. You can move, or remove it, as needed.
            this.departmentsTableAdapter.Fill(this.departmentTableData1.Departments);
            // TODO: This line of code loads data into the 'employeesTableData.Employees' table. You can move, or remove it, as needed.
            this.employeesTableAdapter.Fill(this.employeesTableData.Employees);
            // TODO: This line of code loads data into the 'holidayTableData.HolidayLeave' table. You can move, or remove it, as needed.
            this.holidayLeaveTableAdapter.Fill(this.holidayTableData.HolidayLeave);
            // TODO: This line of code loads data into the 'taskTableData.TaskSchedule' table. You can move, or remove it, as needed.
            this.taskScheduleTableAdapter.Fill(this.taskTableData.TaskSchedule);
            // TODO: This line of code loads data into the 'rolesTableData.Roles' table. You can move, or remove it, as needed.
            this.rolesTableAdapter.Fill(this.rolesTableData.Roles);

            //gets the connection
            var           connectionString = ConfigurationManager.ConnectionStrings["EmployeeManagement"].ConnectionString;
            SqlConnection con = new SqlConnection(connectionString);

            //Opens connection to the database
            con.Open();
            //creates a new sql command
            SqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            //Sets the sql query
            cmd.CommandText = "select * from Roles";
            //executes the query
            cmd.ExecuteNonQuery();
            //creates a new datatable
            DataTable dt = new DataTable();
            //creates a new adapter
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            //fills the adapater with the data from the cmd
            da.Fill(dt);
            //closes connection
            con.Close();

            //refreshes datagridview
            // TODO : RolesData.Refresh();

            //opens connection
            con.Open();
            //Creates a new command
            SqlCommand Taskscmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            //creates the query
            cmd.CommandText = "select * from TaskSchedule";
            //Excutes the created query
            cmd.ExecuteNonQuery();
            //creates datatable
            DataTable TasksData = new DataTable();
            //creates adapter
            SqlDataAdapter TasksAdapter = new SqlDataAdapter(cmd);

            //fills adapter
            da.Fill(TasksData);
            DashTaskDataGrid.DataSource = TasksData;
            con.Close();

            //all the below code selects the correct data for each datagrid view and applys it to the datatable and then to the dgv

            con.Open();
            SqlCommand ListOfUsers = con.CreateCommand();

            ListOfUsers.CommandType = CommandType.Text;
            ListOfUsers.CommandText = "select * from Employees";
            ListOfUsers.ExecuteNonQuery();
            DataTable      employeeTask = new DataTable();
            SqlDataAdapter usersAdapt   = new SqlDataAdapter(ListOfUsers);

            usersAdapt.Fill(employeeTask);
            dataGridView1.DataSource = employeeTask;
            con.Close();

            dataGridView1.Refresh();

            con.Open();
            SqlCommand HolidayData = con.CreateCommand();

            HolidayData.CommandType = CommandType.Text;
            HolidayData.CommandText = "select * from HolidayLeave";
            HolidayData.ExecuteNonQuery();
            DataTable      HolidayDataTable   = new DataTable();
            SqlDataAdapter HolidayDataAdapter = new SqlDataAdapter(HolidayData);

            HolidayDataAdapter.Fill(HolidayDataTable);
            DashHolidayData.DataSource = HolidayDataTable;
            con.Close();

            // refreshes the datagridview
            DashHolidayData.Refresh();

            con.Open();
            SqlCommand Taskcmd = con.CreateCommand();

            Taskcmd.CommandType = CommandType.Text;
            Taskcmd.CommandText = "select * from TaskSchedule";
            Taskcmd.ExecuteNonQuery();
            DataTable      dataTask   = new DataTable();
            SqlDataAdapter tasksAdapt = new SqlDataAdapter(Taskcmd);

            tasksAdapt.Fill(dataTask);
            DashTaskDataGrid.DataSource = dataTask;
            con.Close();

            // refreshes the datagridview
            DashTaskDataGrid.Refresh();



            //setting the panels to visible if neccasary
            Dashboard.Visible        = true;
            AddPanel.Visible         = false;
            tasksPanel.Visible       = false;
            ListOfUsersPanel.Visible = false;
            holidayListPanel.Visible = false;
        }
Esempio n. 48
0
 private void StartTimers()
 {
     moveTimer.Start();
     shootTimer.Start();
 }
Esempio n. 49
0
        private void button1_Click(object sender, EventArgs e)
        {
            MYconn = DbConnection_My.MyGetRemoteDataInstance().MygetRemoteDbConnection("124");


            formstimer.Interval = 1000;
            formstimer.Tick    += timer_sales_Tick;
            formstimer.Start();

            safe_sale_timer.Interval = 1000;
            safe_sale_timer.Tick    += timer_safe_sale_Tick;
            safe_sale_timer.Start();



            if (MYconn.State.ToString() == "Open")
            {
                string DB_124 = MYconn.DataSource.ToString();
                if (DB_124 != "")
                {
                    checkBox1.Checked = true;
                }
            }
            else
            {
                checkBox1.Checked = false;
            }

            MYconn.Dispose();
            MYconn.Close();
            Log((String.Format("[MySql_124]:{0}", MYconn.State.ToString())));

            MYconn = DbConnection_My.MyGetRemoteDataInstance().MygetRemoteDbConnection("164");

            if (MYconn.State.ToString() == "Open")
            {
                string DB_164 = MYconn.DataSource.ToString();
                if (DB_164 != "")
                {
                    checkBox2.Checked = true;
                }
            }
            else
            {
                checkBox2.Checked = false;
            }

            MYconn.Dispose();
            MYconn.Close();
            Log((String.Format("[MySql_164]:{0}", MYconn.State.ToString())));

            MYconn = DbConnection_My.MyGetRemoteDataInstance().MygetRemoteDbConnection("18");

            if (MYconn.State.ToString() == "Open")
            {
                string DB_18 = MYconn.DataSource.ToString();
                if (DB_18 != "")
                {
                    checkBox3.Checked = true;
                }
            }
            else
            {
                checkBox3.Checked = false;
            }

            MYconn.Dispose();
            MYconn.Close();
            Log((String.Format("[MySql_18]:{0}", MYconn.State.ToString())));

            if ((checkBox1.Checked == true) && (checkBox2.Checked == true) && (checkBox3.Checked == true))
            {
                label2.ForeColor = System.Drawing.Color.Blue;
                label2.Text      = "정상 접속 성공";
                sendSms("[2차 시뮬레이션 판매예측값] 프로그램 시작 ");
            }
            else
            {
                label2.ForeColor = System.Drawing.Color.Red;
                label2.Text      = "접속 오류";
            }
        }
Esempio n. 50
0
 private void notepadText_ModifiedChanged(object sender, EventArgs e)
 {
     modifyTimer.Start();
 }
Esempio n. 51
0
        private void FormLorakonSniff_Load(object sender, EventArgs e)
        {
            try
            {
                // Create environment and load settings
                if (!Directory.Exists(LorakonEnvironment.SettingsPath))
                {
                    Directory.CreateDirectory(LorakonEnvironment.SettingsPath);
                }
                settings = new Settings();
                LoadSettings();

                connection = new SqlConnection(settings.ConnectionString);
                connection.Open();

                hashes = new Hashes();

                string InstallationDirectory =
                    Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]) +
                    Path.DirectorySeparatorChar;
                ReportExecutable = InstallationDirectory + "report.exe";
                if (!File.Exists(ReportExecutable))
                {
                    throw new Exception("Finner ikke filen: " + ReportExecutable);
                }

                ReportTemplate = InstallationDirectory + "report_template.tpl";
                if (!File.Exists(ReportTemplate))
                {
                    throw new Exception("Finner ikke filen: " + ReportTemplate);
                }

                Visible       = false;
                ShowInTaskbar = false;

                // Set default window layout
                Rectangle rect = Screen.FromControl(this).Bounds;
                Width  = (rect.Right - rect.Left) / 2;
                Height = (rect.Bottom - rect.Top) / 2;
                Left   = rect.Left + Width / 2;
                Top    = rect.Top + Height / 2;

                if (!Directory.Exists(settings.RootDirectory))
                {
                    Directory.CreateDirectory(settings.RootDirectory);
                }

                if (!Directory.Exists(settings.WatchDirectory))
                {
                    Directory.CreateDirectory(settings.WatchDirectory);
                }

                if (!Directory.Exists(settings.WatchDirectory2))
                {
                    Directory.CreateDirectory(settings.WatchDirectory2);
                }

                if (!Directory.Exists(settings.ImportedDirectory))
                {
                    Directory.CreateDirectory(settings.ImportedDirectory);
                }

                if (!Directory.Exists(settings.OldDirectory))
                {
                    Directory.CreateDirectory(settings.OldDirectory);
                }

                if (!Directory.Exists(settings.FailedDirectory))
                {
                    Directory.CreateDirectory(settings.FailedDirectory);
                }

                tbSettingsWatchDirectory.Text        = settings.WatchDirectory;
                tbSettingsWatchDirectory2.Text       = settings.WatchDirectory2;
                tbSettingsImportedDirectory.Text     = settings.ImportedDirectory;
                tbSettingsOldDirectory.Text          = settings.OldDirectory;
                tbSettingsFailedDirectory.Text       = settings.FailedDirectory;
                tbSettingsConnectionString.Text      = settings.ConnectionString;
                tbSettingsSpectrumFilter.Text        = settings.FileFilter;
                cbSettingsDeleteOldSpectrums.Checked = settings.DeleteOldFiles;

                tbAbout.Text = "Lorakon Sniff" + Environment.NewLine + Environment.NewLine +
                               "Import av innkommende spekterfiler";

                // Start import timer
                timer.Interval = 5000;
                timer.Tick    += Timer_Tick;
                timer.Start();
            }
            catch (Exception ex)
            {
                if (connection != null && connection.State == ConnectionState.Open)
                {
                    Log.Add(connection, Log.Severity.Critical, ex.Message);
                    connection.Close();
                }
                Application.Exit();
            }
            finally
            {
                if (connection != null && connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
            }
        }
Esempio n. 52
0
 private void FirstClickCallback()
 {
     stopwatch.Start();
     stopwatchTimer.Start();
 }
Esempio n. 53
0
        private StartMiningReturnType StartMining(bool showWarnings)
        {
            if (textBoxBTCAddress.Text.Equals(""))
            {
                if (showWarnings)
                {
                    DialogResult result = MessageBox.Show(International.GetText("Form_Main_DemoModeMsg"),
                                                          International.GetText("Form_Main_DemoModeTitle"),
                                                          MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                    if (result == System.Windows.Forms.DialogResult.Yes)
                    {
                        DemoMode = true;
                        labelDemoMode.Visible = true;
                        labelDemoMode.Text    = International.GetText("Form_Main_DemoModeLabel");
                    }
                    else
                    {
                        return(StartMiningReturnType.IgnoreMsg);
                    }
                }
                else
                {
                    return(StartMiningReturnType.IgnoreMsg);;
                }
            }
            else if (!VerifyMiningAddress(true))
            {
                return(StartMiningReturnType.IgnoreMsg);
            }

            if (Globals.NiceHashData == null)
            {
                if (showWarnings)
                {
                    MessageBox.Show(International.GetText("Form_Main_msgbox_NullNiceHashDataMsg"),
                                    International.GetText("Error_with_Exclamation"),
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return(StartMiningReturnType.IgnoreMsg);
            }


            // Check if there are unbenchmakred algorithms
            bool isBenchInit       = true;
            bool hasAnyAlgoEnabled = false;

            foreach (var cdev in ComputeDeviceManager.Avaliable.AllAvaliableDevices)
            {
                if (cdev.Enabled)
                {
                    foreach (var algo in cdev.GetAlgorithmSettings())
                    {
                        if (algo.Enabled == true)
                        {
                            hasAnyAlgoEnabled = true;
                            if (algo.BenchmarkSpeed == 0)
                            {
                                isBenchInit = false;
                                break;
                            }
                        }
                    }
                }
            }
            // Check if the user has run benchmark first
            if (!isBenchInit)
            {
                DialogResult result = DialogResult.No;
                if (showWarnings)
                {
                    result = MessageBox.Show(International.GetText("EnabledUnbenchmarkedAlgorithmsWarning"),
                                             International.GetText("Warning_with_Exclamation"),
                                             MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
                }
                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    BenchmarkForm = new Form_Benchmark(
                        BenchmarkPerformanceType.Standard,
                        true);
                    SetChildFormCenter(BenchmarkForm);
                    BenchmarkForm.ShowDialog();
                    BenchmarkForm = null;
                    InitMainConfigGUIData();
                }
                else if (result == System.Windows.Forms.DialogResult.No)
                {
                    // check devices without benchmarks
                    foreach (var cdev in ComputeDeviceManager.Avaliable.AllAvaliableDevices)
                    {
                        if (cdev.Enabled)
                        {
                            bool Enabled = false;
                            foreach (var algo in cdev.GetAlgorithmSettings())
                            {
                                if (algo.BenchmarkSpeed > 0)
                                {
                                    Enabled = true;
                                    break;
                                }
                            }
                            cdev.Enabled = Enabled;
                        }
                    }
                }
                else
                {
                    return(StartMiningReturnType.IgnoreMsg);
                }
            }

            textBoxBTCAddress.Enabled = false;
            textBoxWorkerName.Enabled = false;
            comboBoxLocation.Enabled  = false;
            buttonBenchmark.Enabled   = false;
            buttonStartMining.Enabled = false;
            buttonSettings.Enabled    = false;
            devicesListViewEnableControl1.IsMining = true;
            buttonStopMining.Enabled = true;

            // Disable profitable notification on start
            IsNotProfitable = false;

            ConfigManager.GeneralConfig.BitcoinAddress  = textBoxBTCAddress.Text.Trim();
            ConfigManager.GeneralConfig.WorkerName      = textBoxWorkerName.Text.Trim();
            ConfigManager.GeneralConfig.ServiceLocation = comboBoxLocation.SelectedIndex;

            InitFlowPanelStart();
            ClearRatesALL();

            var btcAdress = DemoMode ? Globals.DemoUser : textBoxBTCAddress.Text.Trim();
            var isMining  = MinersManager.StartInitialize(this, Globals.MiningLocation[comboBoxLocation.SelectedIndex], textBoxWorkerName.Text.Trim(), btcAdress);

            if (!DemoMode)
            {
                ConfigManager.GeneralConfigFileCommit();
            }

            isSMAUpdated           = true; // Always check profits on mining start
            SMAMinerCheck.Interval = 100;
            SMAMinerCheck.Start();
            MinerStatsCheck.Start();

            return(isMining ? StartMiningReturnType.StartMining : StartMiningReturnType.ShowNoMining);
        }
Esempio n. 54
0
        public Form2()
        {
            InitializeComponent();
            timer1.Tick    += timer1_Tick;
            timer1.Interval = 1000;
            checkBox1       = new CheckBox()
            {
                Location = new Point(50, 200)
            };
            checkBox2 = new CheckBox()
            {
                Location = new Point(250, 200)
            };
            checkBox3 = new CheckBox()
            {
                Location = new Point(450, 200)
            };
            checkBox4 = new CheckBox()
            {
                Location = new Point(650, 200)
            };
            this.Controls.Add(checkBox1);
            this.Controls.Add(checkBox2);
            this.Controls.Add(checkBox3);
            this.Controls.Add(checkBox4);

            // Create an ActionBlock<CheckBox> object that toggles the state
            // of CheckBox objects.
            // Specifying the current synchronization context enables the
            // action to run on the user-interface thread.
            var toggleCheckBox = new ActionBlock <CheckBox>(checkBox =>
            {
                checkBox.Checked = !checkBox.Checked;
            },
                                                            new ExecutionDataflowBlockOptions
            {
                TaskScheduler = TaskScheduler.FromCurrentSynchronizationContext()
            });

            // Create a ConcurrentExclusiveSchedulerPair object.
            // Readers will run on the concurrent part of the scheduler pair.
            // The writer will run on the exclusive part of the scheduler pair.
            var taskSchedulerPair = new ConcurrentExclusiveSchedulerPair();

            // Create an ActionBlock<int> object for each reader CheckBox object.
            // Each ActionBlock<int> object represents an action that can read
            // from a resource in parallel to other readers.
            // Specifying the concurrent part of the scheduler pair enables the
            // reader to run in parallel to other actions that are managed by
            // that scheduler.
            var readerActions = from checkBox in new CheckBox[] { checkBox1, checkBox2, checkBox3 }
            select new ActionBlock <int>(milliseconds =>
            {
                // Toggle the check box to the checked state.
                toggleCheckBox.Post(checkBox);

                // Perform the read action. For demonstration, suspend the current
                // thread to simulate a lengthy read operation.
                Thread.Sleep(milliseconds);

                // Toggle the check box to the unchecked state.
                toggleCheckBox.Post(checkBox);
            },
                                         new ExecutionDataflowBlockOptions
            {
                TaskScheduler = taskSchedulerPair.ConcurrentScheduler
            });

            // Create an ActionBlock<int> object for the writer CheckBox object.
            // This ActionBlock<int> object represents an action that writes to
            // a resource, but cannot run in parallel to readers.
            // Specifying the exclusive part of the scheduler pair enables the
            // writer to run in exclusively with respect to other actions that are
            // managed by the scheduler pair.
            var writerAction = new ActionBlock <int>(milliseconds =>
            {
                // Toggle the check box to the checked state.
                toggleCheckBox.Post(checkBox4);

                // Perform the write action. For demonstration, suspend the current
                // thread to simulate a lengthy write operation.
                Thread.Sleep(milliseconds);

                // Toggle the check box to the unchecked state.
                toggleCheckBox.Post(checkBox4);
            },
                                                     new ExecutionDataflowBlockOptions
            {
                TaskScheduler = taskSchedulerPair.ExclusiveScheduler
            });

            // Link the broadcaster to each reader and writer block.
            // The BroadcastBlock<T> class propagates values that it
            // receives to all connected targets.
            foreach (var readerAction in readerActions)
            {
                broadcaster.LinkTo(readerAction);
            }
            broadcaster.LinkTo(writerAction);

            // Start the timer.
            timer1.Start();
        }
Esempio n. 55
0
    private void RecordPauseButton_Click(object sender, RoutedEventArgs e)
    {
        WebcamControl.Capture.PrepareCapture();

        if (Stage == RecorderStages.Stopped)
        {
            #region To Record

            _timer = new Timer {
                Interval = 1000 / FpsNumericUpDown.Value
            };

            Project = new ProjectInfo().CreateProjectFolder(ProjectByType.WebcamRecorder);

            RefreshButton.IsEnabled        = false;
            VideoDevicesComboBox.IsEnabled = false;
            FpsNumericUpDown.IsEnabled     = false;
            Topmost = true;

            //WebcamControl.Capture.GetFrame();

            #region Start - Normal or Snap

            if (UserSettings.All.CaptureFrequency != CaptureFrequencies.Manual)
            {
                #region Normal Recording

                _timer.Tick += Normal_Elapsed;
                Normal_Elapsed(null, null);
                _timer.Start();

                Stage = RecorderStages.Recording;

                #endregion
            }
            else
            {
                #region SnapShot Recording

                Stage = RecorderStages.Snapping;
                Title = "ScreenToGif - " + LocalizationHelper.Get("S.Recorder.Snapshot");

                Normal_Elapsed(null, null);

                #endregion
            }

            #endregion

            #endregion
        }
        else if (Stage == RecorderStages.Recording)
        {
            #region To Pause

            Stage = RecorderStages.Paused;
            Title = LocalizationHelper.Get("S.Recorder.Paused");

            DiscardButton.BeginStoryboard(FindResource("ShowDiscardStoryboard") as Storyboard, HandoffBehavior.Compose);

            _timer.Stop();

            #endregion
        }
        else if (Stage == RecorderStages.Paused)
        {
            #region To Record Again

            Stage = RecorderStages.Recording;
            Title = "ScreenToGif";

            _timer.Start();

            #endregion
        }
        else if (Stage == RecorderStages.Snapping)
        {
            #region Take Screenshot

            Normal_Elapsed(null, null);

            #endregion
        }
    }
Esempio n. 56
0
 private void textBox_To_Enter(object sender, EventArgs e) // To has been tabbed/clicked..
 {
     SelectToMaster(false);                                // enable system box
     toupdatetimer.Stop();
     toupdatetimer.Start();
 }
Esempio n. 57
0
 private void süreBaslat()
 {
     gecenSüreTimer.Interval = 1000;
     gecenSüreTimer.Tick    += saniyeBasiIslem;
     gecenSüreTimer.Start();
 }
        private void btn_changepassword_Click(object sender, EventArgs e)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = con.Open();
            cmd.CommandText = "SELECT username FROM Admin " +
                              "WHERE username = '******' AND password = '******'";
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                username = dr[0].ToString();
            }
            con.Close();

            SqlCommand cmd2 = new SqlCommand();

            cmd2.Connection  = con.Open();
            cmd2.CommandText = "SELECT password FROM Admin " +
                               "WHERE username = '******' AND password = '******'";
            SqlDataReader dr2 = cmd2.ExecuteReader();

            while (dr2.Read())
            {
                password = dr2[0].ToString();
            }
            cmd2.Dispose();
            con.Close();

            if (txt_username.Text == "" && txt_oldpassword.Text != "")
            {
                lbl_message.Visible       = true;
                lbl_message.ForeColor     = Color.Red;
                this.lbl_message.Location = new System.Drawing.Point(179, 299);
                lbl_message.Text          = "Kullanıcı adınızı girmediniz.\nLütfen kullanıcı adınızı giriniz.";
            }
            if (txt_username.Text != "" && txt_oldpassword.Text == "")
            {
                this.lbl_message.Location = new System.Drawing.Point(201, 299);
                lbl_message.Visible       = true;
                lbl_message.ForeColor     = Color.Red;
                lbl_message.Text          = "Şifrenizi girmediniz.\nLütfen şifrenizi giriniz.";
            }

            if (live > 0)
            {
                if (username != txt_username.Text && password != txt_oldpassword.Text)
                {
                    this.btn_changepassword.Location = new System.Drawing.Point(257, 337);
                    live--;
                    lbl_message.Visible       = true;
                    lbl_message.ForeColor     = Color.Red;
                    this.lbl_message.Location = new System.Drawing.Point(160, 289);
                    lbl_message.Text          = "Kullanıcı adınızı ya da şifrenizi yanlış\ngirdiniz." +
                                                "" + live.ToString() + " hakkınız kaldı." +
                                                "\nLütfen tekrar deneyiniz.";
                }
                if (username == txt_username.Text && password == txt_oldpassword.Text)
                {
                    if (string.IsNullOrWhiteSpace(txt_newpassword.Text) || string.IsNullOrWhiteSpace(txt_newpassword2.Text))
                    {
                        lbl_message.Visible   = true;
                        lbl_message.ForeColor = Color.Red;
                        lbl_message.Text      = "Boşluk kullanmayınız.\nLütfen tekrar deneyiniz.";
                        return;
                    }
                    else if (txt_newpassword.Text == txt_newpassword2.Text && txt_oldpassword.Text != txt_newpassword.Text && txt_oldpassword.Text != txt_newpassword2.Text)
                    {
                        SqlCommand cmd3 = new SqlCommand();
                        cmd3.Connection  = con.Open();
                        cmd3.CommandText = "UPDATE Admin SET password = '******' " +
                                           "WHERE username = '******'";
                        cmd3.ExecuteNonQuery();
                        cmd3.Dispose();
                        con.Close();
                        this.lbl_message.Location = new System.Drawing.Point(175, 289);
                        lbl_message.Visible       = true;
                        lbl_message.ForeColor     = Color.Green;
                        lbl_message.Text          = "Kullanıcı adı : " + txt_username.Text + "\n Şifre başarıyla güncellendi.\nGiriş Ekranına Yönlendiriliyorsunuz.";
                        tmr       = new System.Windows.Forms.Timer();
                        tmr.Tick += delegate
                        {
                            FrmLogin form = new FrmLogin();
                            form.Show();
                            this.Hide();
                            tmr.Stop();
                        };
                        tmr.Interval = (int)TimeSpan.FromSeconds(3).TotalMilliseconds;
                        tmr.Start();
                    }
                    if (txt_newpassword.Text != txt_newpassword2.Text)
                    {
                        this.lbl_message.Location = new System.Drawing.Point(201, 299);
                        lbl_message.Visible       = true;
                        lbl_message.ForeColor     = Color.Red;
                        lbl_message.Text          = "Girdiğiniz şifreler farklıdır. \nLütfen tekrar deneyiniz.";
                    }
                    if (txt_oldpassword.Text == txt_newpassword.Text || txt_newpassword2.Text == txt_oldpassword.Text)
                    {
                        this.lbl_message.Location = new System.Drawing.Point(161, 289);
                        lbl_message.Visible       = true;
                        lbl_message.ForeColor     = Color.Red;
                        lbl_message.Text          = "Mevcut şifreniz ile aynı şifre girdiniz. \nLütfen tekrar deneyiniz.";
                    }
                }
            }
            if (live == 0)
            {
                MessageBox.Show("Üst üste 3 kere geçersiz kullanıcı adı veya \nşifre girdiğiniz için uygulama kapanıyor. \nLütfen tekrar deneyin."
                                , "Bilgi Paneli", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Application.Exit();
            }
        }
Esempio n. 59
0
        public Main(string[] cmdlineArgs, KSPManager mgr, GUIUser user, bool showConsole)
        {
            log.Info("Starting the GUI");
            commandLineArgs = cmdlineArgs;

            manager     = mgr ?? new KSPManager(user);
            currentUser = user;

            controlFactory = new ControlFactory();
            Instance       = this;
            mainModList    = new MainModList(source => UpdateFilters(this), TooManyModsProvide, user);

            // History is read-only until the UI is started. We switch
            // out of it at the end of OnLoad() when we call NavInit().
            navHistory = new NavigationHistory <GUIMod> {
                IsReadOnly = true
            };

            InitializeComponent();

            // Replace mono's broken, ugly toolstrip renderer
            if (Platform.IsMono)
            {
                menuStrip1.Renderer = new FlatToolStripRenderer();
                menuStrip2.Renderer = new FlatToolStripRenderer();
                fileToolStripMenuItem.DropDown.Renderer     = new FlatToolStripRenderer();
                settingsToolStripMenuItem.DropDown.Renderer = new FlatToolStripRenderer();
                helpToolStripMenuItem.DropDown.Renderer     = new FlatToolStripRenderer();
                FilterToolButton.DropDown.Renderer          = new FlatToolStripRenderer();
                this.minimizedContextMenuStrip.Renderer     = new FlatToolStripRenderer();
            }

            // We need to initialize the error dialog first to display errors.
            errorDialog = controlFactory.CreateControl <ErrorDialog>();

            // We want to check if our current instance is null first,
            // as it may have already been set by a command-line option.
            if (CurrentInstance == null && manager.GetPreferredInstance() == null)
            {
                Hide();

                var result = new ChooseKSPInstance(!actuallyVisible).ShowDialog();
                if (result == DialogResult.Cancel || result == DialogResult.Abort)
                {
                    Application.Exit();
                    return;
                }
            }

            configuration = Configuration.LoadOrCreateConfiguration
                            (
                Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml")
                            );

            // Check if there is any other instances already running.
            // This is not entirely necessary, but we can show a nicer error message this way.
            try
            {
#pragma warning disable 219
                var lockedReg = RegistryManager.Instance(CurrentInstance).registry;
#pragma warning restore 219
            }
            catch (RegistryInUseKraken kraken)
            {
                errorDialog.ShowErrorDialog(kraken.ToString());
                return;
            }

            FilterToolButton.MouseHover           += (sender, args) => FilterToolButton.ShowDropDown();
            launchKSPToolStripMenuItem.MouseHover += (sender, args) => launchKSPToolStripMenuItem.ShowDropDown();
            ApplyToolButton.MouseHover            += (sender, args) => ApplyToolButton.ShowDropDown();

            ModList.CurrentCellDirtyStateChanged += ModList_CurrentCellDirtyStateChanged;
            ModList.CellValueChanged             += ModList_CellValueChanged;

            tabController = new TabController(MainTabControl);
            tabController.ShowTab("ManageModsTabPage");

            RecreateDialogs();

            if (!showConsole)
            {
                Util.HideConsoleWindow();
            }

            // Disable the modinfo controls until a mod has been choosen. This has an effect if the modlist is empty.
            ActiveModInfo = null;

            // WinForms on Mac OS X has a nasty bug where the UI thread hogs the CPU,
            // making our download speeds really slow unless you move the mouse while
            // downloading. Yielding periodically addresses that.
            // https://bugzilla.novell.com/show_bug.cgi?id=663433
            if (Platform.IsMac)
            {
                var timer = new Timer {
                    Interval = 2
                };
                timer.Tick += (sender, e) => { Thread.Yield(); };
                timer.Start();
            }

            // Set the window name and class for X11
            if (Platform.IsX11)
            {
                HandleCreated += (sender, e) => X11.SetWMClass("CKAN", "CKAN", Handle);
            }

            Application.Run(this);

            var registry = RegistryManager.Instance(Manager.CurrentInstance);
            registry?.Dispose();
        }
Esempio n. 60
0
    /// <summary>
    /// Method that starts or pauses the recording
    /// </summary>
    private void RecordPause()
    {
        switch (Stage)
        {
        case RecorderStages.Stopped:

            #region To Record

            _capture = new Timer {
                Interval = 1000 / FpsNumericUpDown.Value
            };

            Project?.Clear();
            Project = new ProjectInfo().CreateProjectFolder(ProjectByType.BoardRecorder);

            HeightIntegerBox.IsEnabled = false;
            WidthIntegerBox.IsEnabled  = false;
            FpsNumericUpDown.IsEnabled = false;

            IsRecording = true;
            Topmost     = true;

            FrameRate.Start(_capture.Interval);

            #region Start

            //if (!Settings.Default.Snapshot)
            //{
            #region Normal Recording

            _capture.Tick += Normal_Elapsed;
            //Normal_Elapsed(null, null);
            _capture.Start();

            Stage = RecorderStages.Recording;

            AutoFitButtons();

            #endregion
            //}
            //else
            //{
            //    #region SnapShot Recording

            //    Stage = Stage.Snapping;
            //    //Title = "Board Recorder - " + Properties.Resources.Con_SnapshotMode;

            //    AutoFitButtons();

            //    #endregion
            //}

            break;

            #endregion

            #endregion

        case RecorderStages.Recording:

            #region To Pause

            Stage = RecorderStages.Paused;
            Title = LocalizationHelper.Get("S.Recorder.Paused");

            AutoFitButtons();

            _capture.Stop();

            FrameRate.Stop();
            break;

            #endregion

        case RecorderStages.Paused:

            #region To Record Again

            Stage = RecorderStages.Recording;
            Title = LocalizationHelper.Get("S.Board.Title");

            AutoFitButtons();

            FrameRate.Start(_capture.Interval);

            _capture.Start();
            break;

            #endregion

        case RecorderStages.Snapping:

            #region Take Screenshot (All possibles types)

            Normal_Elapsed(null, null);

            break;

            #endregion
        }
    }