Exemple #1
0
 private void SimpleDatabaseEditor_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (pnlmon != null)
     {
         pnlmon.Stop();
         pnlmon.presented -= pnlmon_CardPresented;
         pnlmon            = null;
     }
 }
Exemple #2
0
        private void panelConnectionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //panel connection option

            if (pnlmon != null)
            {
                pnlmon.Stop();
                pnlmon.presented -= pnlmon_CardPresented;

                ConnectionPropertiesEditor connproped = pnlconnprop == null ? new ConnectionPropertiesEditor() : new ConnectionPropertiesEditor(pnlconnprop);
                if (connproped.ShowDialog(this) == DialogResult.OK)
                {
                    ConnectionProperties new_pnlconnprop = connproped.ConnectionProperties;
                    PanelMonitor         new_pnlmon      = null;
                    try
                    {
                        new_pnlmon            = new PanelMonitor(new_pnlconnprop);
                        new_pnlmon.presented += pnlmon_CardPresented;
                        new_pnlmon.Start();
                    }
                    catch (Exception ex)
                    {
                        if (new_pnlmon != null)
                        {
                            try
                            {
                                new_pnlmon.Stop();
                                new_pnlmon.presented -= pnlmon_CardPresented;
                            }
                            catch (Exception ex2) { }
                        }

                        MessageBox.Show(this, "Error connecting to panel. The settings have been reverted.");

                        pnlmon.presented += pnlmon_CardPresented;
                        pnlmon.Start();
                    }

                    pnlconnprop = new_pnlconnprop;
                    pnlmon      = new_pnlmon;
                }
                else
                {
                    pnlmon.presented += pnlmon_CardPresented;
                    pnlmon.Start();
                }

                connproped.Dispose();
            }
            else
            {
                ConnectionPropertiesEditor connproped = new ConnectionPropertiesEditor();
                if (connproped.ShowDialog(this) == DialogResult.OK)
                {
                    ConnectionProperties new_pnlconnprop = connproped.ConnectionProperties;
                    PanelMonitor         new_pnlmon      = null;
                    try
                    {
                        new_pnlmon            = new PanelMonitor(new_pnlconnprop);
                        new_pnlmon.presented += pnlmon_CardPresented;
                        new_pnlmon.Start();
                    }
                    catch (Exception ex)
                    {
                        if (new_pnlmon != null)
                        {
                            try
                            {
                                new_pnlmon.Stop();
                                new_pnlmon.presented -= pnlmon_CardPresented;
                            }
                            catch (Exception ex2) { }
                        }

                        MessageBox.Show(this, "Error connecting to panel.");
                    }

                    pnlconnprop = new_pnlconnprop;
                    pnlmon      = new_pnlmon;
                }
            }

            RefreshFormTitle();
        }