Example #1
0
 private void TsbConnectClick(object sender, EventArgs e)
 {
     if (fHelper.AskForConnection("ApplyConnectionToTabs"))
     {
         infoPanel = InformationPanel.GetInformationPanel(this, "Connecting...", 340, 120);
     }
 }
Example #2
0
 private void MainForm_OnRequestConnection(object sender, EventArgs e)
 {
     if (fHelper.AskForConnection(e))
     {
         infoPanel = InformationPanel.GetInformationPanel(this, "Connecting...", 340, 120);
     }
 }
Example #3
0
        public void WorkAsync(Control host, string message, Action <BackgroundWorker, DoWorkEventArgs> work, Action <RunWorkerCompletedEventArgs> callback, Action <ProgressChangedEventArgs> progressChanged, object argument = null, int messageWidth = 340, int messageHeight = 150)
        {
            _infoPanel = InformationPanel.GetInformationPanel(host, message, messageWidth, messageHeight);

            var worker = new BackgroundWorker {
                WorkerReportsProgress = progressChanged != null
            };

            worker.DoWork += (s, e) => work((BackgroundWorker)s, e);

            if (worker.WorkerReportsProgress && progressChanged != null)
            {
                worker.ProgressChanged += (s, e) => progressChanged(e);
            }

            worker.RunWorkerCompleted += (s, e) =>
            {
                if (host.Controls.Contains(_infoPanel))
                {
                    _infoPanel.Dispose();
                    host.Controls.Remove(_infoPanel);
                }
                callback(e);
            };
            worker.RunWorkerAsync(argument);
        }
Example #4
0
        private void ConnectUponApproval(object connectionParameter)
        {
            var info = new ConnectionParameterInfo
            {
                ConnectionParmater = connectionParameter
            };

            fHelper.AskForConnection(info, () => info.InfoPanel = InformationPanel.GetInformationPanel(this, "Connecting...", 340, 120));
        }
Example #5
0
 private void PluginClicked(object sender, EventArgs e)
 {
     if (service == null && MessageBox.Show(this, "Do you want to connect to an organization first?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (fHelper.AskForConnection(sender))
         {
             infoPanel = InformationPanel.GetInformationPanel(this, "Connecting...", 340, 120);
         }
     }
     else
     {
         DisplayPluginControl((UserControl)sender);
     }
 }
Example #6
0
        public void WorkAsync(Control host, string message, Action <DoWorkEventArgs> work, Action <RunWorkerCompletedEventArgs> callback, object argument = null, int messageWidth = 340, int messageHeight = 150)
        {
            _infoPanel = InformationPanel.GetInformationPanel(host, message, messageWidth, messageHeight);

            var worker = new BackgroundWorker();

            worker.DoWork += (s, e) => work(e);

            worker.RunWorkerCompleted += (s, e) =>
            {
                if (host.Controls.Contains(_infoPanel))
                {
                    _infoPanel.Dispose();
                    host.Controls.Remove(_infoPanel);
                }
                callback(e);
            };
            worker.RunWorkerAsync(argument);
        }
Example #7
0
 public void SetWorkingMessage(Control host, string message, int width = 340, int height = 100)
 {
     if (host.Controls.Contains(_infoPanel))
     {
         if (_infoPanel.Width != width || _infoPanel.Height != height)
         {
             _infoPanel.Dispose();
             host.Controls.Remove(_infoPanel);
             _infoPanel = InformationPanel.GetInformationPanel(host, message, width, height);
         }
         else
         {
             InformationPanel.ChangeInformationPanelMessage(_infoPanel, message);
         }
     }
     else
     {
         _infoPanel = InformationPanel.GetInformationPanel(host, message, width, height);
     }
 }