public ContentManager(MainWindow parent, string source)
 {
     this.Parent = parent;
     this.Initialize(source);
     this.protectionManager = parent.protectionManager;
     this.retrieveSelected();
     this.retrieveVersions();
     this.Parent.refreshList();
 }
Example #2
0
        public MainWindow(string[] entryArgs)
        {
            foreach (string arg in entryArgs)
            {
                if (arg.Contains("+dev"))
                {
                    this.devIndex = true;
                }
                if (arg.Contains("+debug"))
                {
                    this.debugMode = true;
                }
            }

            protectionManager = new ProtectionManager(this);

            Application.ApplicationExit += Application_ApplicationExit;

            if (!checkRequirements())
            {
                Environment.Exit(0);
            }

            if (Properties.Settings.Default.firstRun)
            {
                migrateSettings();
            }

            InitializeComponent();
            this.listBox1.DrawItem += listBox1_DrawItem;


            setLocalAppDataFolder();
            this.label3.Text         = "FH2 Community Updater v." + Application.ProductVersion;
            this.toolTip1.ShowAlways = true;
            this.toolTip1.SetToolTip(linkLabel1, @"http://www.forgottenhonor.com/modules.php?name=Forums");

            this.torrentUser = new TorrentUser(this);

            this.torrentUser.StatusUpdate += torrentUser_StatusUpdate;

            while (this.confirmIndex() == false)
            {
                continue;
            }

            BackgroundWorker infoWorker = new BackgroundWorker();

            infoWorker.DoWork += new DoWorkEventHandler(
                delegate(object o, DoWorkEventArgs args)
            {
                this.contentManager = new ContentManager(this, this.workingIndex);
            });

            infoWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(
                delegate(object o, RunWorkerCompletedEventArgs args)
            {
                if (args.Error != null)
                {
                    if (args.Error.GetType() == (typeof(XmlException)))
                    {
                        MessageBox.Show("There was an error in the server index.\nIf this error persists, please leave a message on the forums.");
                        Environment.Exit(5);
                    }
                    else
                    {
                        throw args.Error;
                    }
                }
                afterRunWorker();
            });
            var some = unlimitedToolStripMenuItem.GetCurrentParent();

            some.ItemClicked += some_ItemClicked;

            infoWorker.RunWorkerAsync();
        }