private void miAddGroup_Click(object sender, RoutedEventArgs ee)
        {
            CustomGroupTreeViewItem item = new CustomGroupTreeViewItem();

            item.Style = (base.FindResource("TreeViewItemStyle") as Style);
            string      id = CustomGroup.GetCustomGroupID();
            CustomGroup cc = new CustomGroup
            {
                Admin     = ServiceUtil.Instance.SessionService.Uid,
                GroupID   = id,
                GroupName = item.HeaderText
            };

            item.DataContext = cc;
            item.Tag         = id;
            CustomGroupManagerWindowViewModel viewModel = CustomGroupManagerWindowViewModel.GetInstance();

            item.CreateCustomItemEvent += delegate(object s, CustomGroupTreeViewItem.CustomEventArgs e)
            {
                if (e.Item != null)
                {
                    this.inWindow.Employee.FirstTreeView.Items.Add(e.Item);
                    CustomGroup c = e.Item.DataContext as CustomGroup;
                    if (c != null)
                    {
                        DataModel.Instance.CustomeGroupName.Add(c.GroupID, c);
                        viewModel.CreateCustomGroup(this.sessionService.Uid, c.GroupID, e.Item.HeaderText);
                    }
                }
            };
            item.DeleteCustomItemEvent += delegate(object s, CustomGroupTreeViewItem.CustomEventArgs e)
            {
                DataModel.Instance.CustomeGroupName.Remove(item.Tag.ToString());
                this.inWindow.Employee.FirstTreeView.Items.Remove(item);
                viewModel.DropCustomGroup((int)this.sessionService.Uid, item.Tag.ToString());
            };
            item.UpdateCustomItemEvent += delegate(object s, CustomGroupTreeViewItem.CustomEventArgs e)
            {
                if (DataModel.Instance.CustomeGroupName.ContainsKey(item.Tag.ToString()))
                {
                    DataModel.Instance.CustomeGroupName[item.Tag.ToString()].GroupName = item.HeaderText;
                    viewModel.UpdateCustomGroup((int)this.sessionService.Uid, item.Tag.ToString(), item.HeaderText);
                }
            };
            if (this.CreateCustomItemEvent != null)
            {
                this.CreateCustomItemEvent(this, new CustomGroupTreeViewItem.CustomEventArgs
                {
                    Item = item
                });
            }
            this.SetFocus(item);
            item.IsSelected = true;
        }
        private void miAddGroup_Click(object sender, RoutedEventArgs e)
        {
            CustomGroupTreeViewItem item = new CustomGroupTreeViewItem();

            item.Style = (base.FindResource("TreeViewItemStyle") as Style);
            item.CreateCustomItemEvent += delegate(object s, CustomGroupTreeViewItem.CustomEventArgs ee)
            {
                if (ee.Item != null)
                {
                    this.FirstTreeView.Items.Add(ee.Item);
                    string id = CustomGroup.GetCustomGroupID();
                    DataModel.Instance.CustomeGroupName.Add(id, new CustomGroup
                    {
                        GroupID   = id,
                        GroupName = ee.Item.HeaderText
                    });
                    this.customGroupManagerViewModel.CreateCustomGroup(this.sessionService.Uid, id, ee.Item.HeaderText);
                }
            };
            item.DeleteCustomItemEvent += delegate(object s, CustomGroupTreeViewItem.CustomEventArgs ee)
            {
                DataModel.Instance.CustomeGroupName.Remove(item.Tag.ToString());
                this.FirstTreeView.Items.Remove(item);
                this.customGroupManagerViewModel.DropCustomGroup((int)this.sessionService.Uid, item.Tag.ToString());
            };
            item.UpdateCustomItemEvent += delegate(object s, CustomGroupTreeViewItem.CustomEventArgs ee)
            {
                if (DataModel.Instance.CustomeGroupName.ContainsKey(item.Tag.ToString()))
                {
                    DataModel.Instance.CustomeGroupName[item.Tag.ToString()].GroupName = item.HeaderText;
                    this.customGroupManagerViewModel.UpdateCustomGroup((int)this.sessionService.Uid, item.Tag.ToString(), item.HeaderText);
                }
            };
            CustomGroup c = new CustomGroup
            {
                Admin     = this.sessionService.Uid,
                GroupID   = CustomGroup.GetCustomGroupID(),
                GroupName = item.HeaderText
            };

            item.DataContext = c;
            item.Tag         = c.GroupID;
            this.FirstTreeView.Items.Add(item);
            DataModel.Instance.CustomeGroupName.Add(c.GroupID, c);
            this.customGroupManagerViewModel.CreateCustomGroup(this.sessionService.Uid, c.GroupID, item.HeaderText);
            this.SetFocus(item);
            item.IsSelected = true;
        }