public void RemoveDependency(IRefreshable refreshable) { if (refreshable != null) { dependencies.Remove(refreshable); } }
private void cmdSave_Click(object sender, EventArgs e) { if (lv.SelectedItems.Count == 0) { MessageBox.Show("Please Choose the Prize"); return; } string fileName = lv.SelectedItems[0].Tag.ToString(); fileName = fileName + ".csv"; string currentNo = txtCar_1.Text.Trim() + txtCar_2.Text.Trim() + txtCar_3.Text.Trim() + txtCar_4.Text.Trim() + txtCar_5.Text.Trim() + txtCar_6.Text.Trim(); BackEnd.SaveAll(currentNo, "AllPrizes.csv", lv.SelectedItems[0].Tag.ToString());//Save for all prizes BackEnd.Save(currentNo, fileName); foreach (Control c in this.Controls) { if (c is IRefreshable && c is WinnerBox) { WinnerBox wb = (WinnerBox)c; wb.FileName = wb.Tag.ToString() + ".csv"; IRefreshable iRefresh = (IRefreshable)wb; iRefresh.IRefresh(); } } this.frmDraw.LoadWinningNos(); MessageBox.Show("Saving Successfull"); Clear(); }
public void SetData(IRefreshable owner, Repository repository, MetaType metaType) { this.owner = owner; this.repository = repository; this.type = metaType; this.setupLayout(); }
private void trvDBList_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e) { IRefreshable r = null; if (e.Button != System.Windows.Forms.MouseButtons.Left || (r = e.Node as IRefreshable) == null) { return; } var dbconn = GetRootParent(e.Node) as IDBConnect; if (e.Node.Nodes.Count == 0) { if (!dbconn.IsOpened) { try { if (!dbconn.CheckLogin()) { return; } dbconn.Connect(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message + (ex.InnerException != null ? " : " + ex.InnerException.Message : "")); return; } } r.Refresh(); } e.Node.Expand(); }
public void Add(IRefreshable listener) { if (!_listeners.Contains(listener)) { _listeners.Add(listener); } }
private void btnDisconnect_Click(object sender, EventArgs e) { if (ConnectionParams.Instance.Status != LoginStatus.Connected) { return; } Cursor.Current = Cursors.WaitCursor; KeepAliveThread.CancelAsync(); _wait.Set(); _LoginDlg.LogOut(); UpdateStatus(); foreach (TabPage tp in this.tcConsole.TabPages) { IRefreshable control = tp.Tag as IRefreshable; if (control != null) { control.OnDisconnect(); } } Cursor.Current = Cursors.Default; }
private void miConnect_Click(object sender, EventArgs e) { if (_login_dlg == null) { return; } while (_login_dlg.ShowDialog() == DialogResult.OK) { if (_login_dlg.Login()) { this.statusBar.Text = "Connected"; IRefreshable control = this.tabControl.TabPages[this.tabControl.SelectedIndex].Tag as IRefreshable; if (control != null) { control.Refresh(); } break; } this.statusBar.Text = "Disconnected"; switch (ConnectionParams.Instance.Status) { case LoginStatus.ConnectionDenied: MessageBox.Show("Connection Denied. Change your credentials."); break; case LoginStatus.ServerDown: MessageBox.Show("EIB Server is not responding."); break; } } }
/// <summary>Add a dependency to be refreshed first when the encapsulating object does.</summary> public void AddDependency(IRefreshable refreshable) { if (refreshable != null) { dependencies.Add(refreshable); } }
private void miRefresh_Click(object sender, EventArgs e) { IRefreshable control = this.tabControl.TabPages[this.tabControl.SelectedIndex].Tag as IRefreshable; if (control != null) { control.Refresh(); } }
/// <summary> /// Makes the caller wait until the dependency has been refreshed and ready to catch another event - if that is supports the refresh model. /// </summary> /// <param name="timeout"></param> /// <returns></returns> public bool WaitForRefresh(int?timeout = null) { IRefreshable refreshableTrigger = _trigger as IRefreshable; if (refreshableTrigger != null) { return(refreshableTrigger.WaitForRefresh(timeout)); } throw new Exception("WaitForRefresh not supported because this Dependency's Trigger does not inherit from IRefreshable."); }
public ValueList() { InitializeComponent(); this.owner = null; this.repository = null; this.type = null; this.listValues = null; this.Enabled = false; this.refreshing = false; }
public override void DoRefresh(IRefreshable refreshableDataSource, IProgress progress) { ISupportFastRefresh supportFastRefresh = refreshableDataSource as ISupportFastRefresh; if (supportFastRefresh == null) { throw new InvalidOperationException(); } supportFastRefresh.Refresh(progress, this.identities, 0); }
/// <summary> /// Adds the specified {@link Refreshable} to the given collection of {@link Refreshable}s if it is not /// already there and immediately refreshes it. /// </summary> /// <param name="alreadyRefreshed">the collection of <see cref="IRefreshable"/>s</param> /// <param name="refreshable">the <see cref="IRefreshable"/> to potentially add and refresh</param> public static void MaybeRefresh(IList <IRefreshable> alreadyRefreshed, IRefreshable refreshable) { if (!alreadyRefreshed.Contains(refreshable)) { alreadyRefreshed.Add(refreshable); log.Info("Added refreshable: {}", refreshable); refreshable.Refresh(alreadyRefreshed); log.Info("Refreshed: {}", alreadyRefreshed); } }
public VariableList() { InitializeComponent(); this.owner = null; this.repository = null; this.type = null; this.value = null; this.valueControls = new List<Control>(); this.refreshing = false; this.Enabled = false; }
public void SetData(IRefreshable owner, Repository repository, MetaType metaType, MetaList <MetaValue> metaValues, int index = 0) { this.owner = owner; this.repository = repository; this.type = metaType; this.listValues = metaValues; this.vlVariables.ClearData(); this.vlVariables.SetData(this, this.repository, this.type); this.vlVariables.SetValue(this.listValues.Count > 0 ? this.listValues[0] : null); this.lbValues.SelectedIndex = index; }
public VariableList() { InitializeComponent(); this.owner = null; this.repository = null; this.type = null; this.value = null; this.valueControls = new List <Control>(); this.refreshing = false; this.Enabled = false; }
public ValueDictionary() { InitializeComponent(); this.owner = null; this.repository = null; this.type1 = null; this.type2 = null; this.dictionaryKeys = null; this.dictionaryValues = null; this.Enabled = false; this.refreshing = false; }
public void SetData(IRefreshable owner, Repository repository, MetaType metaType1, MetaType metaType2, MetaDictionary <MetaValue, MetaValue> metaValues) { this.owner = owner; this.repository = repository; this.type1 = metaType1; this.type2 = metaType2; this.dictionaryKeys = metaValues.GetKeys(); this.dictionaryValues = metaValues.GetValues(this.dictionaryKeys); this.vlVariables.ClearData(); this.vlVariables.SetData(this, this.repository, this.type2); this.vlVariables.SetValue(this.dictionaryValues.Count > 0 ? this.dictionaryValues[0] : null); }
private void LoadWinningNos() { foreach (Control c in this.Controls) { if (c is IRefreshable && c is WinnerBox) { WinnerBox wb = (WinnerBox)c; wb.FileName = wb.Tag.ToString() + ".csv"; IRefreshable iRefresh = (IRefreshable)wb; iRefresh.IRefresh(); } } }
private void btnRefresh_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; //do the refresh here... IRefreshable control = this.tcConsole.SelectedTab.Tag as IRefreshable; if (control != null) { control.Refresh(); } Cursor.Current = Cursors.Default; }
public override void DoRefresh(IRefreshable refreshableDataSource, IProgress progress) { ISupportFastRefresh supportFastRefresh = refreshableDataSource as ISupportFastRefresh; if (supportFastRefresh == null) { throw new InvalidOperationException(); } supportFastRefresh.Remove(base.ObjectIdentity); if (progress != null) { progress.ReportProgress(100, 100, ""); } }
public void StartRefresh() { this.IsRefreshing = true; IRefreshable refreshable = this.refreshableSources[this.currentDataSourceIndex]; if (refreshable is IRefreshableNotification) { (refreshable as IRefreshableNotification).RefreshingChanged += this.RefreshableNotification_RefreshingChanged; refreshable.Refresh(this); return; } refreshable.Refresh(NullProgress.Value); this.ReportProgress(100, 100, ""); this.RefreshNextDataSource(); }
private DataContext GetDataContextForRefresh(WizardForm wizardForm, IRefreshable defaultRefreshObject) { WizardPage wizardPage = wizardForm.WizardPages[wizardForm.WizardPages.Count - 1]; DataContext context = wizardPage.Context; if (wizardForm.RefreshOnFinish != null) { context.RefreshOnSave = wizardForm.RefreshOnFinish; } else { context.RefreshOnSave = (context.RefreshOnSave ?? defaultRefreshObject); } return(context); }
public void Cancel() { if (this.IsRefreshing && this.currentDataSourceIndex < this.refreshableSources.Count) { IRefreshable refreshable = this.refreshableSources[this.currentDataSourceIndex]; if (refreshable is RefreshableComponent) { (refreshable as RefreshableComponent).CancelRefresh(); } if (refreshable is IRefreshableNotification) { (refreshable as IRefreshableNotification).RefreshingChanged -= this.RefreshableNotification_RefreshingChanged; } this.cancelled = true; this.IsRefreshing = false; } }
private void KeepAliveThread_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if ((bool)e.Result) { return; } UpdateStatus(); MessageBox.Show("EIB Server is not responding. Please Reconnect.", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); foreach (TabPage tp in this.tcConsole.TabPages) { IRefreshable control = tp.Tag as IRefreshable; if (control != null) { control.OnDisconnect(); } } }
private void btnConnect_Click(object sender, EventArgs e) { while (_LoginDlg.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; _LoginDlg.Login(); Cursor.Current = Cursors.Default; UpdateStatus(); if (ConnectionParams.Instance.Status == LoginStatus.ConnectionDenied) { DialogResult result = MessageBox.Show("Cannot connect to EIB Server (Incorrect User name or Password)\n Do you want to try again?", "Connection Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { continue; } if (result == DialogResult.No) { break; } } else if (ConnectionParams.Instance.Status == LoginStatus.ServerDown) { DialogResult result = MessageBox.Show("Cannot connect to EIB Server (no response from EIB Sever)\n Do you want to try again?", "Connection Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { continue; } if (result == DialogResult.No) { break; } } else if (ConnectionParams.Instance.Status == LoginStatus.Connected) { IRefreshable tab = this.tcConsole.SelectedTab.Tag as IRefreshable; tab.Refresh(); _wait = new ManualResetEvent(false); this.KeepAliveThread.RunWorkerAsync(); break; } } }
/// <summary> /// Will throw if timeout is exceeded. /// </summary> /// <param name="refreshing"></param> /// <param name="condition"></param> /// <param name="timeout"></param> /// <returns></returns> public static async Task RefreshBasedPollingWithTimeoutAsync(IRefreshable refreshing, Func <Task <bool> > condition, TimeSpan timeout) { DateTime allocationWaitStartTime = DateTime.UtcNow; DateTime timeoutAfterThisTimeUtc = allocationWaitStartTime.Add(timeout); while (!(await condition().ConfigureAwait(continueOnCapturedContext: false))) { await Task.Delay(TimeSpan.FromSeconds(10)).ConfigureAwait(continueOnCapturedContext: false); await refreshing.RefreshAsync().ConfigureAwait(continueOnCapturedContext: false); if (DateTime.UtcNow > timeoutAfterThisTimeUtc) { throw new Exception("RefreshBasedPollingWithTimeout: Timed out waiting for condition to be met."); } } }
private void exchangeScopeNode_Refreshing(object sender, EventArgs e) { ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeFormView>(0L, "-->ExchangeFormView.ScopeNodeRefreshing: {0}", this); IRefreshable refreshableDataSource = this.ResultPane.RefreshableDataSource; IRefreshable dataSource = ((ExchangeScopeNode)base.ScopeNode).DataSource; if (refreshableDataSource != null && refreshableDataSource != dataSource && this.ResultPane.RefreshCommand.Enabled) { ExTraceGlobals.ProgramFlowTracer.TraceDebug <string, string>(0L, "ExchangeFormView.ScopeNodeRefreshing: refreshing result pane {0} since its data source doesn't match the one in scope node {1}.", base.Control.Name, base.ScopeNode.LanguageIndependentName); this.ResultPane.RefreshCommand.Invoke(); } else { ExTraceGlobals.ProgramFlowTracer.TraceDebug <string, string>(0L, "ExchangeFormView.ScopeNodeRefreshing: no need to refresh result pane {0} when scope node {1} is refreshed.", base.Control.Name, base.ScopeNode.LanguageIndependentName); } ExTraceGlobals.ProgramFlowTracer.TraceFunction <ExchangeFormView>(0L, "<--ExchangeFormView.ScopeNodeRefreshing: {0}", this); }
public static async Task RefreshAsync(this IRefreshable self) { var invokeResult = default(bool?); self.Refresh( () => invokeResult = true, () => invokeResult = false); while (!invokeResult.HasValue) { await Task.Delay(MillisecondsDelay); } if (!invokeResult.Value) { throw new InvalidOperationException(); } }
private void ShellFrame_Navigated(object sender, NavigationEventArgs e) { if (NavigationDictionary.ContainsValue(ShellFrame.CurrentSourcePageType)) { RadioButton rb = NavigationDictionary.FirstOrDefault(x => x.Value == ShellFrame.CurrentSourcePageType).Key as RadioButton; rb.IsChecked = true; if (ShellFrame.CanGoBack) { ShellFrame.BackStack.Clear(); } } IRefreshable vm = (ShellFrame.Content as Page).DataContext as IRefreshable; VM.CurrentViewModel = vm; UpdateAppViewBackButtonVisibility(ShellFrame); }
private void PerformRefreshOnFinish(WorkUnitCollection workUnits, IRefreshable singleRefresh, IRefreshable[] multiRefresh) { if (workUnits.IsDataChanged) { if (singleRefresh != null) { singleRefresh.Refresh(this.CreateProgress(base.Command.Text)); } if (multiRefresh != null) { MultiRefreshableSource multiRefreshableSource = new MultiRefreshableSource(); for (int i = 0; i < workUnits.Count; i++) { if (workUnits[i].Status != WorkUnitStatus.NotStarted) { multiRefreshableSource.RefreshableSources.Add(multiRefresh[i]); } } multiRefreshableSource.Refresh(this.CreateProgress(base.Command.Text)); } } }
public void SetData(IRefreshable owner, Repository repository, MetaType metaType1, MetaType metaType2, MetaDictionary<MetaValue, MetaValue> metaValues) { this.owner = owner; this.repository = repository; this.type1 = metaType1; this.type2 = metaType2; this.dictionaryKeys = metaValues.GetKeys(); this.dictionaryValues = metaValues.GetValues(this.dictionaryKeys); this.vlVariables.ClearData(); this.vlVariables.SetData(this, this.repository, this.type2); this.vlVariables.SetValue(this.dictionaryValues.Count > 0 ? this.dictionaryValues[0] : null); }
/// <summary> /// Adds the specified {@link Refreshable} to the given collection of {@link Refreshable}s if it is not /// already there and immediately refreshes it. /// </summary> /// <param name="alreadyRefreshed">the collection of <see cref="IRefreshable"/>s</param> /// <param name="refreshable">the <see cref="IRefreshable"/> to potentially add and refresh</param> public static void MaybeRefresh(IList<IRefreshable> alreadyRefreshed, IRefreshable refreshable) { if (!alreadyRefreshed.Contains(refreshable)) { alreadyRefreshed.Add(refreshable); log.Info("Added refreshable: {}", refreshable); refreshable.Refresh(alreadyRefreshed); log.Info("Refreshed: {}", alreadyRefreshed); } }
public void SetData(IRefreshable owner, Repository repository, MetaType metaType, MetaList<MetaValue> metaValues, int index = 0) { this.owner = owner; this.repository = repository; this.type = metaType; this.listValues = metaValues; this.vlVariables.ClearData(); this.vlVariables.SetData(this, this.repository, this.type); this.vlVariables.SetValue(this.listValues.Count > 0 ? this.listValues[0] : null); this.lbValues.SelectedIndex = index; }
protected override void Before_each_spec() { _presenter = new ExampleWidgetPresenter(); _childPresenter1 = Mock<IRefreshable>(); _childPresenter2 = Mock<IRefreshable>(); }