Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            // Set up the event aggregator for updates to the status bar from
            // multiple view models.
            EventAggregator = new EventAggregator();

            // Let user select ffxi process
            frmStartup ProcessSelectionScreen = new frmStartup();

            ProcessSelectionScreen.ShowDialog();

            // Validate the selection
            var m_process = ProcessSelectionScreen.POL_Process;

            // Check if the user made a selection.
            if (m_process == null)
            {
                System.Windows.Forms.MessageBox.Show("No valid process was selected: Exiting now.");
                Environment.Exit(0);
            }

            // Save the selected fface instance.
            _fface = ProcessSelectionScreen.FFXI_Session;

            // Set up the game engine if valid.
            FarmingTools.LoadSettings();

            // Set up UnitService to use this mob filter instead of its
            // default mob filter.
            FarmingTools.UnitService.MobFilter = UnitFilters.MobFilter(_fface);

            // Create a new game engine to control our character.
            GameEngine = new GameEngine(_fface);

            // new DebugSpellCasting(_fface).Show();

            // new DebugCreatures(_fface, FarmingTools.UnitService).Show();
        }
Example #2
0
        private void cmdEdit_Click(object sender, EventArgs e)
        {
            if (lstItems.SelectedItems.Count == 0)
            {
                return;
            }
            if (lstItems.SelectedItems.Count > 1)
            {
                MessageBox.Show(this, "You can only edit one item at a time.", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            ReportingPolElement r = (ReportingPolElement)lstItems.SelectedItem;
            int index             = Cert.ReportingElements.IndexOf(r.Element);

            if (index == -1)
            {
                MessageBox.Show(this, "Cannot find the element internally!", Program.Title, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            switch (LastType)
            {
            case 1:
            {
                frmDiskSpace d = new frmDiskSpace(r.Element);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements[index] = JsonConvert.SerializeObject(d.Element);
                UpdateStatus();
            }
            break;

            case 2:
            {
                frmEventLog d = new frmEventLog(r.Element);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements[index] = JsonConvert.SerializeObject(d.Element);
                UpdateStatus();
            }
            break;

            case 3:
            {
                frmAddRemovePrograms d = new frmAddRemovePrograms(r.Element);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements[index] = JsonConvert.SerializeObject(d.Element);
                UpdateStatus();
            }
            break;

            case 4:
            {
                frmStartup d = new frmStartup(r.Element);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements[index] = JsonConvert.SerializeObject(d.Element);
                UpdateStatus();
            }
            break;

            case 5:
            {
                frmSMARTConfig d = new frmSMARTConfig(r.Element);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements[index] = JsonConvert.SerializeObject(d.Element);
                UpdateStatus();
            }
            break;

            case 6:
            {
                Cert.ReportingElements[index] = JsonConvert.SerializeObject(new ReportingPolicyElementSimpleTaskCompleted());
                UpdateStatus();
            }
            break;
            }
        }
Example #3
0
        private void cmdAddItem_Click(object sender, EventArgs e)
        {
            if (LastType == -1)
            {
                return;
            }
            switch (LastType)
            {
            case 1:
            {
                frmDiskSpace d = new frmDiskSpace(null);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements.Add(JsonConvert.SerializeObject(d.Element));
                UpdateStatus();
            }
            break;

            case 2:
            {
                frmEventLog d = new frmEventLog(null);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements.Add(JsonConvert.SerializeObject(d.Element));
                UpdateStatus();
            }
            break;

            case 3:
            {
                frmAddRemovePrograms d = new frmAddRemovePrograms(null);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements.Add(JsonConvert.SerializeObject(d.Element));
                UpdateStatus();
            }
            break;

            case 4:
            {
                frmStartup d = new frmStartup(null);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements.Add(JsonConvert.SerializeObject(d.Element));
                UpdateStatus();
            }
            break;

            case 5:
            {
                frmSMARTConfig d = new frmSMARTConfig(null);
                if (d.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                Cert.ReportingElements.Add(JsonConvert.SerializeObject(d.Element));
                UpdateStatus();
            }
            break;

            case 6:
            {
                Cert.ReportingElements.Add(JsonConvert.SerializeObject(new ReportingPolicyElementSimpleTaskCompleted()));
                UpdateStatus();
            }
            break;
            }
        }