コード例 #1
0
 public DialogSetShoppingItem(ItemReader reader)
 {
     InitializeComponent();
     this.reader = reader;
     item        = new NodeItem(reader);
     SetCategiies();
 }
コード例 #2
0
 public DialogSetShoppingItem(NodeItem item, ItemReader reader)
 {
     InitializeComponent();
     this.item   = item;
     this.reader = reader;
     SetCategiies();
 }
コード例 #3
0
 public DialogNewCostDay(String parentTitle, ItemReader reader)
 {
     InitializeComponent();
     this.parentTitle = parentTitle;
     item             = new NodeItem(reader);
     InitializeList();
 }
コード例 #4
0
 public void CreateNewTreeFile_Recursive(ref StringBuilder builder, TreeNode node)
 {
     foreach (TreeNode child in node.children)
     {
         foreach (String actual in Months.months)
         {
             //todo hiba
             if (child.Title.Equals(actual))
             {
                 //save month
                 builder.AppendLine(String.Format(StringResources.SAVE_FORMAT_MONTH_START, child.Title));
                 CreateNewTreeFile_Recursive(ref builder, child);
                 builder.AppendLine(StringResources.SAVE_FORMAT_MONTH_END);
                 return;
             }
         }
         NodeItem item = child as NodeItem;
         if (item != null)
         {
             //CATEGORY NULL
             builder.AppendLine(String.Format(StringResources.SAVE_FORMAT_SHOPPING_ITEM_START, item.Title, item.Value, item.Description));
         }
         else
         {
             builder.AppendLine(String.Format(StringResources.SAVE_FORMAT_DAY_START, child.Title));
             CreateNewTreeFile_Recursive(ref builder, child);
             builder.AppendLine(StringResources.SAVE_FORMAT_DAY_END);
             return;
         }
     }
 }
コード例 #5
0
 public DialogModifyCostItem(NodeItem item, ItemReader reader)
 {
     this.item   = item;
     this.reader = reader;
     InitializeComponent();
     SetCategiies();
     InitializeValues();
 }
コード例 #6
0
 private void AddNewNode(NodeItem newNode, TreeViewItem newItem, TreeNode parentNode, TreeViewItem parent)
 {
     newItem.Tag    = newNode;
     newItem.Header = newNode.Value;
     parentNode.children.Add(newNode);
     parent.Items.Add(newItem);
     newItem.MouseRightButtonDown += AddItem_Click;
     newItem.MouseDoubleClick     += TreeNodeItem_DoubleClick;
     TreeItemViewMain.Items.Refresh();
 }
コード例 #7
0
        private void SetChildren(List <TreeNode> children, TreeViewItem parent)
        {
            if (children == null)
            {
                return;
            }
            foreach (TreeNode actual in children)
            {
                NodeItem nodeItem        = actual as NodeItem;
                bool     isSum           = (actual.Title != null) ? actual.Title.StartsWith(StringResources.SUM) : false;
                bool     isActualBalance = (actual.Title != null) ? actual.Title.StartsWith(StringResources.ACTUAL_BALANCE) : false;
                if (isSum)
                {
                    NodeItem separator = new NodeItem(nodeItem.reader);
                    separator.Title = StringResources.XML_SEPARATOR_DAILY_LIST_END;
                    TreeViewItem separatorItem = new TreeViewItem()
                    {
                        Header = separator.Title, IsExpanded = true
                    };
                    parent.Items.Add(separatorItem);
                    separatorItem.Tag = actual;
                }

                String header = actual.Title;
                if (nodeItem != null)
                {
                    header = String.Format("{0}{1}{2}", nodeItem.Title, END_TITLE_SIGN, nodeItem.Value, End_VALUE_SIGN, nodeItem.Description);
                }

                TreeViewItem item = new TreeViewItem()
                {
                    Header = header, IsExpanded = true
                };
                item.MouseRightButtonDown += AddItem_Click;
                item.MouseDoubleClick     += TreeNodeItem_DoubleClick;
                parent.Items.Add(item);
                item.Tag = actual;
                SetChildren(actual.children, item);
                if (isActualBalance)
                {
                    NodeItem separator = new NodeItem(nodeItem.reader)
                    {
                        Title = StringResources.XML_SEPARATOR_DAY
                    };
                    TreeViewItem separatorItem = new TreeViewItem()
                    {
                        Header = separator.Title, IsExpanded = true
                    };
                    parent.Items.Add(separatorItem);
                    separatorItem.Tag = actual;
                }
            }
        }
コード例 #8
0
        private void Calendar_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TreeNode month = GetMonth(Calendar_New_Item.SelectedDate.Value.Month);

            if (IsnewMonth(month))
            {
                months.Add(month);
            }

            NodeItem item = new NodeItem(reader);
            DialogSetShoppingItem dialog = new DialogSetShoppingItem(item, reader);

            dialog.ShowDialog();
            //month.children.Add(item);
            String stringDay = Calendar_New_Item.SelectedDate.Value.Day.ToString();

            AddItemToMonth(month, stringDay, item);
        }
コード例 #9
0
        private void TreeNodeItem_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            TreeViewItem item = sender as TreeViewItem;

            if (item == null)
            {
                return;
            }
            NodeItem node = item.Tag as NodeItem;

            if (node == null)
            {
                return;
            }
            DialogModifyCostItem dialog = new DialogModifyCostItem(node, reader);

            dialog.ShowDialog();
            item.IsExpanded = true;
            item.Header     = String.Format("{0}{1}{2}", node.Title, END_TITLE_SIGN, node.Value, End_VALUE_SIGN, node.Description);
            TreeItemViewMain.Items.Refresh();
        }