Exemple #1
0
        /// <summary>
        /// 创建一个添加标签的对话框
        /// </summary>
        public static AddOrRenameTagDialog MakeAddTagDialog()
        {
            var dialog = new AddOrRenameTagDialog
            {
                Title = "添加标签"
            };

            dialog.tagNameTxtbox.Focus();
            return(dialog);
        }
Exemple #2
0
        /// <summary>
        /// 创建一个重命名标签的对话框
        /// </summary>
        /// <param name="tagName">当前标签名</param>
        public static AddOrRenameTagDialog MakeRenameTagDialog(string tagName)
        {
            var dialog = new AddOrRenameTagDialog
            {
                Title = "重命名标签"
            };

            dialog.tagNameTxtbox.Text = tagName;
            dialog.tagNameTxtbox.Focus();
            dialog.tagNameTxtbox.SelectAll();
            return(dialog);
        }
Exemple #3
0
        /// <summary>
        /// 添加标签
        /// </summary>
        private async void AddTagBtn_Click(object sender, RoutedEventArgs e)
        {
            var dialog = AddOrRenameTagDialog.MakeAddTagDialog();

            dialog.Owner = this;
            bool result = dialog.ShowDialog().GetValueOrDefault(false);

            if (result)
            {
                string tagName = dialog.TagName;
                await winVM.AddTagAsync(tagName);
            }
        }
Exemple #4
0
        /// <summary>
        /// 重命名标签
        /// </summary>
        private async void RenameTagMenuItem_Click(object sender, RoutedEventArgs e)
        {
            string currentName = winVM.CurrentTagName;

            if (currentName == null)
            {
                return;
            }
            var dialog = AddOrRenameTagDialog.MakeRenameTagDialog(currentName);

            dialog.Owner = this;
            if (dialog.ShowDialog().GetValueOrDefault(false))
            {
                string newTagName = dialog.TagName;
                await winVM.RenameSelectedTagAsync(newTagName);
            }
        }