/// <summary> /// Creates a new StatusBarProgressPanel /// </summary> public StatusBarProgressPanel() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); _drawEventRegistered = false; _animationStyle = ProgressDisplayStyle.Infinite; _currentPosition = 0; _stepSize = 10; _startPoint = 0; _endPoint = 100; _showText = true; _textFont = new Font("Arial", 8); _textBrush = SystemBrushes.ControlText; //_progressBrush = SystemBrushes.Highlight; //_progressBrush = new System.Drawing.Drawing2D.LinearGradientBrush( // new Rectangle(new Point(0,0), new Size(20, 10)), Color.Red, Color.Yellow, LinearGradientMode.Vertical); //System.IO.Stream imageStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Prometheus.bomb.png"); System.IO.Stream imageStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Prometheus.progress_bar.gif"); Image img = new Bitmap(imageStream); _progressBrush = new System.Drawing.TextureBrush(img); _increasing = true; _animationTick = TimeSpan.FromSeconds(0.5); InitializeAnimationThread(); _refreshDelegate = new RefreshDelegate(this.Refresh); }
public frmDeleteUserType(RefreshDelegate refreshDelegate) { InitializeComponent(); this.refreshDelegate = refreshDelegate; factory = new ServiceFactory(); userTypeService = factory.GetUserTypeServiceInstance(); }
public frmDeleteCategory(RefreshDelegate refreshDelegate) { InitializeComponent(); this.refreshDelegate = refreshDelegate; factory = new ServiceFactory(); categoryService = factory.GetCategoryServiceInstance(); }
public CacheItem(TimeSpan cacheSpan, T objectToCache, RefreshDelegate del) { base.CacheDate = DateTime.Now; base.CacheLength = cacheSpan; this.BaseItem = objectToCache; this.RefreshMethod = del; }
public void Apply() { Results = string.Empty; _applied = false; IEnumerable selectedAgents = GetSelectedAgents(EmployeeSelectionWay == 1).ForEach <IAgent>(o => { var timeBox = o.Schedule; timeBox.Create(Term.New(EventStart, SelectedEventType, EventLength), (t, success) => { if (success) { ((Term)t).Tag = Comments; _applied = true; } o.OperationFail = !success; }, false); }); if (RefreshDelegate != null) { RefreshDelegate.Invoke(selectedAgents, _applied); } //if (ReloadAgentDelegate != null) // SelectedAgents = ReloadAgentDelegate(); }
public CacheItem(int cacheTimeInMinutes, RefreshDelegate del) { base.CacheLength = new TimeSpan(0, cacheTimeInMinutes, 0); this.BaseItem = del(); this.RefreshMethod = del; base.CacheDate = DateTime.Now; }
public void Refresh() { RefreshDelegate d = new RefreshDelegate(refreshMap); if (Frame != null && Frame.Created) { Frame.Invoke(d); } }
public Dashboard() { InitializeComponent(); timer1.Start(); txtPassword.PasswordChar = '*'; txtConPassword.PasswordChar = '*'; refreshDelegate = this.RefreshDataGridView; this.ShowDataGridView(); }
private void RefreshOrderButton() { RefreshDelegate refresh = () => { btnIJ.BackColor = btnIJ.Enabled == true ? (btnIJ.Text == CurrentOrder ? Color.GreenYellow : Color.WhiteSmoke) : Color.Red; }; this.Invoke(refresh); }
private void ConnectCallback() { RefreshDelegate refresh = () => { btnConnect.Text = "Connected(已连接)"; btnOffer.Enabled = true; }; this.Invoke(refresh); }
/// <summary> /// Constructs a new ChangeViewForm class. /// </summary> public StyleLibraryForm(MapObjectHolder target) { InitializeComponent(); isTextValidating = false; refresh = new RefreshDelegate(this.Refresh); isInit = true; isInitStyleLibText = true; // saving the reference to the base mapObj // In certain cases we require to reload the modified symbolset on the base mapfile too. this.target = target; this.map = target; }
public static void Refresh(RefreshDelegate block) { block(RemoveList.Count == 0); RemoveList.ForEach((HHObjectItem item)=>{ item.Container.TopTopDown(); NGUITools.Destroy(item.gameObject); }); RemoveList.Clear(); }
private void RefreshOfferTable() { RefreshDelegate refresh = () => { Global.PlaySound(); dglOffer.DataSource = GetOfferTable(); if (!this.TopMost) { MainPage.TimerIcon.Start(); } }; this.Invoke(refresh); }
internal MazeViewer(MazeDomain maze) { InitializeComponent(); m_mdMaze = maze; Size = new Size(m_mdMaze.Width * SCALE + 50, 100 + (m_mdMaze.Height + 3) * SCALE); MazePictureBox.Size = new Size(m_mdMaze.Width * SCALE, (m_mdMaze.Height + 3) * SCALE); RefreshForm = new RefreshDelegate(RefreshFormMethod); HideForm = new HideDelegate(HideFormMethod); CurrentState = null; SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint, true); Active = false; m_bThreadRunning = false; CurretnUpdateState = null; }
private void ErrorCallback(Exception ex) { RefreshDelegate refresh = () => { btnConnect.Text = "Disconnect(未连接)"; btnOffer.Enabled = false; Connect(); }; if (!Return) { this.Invoke(refresh); } }
internal RaceViewer(RaceTrack rt) { InitializeComponent(); m_rtTrack = rt; Size = new Size(m_rtTrack.Width * SCALE + 50, 100 + m_rtTrack.Height * SCALE); TrackPictureBox.Size = new Size(m_rtTrack.Width * SCALE, m_rtTrack.Height * SCALE); RefreshForm = new RefreshDelegate(RefreshFormMethod); HideForm = new HideDelegate(HideFormMethod); CarState = null; StateValues = null; SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint, true); Active = false; m_bThreadRunning = false; CurretnUpdateState = null; }
private void InitMainTable() { LoadCurrentFile(); dglMain.DataSource = MainTable.Copy(); Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(() => { RefreshDelegate refresh = () => { LoadCurrentFile(); dglMain.DataSource = MainTable.Copy(); }; this.Invoke(refresh); })); thread.Start(); }
public StatusBarProgressPanel() { this.InitializeComponent(); this._drawEventRegistered = false; this._animationStyle = ProgressDisplayStyle.Infinite; this._currentPosition = 0L; this._stepSize = 10L; this._startPoint = 0L; this._endPoint = 100L; this._showText = true; this._textFont = new Font("Arial", 8f); this._textBrush = SystemBrushes.ControlText; this._progressBrush = SystemBrushes.Highlight; this._increasing = true; this._animationTick = TimeSpan.FromSeconds(0.5); this.InitializeAnimationThread(); this._refreshDelegate = new RefreshDelegate(this.Refresh); }
public Window1() { InitializeComponent(); m_ImageCore = new ImageCore(); dSViewer1.Bind(m_ImageCore); m_CameraManager = new CameraManager(m_StrProductKey); this.cbxSources.SelectionChanged += cbxSources_SelectionChanged; cbxSources.SelectedIndex = 0; this.Loaded += new RoutedEventHandler(Window1_Loaded); this.cbxSources.SelectionChanged += new SelectionChangedEventHandler(cbxSources_SelectionChanged); btnRotate90.Background = new ImageBrush(new BitmapImage(new Uri(imageDirectory + "90_normal.png", UriKind.RelativeOrAbsolute))); btnRotate180.Background = new ImageBrush(new BitmapImage(new Uri(imageDirectory + "180_normal.png", UriKind.RelativeOrAbsolute))); btnRotate270.Background = new ImageBrush(new BitmapImage(new Uri(imageDirectory + "270_normal.png", UriKind.RelativeOrAbsolute))); m_Refresh += new RefreshDelegate(RefreshImage); m_ControlWindow = Window.GetWindow(image1); }
private void timer_Tick(object sender, EventArgs e) { try { RefreshDelegate refresh = Refresh; Invoke(refresh); if (BaseSystemInfo.Synchronized) { _timer.Stop(); BillPrintHelper.SetSyncTime(); Close(); } } catch (Exception exception) { _timer.Stop(); LogUtil.WriteException(exception); Close(); } }
private void InitialMethod() { factory = new ServiceFactory(); accountService = factory.GetAccountServiceInstance(); categoryService = factory.GetCategoryServiceInstance(); itemService = factory.GetItemServiceInstance(); logService = factory.GetLogServiceInstance(); membershipServece = factory.GetMembershipServiceInstance(); memberTypeService = factory.GetMemberTypeServiceInstance(); offerService = factory.GetOfferServiceInstance(); transactionService = factory.GetTransactionServiceInstance(); userTypeService = factory.GetUserTypeServiceInstance(); AutoCompleteMethodForAccountName(txtSearchUsername); AutoCompleteMethodForItemName(txtSearchItem); AutoCompleteMethodForMember(txtMemberSearch); AutoCompleteMethodForOffer(txtOfferSearch); refreshDelegate = this.RefreshDataGridViewStocks; refreshDelegate = this.RefreshDataGridViewAccount; }
private void initialMethod() { factory = new ServiceFactory(); itemService = factory.GetItemServiceInstance(); accountService = factory.GetAccountServiceInstance(); transactionService = factory.GetTransactionServiceInstance(); membershipService = factory.GetMembershipServiceInstance(); memberTypeService = factory.GetMemberTypeServiceInstance(); offerService = factory.GetOfferServiceInstance(); AutoCompleteMethod(txtItemOrCode); AutoCompleteMethod(txtSearchItem); AutoCompleteMethodForOffer(txtSearchOffer); AutoCompleteMethodForMemBer(textBoxMemberSearch); invoice = new DataTable(); refreshDelegate = this.RefreshDataGridView; }
private void RefreshOrderList() { RefreshDelegate refresh = () => { var department = GetCurrentDepartment(); if (department == null) { dglOrder.DataSource = BlankTable; return; } DataView DV = department.OrderList.DefaultView; DV.Sort = "Status ASC"; department.OrderList = DV.ToTable(); var table = department.OrderList.Copy(); table.Columns.Remove("Guid"); dglOrder.DataSource = table; }; this.Invoke(refresh); }
private void ConnectCallback() { RefreshDelegate refresh = () => { btnConnect.Text = "Connected(已连接)"; btnOffer.Enabled = true; if (tabMain.SelectedTab == tagMain) { tabMain.SelectedTab = tagOffer; Task task = new Task(() => { RefreshDelegate refresh2 = () => { tabMain.SelectedTab = tagMain; }; this.Invoke(refresh2); }); task.Start(); } }; this.Invoke(refresh); }
public frmAddAccount(RefreshDelegate refreshDelegate) { InitializeComponent(); this.refreshDelegate = refreshDelegate; }
/// <summary> /// A special method to refresh the property grid with a new property bag, /// that can be called from other threads than the owner thread. /// </summary> /// <param name="bag">A bag with the right values of the properties</param> private void SetPropertyGrid(PropertyTable bag) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.InvokeRequired) { RefreshDelegate d = new RefreshDelegate(SetPropertyGrid); this.Invoke(d, new object[] { bag }); } else { this.SelectedObject = bag; } }
private MySqlHelper() { this.refreshAll += new RefreshDelegate(delegate () { }); }
public frmAddMember(RefreshDelegate refreshDelegate) { InitializeComponent(); this.refreshDelegate = refreshDelegate; }
public void AddRefreshDelegate(RefreshDelegate refreshDelegate) { refresh += refreshDelegate; OnChange(); }
private void gameloop() { while (!stop) { double[] res = new double[4]; RefreshDelegate refreshDelegate = new RefreshDelegate(refr); while (!snake.isGameOver() && !quit) { System.Threading.Thread.Sleep(100); if (network != null) { double[] gc = snake.getGameCharacteristics(); res = network.propagateToEnd(gc); if (res[0] >= res[1] && res[0] >= res[2] && res[0] >= res[3]) { currentMovement = (int)Keys.Up; } else if (res[1] >= res[0] && res[1] >= res[2] && res[1] >= res[3]) { currentMovement = (int)Keys.Left; } else if (res[2] >= res[0] && res[2] >= res[1] && res[2] >= res[3]) { currentMovement = (int)Keys.Down; } else if (res[3] >= res[0] && res[3] >= res[1] && res[3] >= res[2]) { currentMovement = (int)Keys.Right; } } switch (currentMovement) { case (int)Keys.Up: if (trainByPlay) { gamechars.AddLast(snake.getGameCharacteristics()); labels.AddLast(new double[] { 1.0, 0.0, 0.0, 0.0 }); } snake.moveUp(); break; case (int)Keys.Left: if (trainByPlay) { gamechars.AddLast(snake.getGameCharacteristics()); labels.AddLast(new double[] { 0.0, 1.0, 0.0, 0.0 }); } snake.moveLeft(); break; case (int)Keys.Down: if (trainByPlay) { gamechars.AddLast(snake.getGameCharacteristics()); labels.AddLast(new double[] { 0.0, 0.0, 1.0, 0.0 }); } snake.moveDown(); break; case (int)Keys.Right: if (trainByPlay) { gamechars.AddLast(snake.getGameCharacteristics()); labels.AddLast(new double[] { 0.0, 0.0, 0.0, 1.0 }); } snake.moveRight(); break; } Application.DoEvents(); if (!stop) { this.Invoke(refreshDelegate); } } if (trainByPlay) { MessageBox.Show("Learning ..."); double[][] ar_trainingset = gamechars.ToArray(); double[][] ar_labels = labels.ToArray(); /* * network = new NNDeepBeliefNetwork(new int[] { ar_trainingset[0].Length, 10, 5, 4 }, new int[] { 4, 4 }); * for (int i = 0; i < ((NNDeepBeliefNetwork)network).getUnsupervisedLayerCount(); i++) * { * ((NNDeepBeliefNetwork)network).trainUnsupervised(ar_trainingset, i, 10000, 0.1); * } * ((NNDeepBeliefNetwork)network).trainSupervised(ar_trainingset, ar_labels, 1000, 1.0); */ network = new NNAccordInterface(new int[] { ar_trainingset[0].Length, 10, 5, 4 }); ((NNAccordInterface)network).train(ar_trainingset, ar_labels, 10000, 0.1); /* * network = new NNFeedForwardNetwork(new int[] { ar_trainingset[0].Length, 5, 4 }); * ((NNFeedForwardNetwork)network).randomizeWeights(); * ((NNFeedForwardNetwork)network).train(ar_trainingset, ar_labels, 1000, 1.0f); */ // new FrmNetworkVisualizer(((NNDeepBeliefNetwork)network).getSupervisedNetwork()).Show(); MessageBox.Show("Learning finished. Playing ..."); trainByPlay = false; quit = false; } snake.restart(); } }
public frmAddNewUserType(RefreshDelegate refreshDelegate) { InitializeComponent(); this.refreshDelegate = refreshDelegate; }
public frmAddCategory(RefreshDelegate refreshDelegate) { InitializeComponent(); this.refreshDelegate = refreshDelegate; }
public TextureReader(GraphicsDevice graphicsDevice, Uri textureUri, string cacheFilename, int mipMapLevels, RefreshDelegate refreshMethod) : this(graphicsDevice, textureUri, cacheFilename, mipMapLevels) { //RefreshMethod = refreshMethod; }
private void employeeToolStripMenuItem_Click(object sender, EventArgs e) { plEmployee.Visible = true; refreshDelegate = this.RefreshDataGridView; this.ShowDataGridView(); }