Ejemplo n.º 1
0
 private void EditNutritionContextMenu_OnClick(object sender, RoutedEventArgs e)
 {
     if (nutritionlistView.SelectedIndex > -1)
     {
         nutritionObj = new Nutrition();
         nutritionObj = (Nutrition)nutritionlistView.SelectedItem;  // casting the list view
         MessageBox.Show("You are in edit for Name:" + nutritionObj.Name, "Nutrition", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
Ejemplo n.º 2
0
 static public void UpdateItem()
 {
     for (int i = 0; i < VariNum; i++)
     {
         Nutrition temnutrition = variables[i];
         int       j            = temnutrition.IDNum;
         temnutrition.AccountID   = MainWindow.clr.GetVariID(pos, j);
         temnutrition.TemProfit   = MainWindow.clr.GetVariPositionProfit(pos, j).ToString("0.00");
         temnutrition.CloseProfit = MainWindow.clr.GetVariCloseProfit(pos, j).ToString("0.00");
         temnutrition.Position    = MainWindow.clr.GetVariPosition(pos, j).ToString();
         temnutrition.AllOpen     = MainWindow.clr.GetVariAllOpen(pos, j).ToString();
         temnutrition.Commission  = MainWindow.clr.GetVariCommission(pos, j).ToString("0.00");
     }
 }
Ejemplo n.º 3
0
        private void InitialListView()
        {
            AccountIDNum = 0;
            DeleteNum    = 0;
            nutritions   = new ObservableCollection <Nutrition>();
            nutritions.Clear();
            Nutrition nutrition = new Nutrition();

            nutrition.IDNum     = -1;
            nutrition.AccountID = "汇总账户";
            nutritions.Add(nutrition);
            nutritionlistView.ItemsSource = nutritions;
            accountnum = 0;
        }
Ejemplo n.º 4
0
 //初始化品种信息
 public void loadvariable()
 {
     variables = new ObservableCollection <Nutrition>();
     for (int i = 0; i < VariNum; i++)
     {
         Nutrition temnutrition = new Nutrition();
         temnutrition.IDNum       = i;
         temnutrition.AccountID   = "";
         temnutrition.TemProfit   = "";
         temnutrition.CloseProfit = "";
         temnutrition.Position    = "";
         variables.Add(temnutrition);
     }
     this.listvari.ItemsSource = variables;
 }
Ejemplo n.º 5
0
 private void RemoveNutritionContextMenu_OnClick(object sender, RoutedEventArgs e)
 {
     lock (locker)
     {
         Nutrition        temn       = (Nutrition)nutritionlistView.SelectedItem;
         MessageBoxButton messButton = MessageBoxButton.OKCancel;
         MessageBoxResult dr         = MessageBox.Show("是否移除账号:" + temn.AccountID, "移除账户", messButton);
         if (dr == MessageBoxResult.OK)
         {
             clr.CloseAccount(temn.IDNum);
             nutritions.Remove(temn);
             DeleteNum++;
         }
     }
 }
Ejemplo n.º 6
0
        private void nutritionlistView_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            Nutrition temn = (Nutrition)nutritionlistView.SelectedItem;

            if (temn == null)
            {
                return;
            }
            int pos = temn.IDNum;

            w1       = new Window1(pos);
            w1.Title = "账户:" + temn.AccountID;
            w1.Show();

            //string s = clr.returnmoney().ToString();
            // MessageBox.Show("You are double click Name:" +s, "Nutrition", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Ejemplo n.º 7
0
        private void ClearMenu_OnClick(object sender, RoutedEventArgs e)
        {
            Nutrition        temn       = (Nutrition)nutritionlistView.SelectedItem;
            int              IDNum      = temn.IDNum;
            string           IDAccount  = temn.AccountID;
            MessageBoxButton messButton = MessageBoxButton.OKCancel;
            MessageBoxResult dr         = MessageBox.Show("是否清仓,账号:" + IDAccount, "清仓", messButton);

            if (dr == MessageBoxResult.OK)
            {
                MessageBoxButton messButton2 = MessageBoxButton.OKCancel;
                MessageBoxResult dr2         = MessageBox.Show("真的确定吗", "确认", messButton2);
                if (dr2 == MessageBoxResult.OK)
                {
                    clr.ClearAccount(IDNum);
                }
            }
        }
Ejemplo n.º 8
0
        private void ClearMenu_OnClick(object sender, RoutedEventArgs e)
        {
            Nutrition        temn       = (Nutrition)listvari.SelectedItem;
            int              IDNum      = temn.IDNum;
            string           IDAccount  = temn.AccountID;
            MessageBoxButton messButton = MessageBoxButton.OKCancel;
            MessageBoxResult dr         = MessageBox.Show("是否清仓品种:" + IDAccount, "清仓", messButton);

            if (dr == MessageBoxResult.OK)
            {
                MessageBoxButton messButton2 = MessageBoxButton.OKCancel;
                MessageBoxResult dr2         = MessageBox.Show("真的确定吗", "确认", messButton2);
                if (dr2 == MessageBoxResult.OK)
                {
                    //清仓特定品种
                    MainWindow.clr.ClearVariable(pos, IDNum);
                }
            }
        }
Ejemplo n.º 9
0
 static public void LoadListView()
 {
     lock (locker)
     {
         int temaccountnum = clr.AccountNum();
         if (temaccountnum > accountnum)
         {
             for (int i = accountnum; i < temaccountnum; i++)
             {
                 Nutrition temnutrition = new Nutrition();
                 temnutrition.IDNum     = i;
                 temnutrition.Delete    = 0;
                 temnutrition.AccountID = clr.AccountName(i);
                 nutritions.Add(temnutrition);
             }
             accountnum = temaccountnum;
         }
     }
 }
Ejemplo n.º 10
0
 static private void UpdateItem()
 {
     lock (locker)
     {
         for (int i = 0; i < accountnum + 1 - DeleteNum; i++)
         {
             Nutrition temnutrition = nutritions[i];
             int       pos          = temnutrition.IDNum;
             temnutrition.AccountID   = clr.AccountName(pos);
             temnutrition.TemProfit   = clr.GetPositionProfit(pos).ToString("0.00");
             temnutrition.CloseProfit = clr.GetCloseProfit(pos).ToString("0.00");
             temnutrition.DrawNum     = clr.GetUnDoneNum(pos).ToString();
             temnutrition.DoneNum     = clr.GetDoneNum(pos).ToString() + " / " + clr.GetUnDoneNum(pos).ToString();
             temnutrition.AveProfit   = clr.GetAveWin(pos).ToString("0.00");
             temnutrition.Balance     = clr.GetBalance(pos).ToString("0.00");
             temnutrition.CurrMargin  = clr.GetMargin(pos).ToString("0.00");
             temnutrition.Commission  = clr.GetCommission(pos).ToString("0.00");
             temnutrition.DoneDeal    = clr.GetDoneDeal(pos).ToString();
             temnutrition.Connect     = clr.GetConnectFlag() == 0 ? "未连接" : "已连接";
             temnutrition.Trade       = clr.GetTrade(pos) == 1 ? "已连接" : "";
         }
     }
 }
Ejemplo n.º 11
0
        public void Refresh()
        {
            int TemVariNum = MainWindow.clr.VariNum(pos);

            if (TemVariNum > VariNum)
            {
                for (int i = VariNum; i < TemVariNum; i++)
                {
                    Nutrition temnutrition = new Nutrition();
                    temnutrition.IDNum       = i;
                    temnutrition.AccountID   = "";
                    temnutrition.TemProfit   = "";
                    temnutrition.CloseProfit = "";
                    temnutrition.Position    = "";
                    variables.Add(temnutrition);
                }
                VariNum = TemVariNum;
            }

            int TemOrderNum = MainWindow.clr.GetOrderLength(pos);

            if (TemOrderNum > OrderNum)
            {
                for (int i = 0; i < TemOrderNum - OrderNum; i++)
                {
                    Order temorder = new Order();
                    temorder.Variable  = "";
                    temorder.Time      = "";
                    temorder.Price     = "";
                    temorder.TradeType = "";
                    temorder.TradeVol  = "";
                    orders.Add(temorder);
                }
                OrderNum = TemOrderNum;
            }
        }