Exemple #1
0
        private void JoinContext()
        {
            try
            {
                ProgressInfoDialog dlgProgress = new ProgressInfoDialog(this);

                dlgProgress.Title       = "Joining Common Context";
                dlgProgress.Description = "Attempting to join common context";
                if (dlgProgress.ShowDialog(() => _Context.Join(_ApplicationName, true)) == DialogResult.OK)
                {
                    _Context.SetFilter("User");
                }
                else
                {
                    if (dlgProgress.Exception != null)
                    {
                        throw dlgProgress.Exception;
                    }
                }
            }
            catch (Exception e)
            {
                Messager.ShowError(this, e);
                Close();
            }
        }
Exemple #2
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (_Context != null)
            {
                if (_Context.Joined)
                {
                    ProgressInfoDialog dlgProgress = new ProgressInfoDialog(this);

                    dlgProgress.Title       = "Leaving Common Context";
                    dlgProgress.Description = "Attempting to leave common context";
                    try
                    {
                        dlgProgress.ShowDialog(() => _Context.Leave());
                    }
                    catch (Exception ex)
                    {
                        Messager.ShowError(this, ex);
                        e.Cancel = true;
                    }
                }
            }
        }