コード例 #1
0
ファイル: frmMain.cs プロジェクト: CorlenS/ROILootManager
        public frmMain()
        {
            InitializeComponent();
            Refresh();
            logger.Info("Main form initialized.");

            try {
                roster = new Roster();
                lootLog = new LootLog();
                logReader = new LogReader();
                logReader.logEvent += new LogReaderEvent(logReaderEvent);
                itemListing = new ItemListing();

                string savedFile = PropertyManager.getManager().getProperty("EQlogFile");
                if (savedFile != null) {
                    if (logReader.setLogFile(savedFile)) {
                        logReader.start();
                        grpChatLogs.Text = String.Format("Chat Logs ({0})", savedFile);
                    }

                }

                logRefresher = new Thread(updateLootLog);
                logRefresher.Start();

                this.Text = "ROI Loot Manager - v" + Constants.PROGRAM_VERSION;

            } catch (Exception e) {
                string message = "Could not get one of the worksheets used. A severe error occured or you may not have access. The program will close.";
                logger.Error(message, e);
                MessageBox.Show(message);
                System.Environment.Exit(-1);
            }

            cmbName.DataSource = roster.getActiveNames();
            cmbName.DisplayMember = Roster.NAME_COL;
            cmbName.ValueMember = Roster.NAME_COL;
            cmbName.SelectedIndex = -1;

            cmbEvent.DataSource = lootLog.getEvents();
            cmbEvent.DisplayMember = "shortName";
            cmbEvent.ValueMember = "shortName";
            cmbEvent.SelectedIndex = -1;

            cmbSlot.DataSource = lootLog.getArmorTypes();
            cmbSlot.DisplayMember = "armorType";
            cmbSlot.ValueMember = "armorType";
            cmbSlot.SelectedIndex = -1;

            dteRaidDate.Value = DateTime.Today;

            updateEqLogControls();

            loadRosterNames();

            List<String> savedTierList = new List<String>(PropertyManager.getManager().getProperty(PropertyManager.LAST_TIER_SELECTED).Split(','));
            List<String> tierList = lootLog.getTiers();

            foreach(String t in tierList) {

                ListViewItem item = new ListViewItem(t);
                item.Text = t;
                item.Name = t;

                if (savedTierList.Contains(t)) {
                    item.Checked = true;
                }

                lvTierSelection.Items.Add(item);
            }

            includeRots = false;

            chkIncludeRots.Checked = includeRots;

            dgvLootSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvVisibleSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvNonVisibleSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvWeaponSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            lvRosterNames.ItemChecked += new ItemCheckedEventHandler(lvRosterNames_ItemChecked);
            lvTierSelection.ItemChecked += new ItemCheckedEventHandler(lvTierSelection_ItemChecked);
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: kauffman12/ROILootManager
        public frmMain()
        {
            InitializeComponent();
            Refresh();
            logger.Info("Main form initialized.");

            try
            {
                roster              = new Roster();
                lootLog             = new LootLog();
                logReader           = new LogReader();
                logReader.logEvent += new LogReaderEvent(logReaderEvent);
                itemListing         = new ItemListing();

                string savedFile = PropertyManager.getManager().getProperty("EQlogFile");
                if (savedFile != null)
                {
                    if (logReader.setLogFile(savedFile))
                    {
                        logReader.start();
                        grpChatLogs.Text = String.Format("Chat Logs ({0})", savedFile);
                    }
                }

                logRefresher = new Thread(updateLootLog);
                logRefresher.Start();

                this.Text = "ROI Loot Manager - v" + Constants.PROGRAM_VERSION;

                Form mainFrm = this;
                timer.Elapsed += new System.Timers.ElapsedEventHandler(
                    (object timerSender, ElapsedEventArgs timerEvent) =>
                {
                    mainFrm.Invoke(new MethodInvoker(delegate()
                    {
                        lblStatus.Text = "";
                        timer.Enabled  = false;
                    }));
                }
                    );

                timer.Interval = 2000;
                timer.Enabled  = false;
            }
            catch (Exception e)
            {
                string message = "Could not get one of the worksheets used. A severe error occured or you may not have access. The program will close.";
                logger.Error(message, e);
                MessageBox.Show(message);
                System.Environment.Exit(-1);
            }

            cmbName.DataSource    = roster.getActiveNames();
            cmbName.DisplayMember = Roster.NAME_COL;
            cmbName.ValueMember   = Roster.NAME_COL;
            cmbName.SelectedIndex = -1;

            cmbEvent.DataSource    = lootLog.getEvents();
            cmbEvent.DisplayMember = "shortName";
            cmbEvent.ValueMember   = "shortName";
            cmbEvent.SelectedIndex = -1;

            cmbSlot.DataSource    = lootLog.getArmorTypes();
            cmbSlot.DisplayMember = "armorType";
            cmbSlot.ValueMember   = "armorType";
            cmbSlot.SelectedIndex = -1;

            dteRaidDate.Value = DateTime.Today;

            loadRosterNames();

            List <String> savedTierList = new List <String>();
            string        prop          = PropertyManager.getManager().getProperty(PropertyManager.LAST_TIER_SELECTED);

            if (prop != null)
            {
                savedTierList.AddRange(prop.Split());
            }

            List <String> tierList = lootLog.getTiers();

            foreach (String t in tierList)
            {
                ListViewItem item = new ListViewItem(t);
                item.Text = t;
                item.Name = t;

                if (savedTierList.Contains(t))
                {
                    item.Checked = true;
                }

                lvTierSelection.Items.Add(item);
            }

            includeRots = false;

            chkIncludeRots.Checked = includeRots;

            dgvLootSummary.SortCompare       += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvVisibleSummary.SortCompare    += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvNonVisibleSummary.SortCompare += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            dgvWeaponSummary.SortCompare     += new DataGridViewSortCompareEventHandler(lootSummarySorter);
            lvRosterNames.ItemChecked        += new ItemCheckedEventHandler(lvRosterNames_ItemChecked);
            lvTierSelection.ItemChecked      += new ItemCheckedEventHandler(lvTierSelection_ItemChecked);
            lootLogView.ItemSelectionChanged += new ListViewItemSelectionChangedEventHandler(selectLoot);
        }