コード例 #1
0
 void mEditPlan_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (SetInfoEvent != null)
         {
             ///添加一个日记
             IRiLiEntity riLiEntity = null;
             SetInfoEvent(ref riLiEntity);
             if (riLiEntity != null)
             {
                 //获取对应日期
                 string datetime = ((MenuItem)sender).Tag.ToString();
                 //日期是所选择而不是人为的设置的
                 riLiEntity.DateTime = datetime;
                 //添加日记
                 this.ItemsAdd(riLiEntity);
             }
         }
     }
     catch (Exception ex)
     {
         MethodLb.CreateLog(this.GetType().FullName, "mEditPlan_Click", ex.ToString(), sender, e);
     }
     finally
     {
     }
 }
コード例 #2
0
 /// <summary>
 ///  添加一个日记
 /// </summary>
 /// <param name="entity">日记</param>
 public void ItemsAdd(IRiLiEntity entity)
 {
     try
     {
         if (!riLiEntityList.Contains(entity))
         {
             riLiEntityList.Add(entity);
         }
         foreach (var riliitem in riLiItemList)
         {
             if (entity.DateTime == riliitem.Tag.ToString())
             {
                 Button button = new Button();
                 button.Content            = entity.Name;
                 button.Tag                = entity;
                 button.ToolTip            = entity.Name;
                 button.Margin             = new Thickness(0, 1, 0, 1);
                 button.Cursor             = Cursors.Hand;
                 button.BorderThickness    = new Thickness(0);
                 button.Background         = new SolidColorBrush(Colors.Black);
                 button.Background.Opacity = 0;
                 button.Click             += new RoutedEventHandler(Item_Click);
                 button.Style              = this.Resources["RiLiItemItem"] as Style;
                 riliitem.SpackpanelItem.Children.Add(button);
             }
         }
     }
     catch (Exception ex)
     {
         MethodLb.CreateLog(this.GetType().FullName, "ItemsAdd", ex.ToString(), entity);
     }
     finally
     {
     }
 }