Exemplo n.º 1
0
        private void Form1_Load(object sender, System.EventArgs e)
        {
            string myPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string myConfig = myPath + @"\myConfig.xml";

            Config cfg = new Config();
            Config.ConfigurationRow row;

            if (File.Exists(myConfig))
            {
                cfg.ReadXml(myConfig);
                row = cfg.Configuration[0];
            }
            else
            {
                frmServerInfo frm = new frmServerInfo();
            //				frm.ShowDialog(this);
            //				if (frm.ServerAddress.Length < 1)
            //				{
            //					Application.Exit();
            //				}
                string serverAddress = "10.1.0.100";
                string password;
                password = Convert.ToBase64String(Encrypt("oyster1"));
                row = cfg.Configuration.AddConfigurationRow(serverAddress,0,password);
                cfg.WriteXml(myConfig);
            }

            try
            {
                _oyster = new Oyster(row.ServerAddress,Decrypt(Convert.FromBase64String(row.Password)));
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Could not connect...");
                Application.Exit();
            }
            //_oyster.Login("sa","");
            foreach (StreamingEncoder encoder in _oyster.STREAMINGENCODERS)
            {
                if (encoder.CurrentStreamingEncoderType.ID == 1)
                {
                    Room room = _oyster.GetRoomById(encoder.RoomID);
                    if (room.ID != 7)
                    {
                        ListViewItem lvi = new ListViewItem(room.Description);
                        lvi.SubItems.Add(encoder.ControlAddress.ToString());
                        lvi.SubItems.Add("No");
                        lvi.SubItems.Add(string.Empty);
                        lvi.Tag = encoder;
                        listView1.Items.Add(lvi);
                    }
                }
            }
            _updateThread = new Thread(new ThreadStart(UpdateEncoderListThreadProc));
            //_updateThread.Start(); // TODO: possibly move this to a checkbox that disables the update button and starts continuous updates
        }
Exemplo n.º 2
0
 private void optionsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmServerInfo frm = new frmServerInfo();
     if (frm.ShowDialog(this) == DialogResult.OK)
     {
         Settings.Default["ServerAddress"] = frm.ServerAddress;
         Settings.Default["ServerPassword"] =
             Crypto.EncryptToBase64String(frm.Password);
         Settings.Default["RealVNCPath"] = frm.VNCExecutablePath;
         Settings.Default["RealVNCConfigFilesFolder"] = frm.VNCConfigFolder;
         Settings.Default.Save();
     }
 }