コード例 #1
0
        public main()
        {
            InitializeComponent();

            // Loading devices & versions
            this.listDevices();
            this.loadVersions();

            // Setting up the webClient
            this.webClient = new WebClient();
            webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(downloadProgressChanged);
            webClient.DownloadFileCompleted += webClient_DownloadFileCompleted;
            this.updateUI();

            // Init selected variables
            this.selectedVersion = null;
            this.selectedUSBDevice = noUSBDeviceSelectedUint;
        }
コード例 #2
0
        public void loadVersions()
        {
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                xmlDoc.Load(mirrorXMLFile);
            }
            catch (WebException ex)
            {
                MessageBox.Show("Unable to connect to the XBian server", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            XmlNodeList XMLverName = xmlDoc.GetElementsByTagName("name");
            XmlNodeList XMLlocations = xmlDoc.GetElementsByTagName("locations");

            this.versions = new List<version>();
            for (int i = 0; i < XMLverName.Count; i++)
            {
                string verName = XMLverName[i].InnerText;
                string[] locations = XMLlocations[i].InnerText.Split(';');
                version ver = new version(verName, locations);
                this.versions.Add(ver);
            }

            comboBoxVersions.Items.Clear();

            bool latest = true;
            foreach (version v in versions)
            {
                if (latest)
                {
                    comboBoxVersions.Items.Add(v.getVersionName() + " (latest)");
                    latest = false;
                }
                else
                    comboBoxVersions.Items.Add(v.getVersionName());
            }
        }
コード例 #3
0
 private void reset()
 {
     this.selectedVersion = null;
     this.selectedUSBDevice = noUSBDeviceSelectedUint;
     this.updateUI();
     this.comboBoxSDcard.SelectedItem = null;
     this.comboBoxVersions.SelectedItem = null;
 }
コード例 #4
0
 private void comboBoxVersions_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboBoxVersions.SelectedItem != null)
     {
         this.selectedVersion = this.versions[comboBoxVersions.SelectedIndex];
         this.updateUI();
     }
 }