Ejemplo n.º 1
0
 /// <summary>
 /// 将展现出的视图源进行清空,以备重新填充
 /// </summary>
 void ClearAll()
 {
     try
     {
         if (Collection != null && Collection.Count > 0)
         {
             //是否正在执行添加子项
             if (Collection.IsAddingNew)
             {
                 //禁止添加子项
                 Collection.CancelNew();
             }
             //是否可以移除子项
             if (Collection.CanRemove)
             {
                 for (int i = Collection.Count - 1; i > -1; i--)
                 {
                     Collection.RemoveAt(i);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MethodLb.CreateLog(this.GetType().FullName, "ClearAll", ex.ToString());
     }
     finally
     {
     }
 }
        private void ClearBtn_Click(object sender, RoutedEventArgs e)
        {
            bool isExistNew = false;

            foreach (SalaryInfo info in lcv)
            {
                if (info.ID == 0)
                {
                    isExistNew = true;
                    break;
                }
            }

            if (!isExistNew)
            {
                MessageBox.Show("暂不支持删除已经存在工资记录.");
            }
            else
            {
                while (lcv.Count > 0)
                {
                    lcv.RemoveAt(0);
                }
            }
        }
Ejemplo n.º 3
0
        public void AddBet(Bet newBet)
        {
            if (!Dispatcher.CheckAccess())
            {
                Dispatcher.BeginInvoke(new dAddBet(AddBet), newBet);
            }
            else
            {
                //if (Bets.CanRemove)
                while (Bets.Count > UISettings.Settings.LiveBets + 1)
                {
                    //System.Threading.Thread.Sleep(10);
                    //Bets.Remove(Bets.list);
                    Bets.RemoveAt(Bets.Count - 1);
                }

                Bets.AddNewItem(newBet as DiceBet);
                Bets.CommitNew();
                //if (!fitted)
                {
                    tvBets.BestFitColumns();
                    fitted = true;
                }
            }
        }