Example #1
0
        private void MenuItem_Click_ClearItem(object sender, RoutedEventArgs e)
        {
            if (LWHedge.Items.Count < 1)
            {
                return;
            }
            ListViewHedgeData lw = LWHedge.SelectedItems[0] as ListViewHedgeData;

            for (int i = FootData.Count - 1; i >= 0; i--)
            {
                FData item = FootData[i];

                if (lw.Match == item.Team1 + " - " + item.Team2)
                {
                    foreach (KeyValuePair <int, X> it in item.XKoef)
                    {
                        if (Bookmakers[it.Key].Name == lw.Bookie)
                        {
                            it.Value.Koef[0] = 1;
                            it.Value.Koef[1] = 1;
                            it.Value.Koef[2] = 1;
                            break;
                        }
                    }
                    break;
                }
            }
            UpdateHedgeDataInListview();
        }
Example #2
0
        private void MenuItem_Click_CalcFreeBet(object sender, RoutedEventArgs e)
        {
            if (LWHedge.Items.Count < 1)
            {
                return;
            }
            ListViewHedgeData lw    = (ListViewHedgeData)LWHedge.SelectedItems[0];
            double            koef1 = 2;
            double            koef2 = 2;

            TryToParse.ParseDouble(lw.Back, out koef1);
            TryToParse.ParseDouble(lw.Lay, out koef2);
            OpenWindow_FreeBet(true, koef1, koef2);
        }
Example #3
0
        private void MenuItem_Click_Compare(object sender, RoutedEventArgs e)
        {
            if (LWHedge.Items.Count < 1)
            {
                return;
            }
            if (LWHedge.Items.Count == 0 || LWHedge.SelectedItems.Count == 0)
            {
                return;
            }
            ComparaKoef CK = new ComparaKoef(this);

            CK.Show();
            ListViewHedgeData lw = LWHedge.SelectedItems[0] as ListViewHedgeData;

            CK.Compare(lw.Match, lw.Team);
        }
Example #4
0
        private void MenuItem_Click_Removeitem(object sender, RoutedEventArgs e)
        {
            if (LWHedge.Items.Count < 1)
            {
                return;
            }
            ListViewHedgeData lw = LWHedge.SelectedItems[0] as ListViewHedgeData;

            for (int i = FootData.Count - 1; i >= 0; i--)
            {
                FData item = FootData[i];

                if (lw.Match == item.Team1 + " - " + item.Team2)
                {
                    FootData.RemoveAt(i);
                }
            }
            UpdateHedgeDataInListview();
        }
        public void UpdateHedgeDataInListview()
        {
            Task.Factory.StartNew(() =>
            {
                int index    = 0;
                bool Today   = false;
                bool ViewAll = false;
                Dispatcher.Invoke((Action)(() =>
                {
                    BackgroundGrid.Background = SystemColors.ActiveBorderBrush;
                    TabCont.SelectedIndex = 0;
                    LWHedge.Items.Clear();
                    if (ComboboxActiveBookies.SelectedIndex != 0)
                    {
                        index = ComboboxActiveBookies.SelectedIndex;
                    }
                    Today = CheckBoxToday.IsChecked.Value;
                    ViewAll = CheckBoxViewAll.IsChecked.Value;
                }));


                List <LayData> datalist = new List <LayData>();

                CalcParameters cp = new CalcParameters();
                foreach (BasicBrokerData book in Bookmakers)
                {
                    if (book.InUse || ViewAll)
                    {
                        cp.bookielimit += "|" + book.Name + "|";
                    }
                }

                if (cp.bookielimit == null)
                {
                    System.Windows.Forms.MessageBox.Show("Select Bookies !!"); return;
                }
                cp.limit = FootballHedge.Properties.Settings.Default.plLimit;

                cp.preferedbookie = ComboboxActiveBookies.Items[index].ToString();
                cp.today          = Today;
                CalcHedge(ref datalist, cp);

                if (datalist.Count == 0)
                {
                    return;
                }

                datalist.Sort();
                datalist.Reverse();


                string[] d;
                StringBuilder bufstr = new StringBuilder();
                foreach (LayData item in datalist)
                {
                    bufstr.Clear();
                    ListViewHedgeData lview = new ListViewHedgeData();
                    lview.Match             = item.Match;
                    lview.Team       = item.Selection;
                    lview.Back       = item.Back.ToString();
                    lview.Lay        = item.Lay.ToString();
                    lview.PL         = item.Profit.ToString();
                    lview.Size       = item.Size.ToString();
                    lview.FullLeague = item.League;
                    d = item.League.Split(' ');
                    foreach (string str in d)
                    {
                        bufstr.Append(str.Substring(0, 1));
                    }
                    lview.League     = bufstr.ToString();
                    lview.Bookie     = item.Bookie;
                    lview.Time       = item.Time;
                    lview.LastUpdate = item.LastUpdate;

                    Dispatcher.Invoke((Action)(() => LWHedge.Items.Add(lview)));
                }

                Dispatcher.Invoke((Action)(() => LWHedge.ScrollIntoView(LWHedge.Items[0])));
            });
        }