示例#1
0
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            slMargin.ValueChanged  += SlMarginValueChanged;
            slMinimum.ValueChanged += SlMinimumValueChanged;

            tbCorpStanding.TextChanged    += TbCorpStandingTextChanged;
            tbFactionStanding.TextChanged += TbFactionStandingTextChanged;
            tbCorpStanding.LostFocus      += TbStandingOnLostFocus;
            tbFactionStanding.LostFocus   += TbStandingOnLostFocus;

            cbBrokerRelations.SelectionChanged += CbBrokerRelationsSelectionChanged;
            cbAccounting.SelectionChanged      += CbAccountingSelectionChanged;

            for (int i = 0; i < 6; i++)
            {
                cbBrokerRelations.Items.Add(i);
                cbAccounting.Items.Add(i);
            }

            Settings = new Settings();
            cbProfiles.Items.Add(Settings);
            cbProfiles.SelectedIndex = 0;

            PopupPlacements();

            Tutorial.Main = this;
            Tutorial.ShowTutorialHint();

            UpdateProfiles();

            btnUpdate.IsChecked = Properties.Settings.Default.checkforupdates;

            var delayer = new BackgroundWorker();

            delayer.DoWork += (o, args) => Updates.CheckForUpdates();
            delayer.RunWorkerAsync();

            btnStayOnTop.IsChecked = Properties.Settings.Default.pin;
            Topmost = Properties.Settings.Default.pin;

            if (Properties.Settings.Default.autocopy == 0)
            {
                cbAutoCopy.IsChecked = false;
                rbSell.IsChecked     = true;
            }
            else
            {
                cbAutoCopy.IsChecked = true;
                rbSell.IsChecked     = Properties.Settings.Default.autocopy > 0;
                rbBuy.IsChecked      = Properties.Settings.Default.autocopy < 0;
            }
        }
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            tbCorpStanding.TextChanged    += TbCorpStandingTextChanged;
            tbFactionStanding.TextChanged += TbFactionStandingTextChanged;
            tbCorpStanding.LostFocus      += TbStandingOnLostFocus;
            tbFactionStanding.LostFocus   += TbStandingOnLostFocus;

            cbBrokerRelations.SelectionChanged += CbBrokerRelationsSelectionChanged;
            cbAccounting.SelectionChanged      += CbAccountingSelectionChanged;

            cbSellRange.SelectionChanged += cbSellRangeSelectionChanged;
            cbBuyRange.SelectionChanged  += cbBuyRangeSelectionChanged;

            for (int i = 0; i < 6; i++)
            {
                cbBrokerRelations.Items.Add(i);
                cbAccounting.Items.Add(i);
            }

            List <Object> rangeItems = new List <Object>();

            foreach (int i in Enum.GetValues(typeof(Profile.ranges)))
            {
                var type        = typeof(Profile.ranges);
                var memInfo     = type.GetMember(Enum.GetName(typeof(Profile.ranges), i).ToString());
                var attributes  = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
                var description = ((DescriptionAttribute)attributes[0]).Description;

                ComboboxItem item = new ComboboxItem();
                item.Text  = description;
                item.Value = i;

                cbBuyRange.Items.Add(item);
                cbSellRange.Items.Add(item);
            }

            profile = new Profile();
            cbProfiles.Items.Add(profile);
            cbProfiles.SelectedIndex = 0;

            PopupPlacements();

            UpdateProfiles();

            btnUpdate.IsChecked = Properties.Settings.Default.checkforupdates;

            var delayer = new BackgroundWorker();

            delayer.DoWork += (o, args) => Updates.CheckForUpdates();
            delayer.RunWorkerAsync();

            btnStayOnTop.IsChecked = Properties.Settings.Default.pin;
            Topmost = Properties.Settings.Default.pin;

            if (Properties.Settings.Default.autocopy == 0)
            {
                cbAutoCopy.IsChecked = false;
                rbSell.IsChecked     = true;
            }
            else
            {
                cbAutoCopy.IsChecked = true;
                rbSell.IsChecked     = Properties.Settings.Default.autocopy > 0;
                rbBuy.IsChecked      = Properties.Settings.Default.autocopy < 0;
            }

            if (Properties.Settings.Default.selectedprofile != "")
            {
                cbProfiles.Text = Properties.Settings.Default.selectedprofile;
            }
        }