コード例 #1
0
ファイル: MainForm.cs プロジェクト: rseman4/kvmwc
        void LoginButtonClick(object sender, EventArgs e)
        {
            if (textBoxHostname.Text == "" || textBoxUsername.Text == "" || textBoxPassword.Text == "")
            {
                MessageBox.Show("Please, fill all fields!", "Error");
            }
            else
            {
                ConnectionVariables connVars = new ConnectionVariables();
                connVars.SetConnectionInfo(textBoxHostname.Text, textBoxUsername.Text, textBoxPassword.Text);
                Form ProgramForm = new ProgramForm();

                string path = @"connection.ini";
                if (!File.Exists(path))
                {
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine(textBoxHostname.Text);
                        sw.WriteLine(textBoxUsername.Text);
                    }
                }
                else
                {
                    File.Delete(path);
                    using (StreamWriter sw = File.CreateText(path))
                    {
                        sw.WriteLine(textBoxHostname.Text);
                        sw.WriteLine(textBoxUsername.Text);
                    }
                }
                this.Hide();

                ProgramForm.Show();
            }
        }
コード例 #2
0
        private static int LIST_UPDATE_TIMER = 10000;         //In milliseconds

        public ProgramForm()
        {
            InitializeComponent();

            ConnectionVariables connVars = new ConnectionVariables();

            string[] con = connVars.GetConnectionInfo();

            HOST     = con[0];
            USERNAME = con[1];
            PASSWORD = con[2];

            this.Text += " - " + HOST;
            toolStripConnectionStatus.Text = "Connected to: " + HOST;

            UpdateVirtualMachineList();
            //InitTimer(); //Start Automatic updates
        }