Exemplo n.º 1
0
        /// <summary>
        /// 新增Tag
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TagsViewNewMenu_Clicked(object sender, RoutedEventArgs e)
        {
            if (viewModel.SelectedTreeNode == null)
            {
                return;
            }

            var window = new TagEditWindow();

            window.Owner = this;
            var ret = window.ShowDialog();

            if (ret == null)
            {
                return;
            }

            if ((viewModel.SelectedTreeNode.ConfigItem as Group).Tags == null)
            {
                (viewModel.SelectedTreeNode.ConfigItem as Group).Tags = new List <Tag>();
            }

            (viewModel.SelectedTreeNode.ConfigItem as Group).Tags.Add(ret);
            viewModel.TagCollection.Add(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 编辑Tag
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TagsViewEditMenu_Clicked(object sender, RoutedEventArgs e)
        {
            if (viewModel.SelectedTag == null)
            {
                return;
            }

            var window = new TagEditWindow(viewModel.SelectedTag);

            window.Owner = this;
            var ret = window.ShowDialog();

            if (ret == null)
            {
                return;
            }

            viewModel.SelectedTag.TagName       = ret.TagName;
            viewModel.SelectedTag.DeviceAddress = ret.DeviceAddress;
            viewModel.SelectedTag.Size          = ret.Size;
        }