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();
            }
Пример #2
0
        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;
                }
            }
        }
Пример #3
0
        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();
        }
Пример #4
0
        private void miRefresh_Click(object sender, EventArgs e)
        {
            IRefreshable control = this.tabControl.TabPages[this.tabControl.SelectedIndex].Tag as IRefreshable;

            if (control != null)
            {
                control.Refresh();
            }
        }
Пример #5
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);
     }
 }
Пример #6
0
        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;
        }
Пример #7
0
        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;
                }
            }
        }
Пример #8
0
        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();
            }
        }
Пример #9
0
 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));
         }
     }
 }
Пример #10
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);
		}
	}
Пример #11
0
 /// <summary>
 /// Refresh window
 /// </summary>
 /// <param name="window"></param>
 public static void Refresh(IRefreshable window)
 {
     window.Refresh();
 }
Пример #12
0
 public void Execute(object parameter)
 {
     refreshable.Refresh();
 }