Esempio n. 1
0
        private void timer_Tick(object sender, EventArgs e)
        {
            try
            {
                if (myCopyObj != null)
                {
                    if (myCopyObj.Active)
                    {
                        Progress.Value = myCopyObj.Progress;
                        return;
                    }
                }

                if (myWorker == null)
                {
                    StartUp();
                    return;
                }

                if (myWorker.ForumURL != "" && myWorker.ForumURL != webBrowser1.Tag && myWorker.ForumURL != webBrowser1.Url.AbsoluteUri && !webBrowser1.IsBusy)
                {
                    MyToolkit.ActivityLog("Loading Web Browser URL to: \"" + myWorker.ForumURL + "\"");
                    webBrowser1.Tag = myWorker.ForumURL;
                    webBrowser1.Navigate(myWorker.ForumURL);
                }

                if (myWorker.Manifest != null)
                {
                    if (ListBox1.Items.Count <= 1)
                    {
                        IEnumerable <XElement> Profiles = myWorker.Manifest.Descendants("launch");
                        List <object>          items    = new List <object>();

                        foreach (XElement profile in Profiles)
                        {
                            var landingPage    = profile.Attribute("landingPage");
                            var landingPageUri = new Uri(landingPage?.Value ?? "about:blank");
                            items.Add(new LaunchProfile(profile.Value.ToString().Replace("My App: ", "").Trim(),
                                                        profile.Attribute("exec").Value,
                                                        profile.Attribute("params").Value,
                                                        landingPageUri));
                        }

                        if (DevMode)
                        {
                            Profiles = myWorker.Manifest.Descendants("devlaunch");

                            foreach (XElement profile in Profiles)
                            {
                                var landingPage    = profile.Attribute("landingPage");
                                var landingPageUri = new Uri(landingPage?.Value ?? "about:blank");
                                items.Add(new LaunchProfile(profile.Value.ToString().Replace("My App: ", "").Trim(),
                                                            profile.Attribute("exec").Value,
                                                            profile.Attribute("params").Value,
                                                            landingPageUri));
                            }
                        }

                        ListBox1.DisplayMember = "Text";
                        ListBox1.DataSource    = items;
                        ListBox1.SelectedIndex = 0;
                    }
                }

                Progress.Value = MyToolkit.MinMax(myWorker.CurProgress, 0, 100);
                lblStatus.Text = myWorker.Status + "... " + myWorker.CurFile;

                if (myWorker.Status == "Done")
                {
                    Finish();
                }
            } catch (Exception ex) {
                MyToolkit.ErrorReporter(ex, this.Name + ".Form_Load");
            }
        }