Example #1
0
        //快捷菜单
        private void CreateConfig_Click(object sender, EventArgs e)
        {
            try
            {
                if (PlinkStart)
                {
                    this.btnConnect_Click(this, new EventArgs());
                }

                frmCreateConfig frmCConfig = new frmCreateConfig();
                if (frmCConfig.ShowForm(this.colPlinkConfig) == DialogResult.OK)
                {
                    colPlinkConfig.CreateConfig(frmCConfig.ConfigName);
                    this.FillConfigControl();
                    if (!ShowInTaskbar)
                    {
                        ShowOrHide_Click(this, new EventArgs());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        public frmMain()
        {
            InitializeComponent();

            notifyicon.Text             = "ShellForPlink";
            notifyicon.Visible          = true;
            notifyicon.ContextMenuStrip = this.contextMenuStrip2;
            notifyicon.Icon             = Properties.Resources.tray_error;
            this.Icon = Properties.Resources.main;

            tabControl1.SelectedIndex = 1;

            plink = new Plink();

            Ping = new LoopBackPing();

            this.AddEventHandle();

            try
            {
                if (File.Exists(xmlConfigFileName))
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(PlinkConfigCollection));
                    FileStream    fs         = File.Open(xmlConfigFileName, FileMode.Open);
                    colPlinkConfig = (PlinkConfigCollection)serializer.Deserialize(fs);
                    fs.Close();
                    colPlinkConfig.FillConfigDict();
                    colPlinkConfig.FillCurConfigobj();
                    this.FillMenuStripCfNameList();
                }
                else
                {
                    colPlinkConfig = new PlinkConfigCollection();
                    colPlinkConfig.CreateConfig("Default");
                }


                this.FillConfigControl();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }