Exemplo n.º 1
0
        private void TextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            if (sender == TextBox_Name)
            {
                if (string.IsNullOrEmpty(TextBox_Name.Text))
                {
                    MainWindow.ShowNoticeDialog("提示", "名称不能为空。");
                    TextBox_Name.Text = RemoteItems.ItemRemoteLink.Name;
                    return;
                }
                else
                {
                    RemoteItems.ItemRemoteLink.Name = TextBox_Name.Text;
                    if (PART_RemoteTree.SelectedItem != null)
                    {
                        RemoteItems.UpdateItemRemoteLink();
                        RemoteItems.SetItemName((RemoteTreeViewItem)PART_RemoteTree.SelectedItem, RemoteItems.ItemRemoteLink.Name);
                        return;
                    }
                }
            }

            if (sender == TextBox_Password)
            {
                RemoteItems.ItemRemoteLink.Password = TextBox_Password.Password;
            }

            RemoteItems.UpdateItemRemoteLink();
        }
Exemplo n.º 2
0
        private void Home_Tree_EditHeaderClosing(object sender, CancelEditEventArgs e)
        {
            e.Cancel = true;
            RemoteTreeViewItem treeItem = sender as RemoteTreeViewItem;

            if (treeItem == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(e.NewValue))
            {
                MainWindow.ShowNoticeDialog("提示", "名称不能为空");
                return;
            }

            if (treeItem.RemoteType == RemoteType.dir)
            {
                RemoteItems.GetItemDirectory(treeItem.uuid);
                RemoteItems.ItemDirectory.Name = e.NewValue;
                RemoteItems.UpdateItemDirectory();
            }
            else if (RemoteItems.ItemRemoteLink != null && RemoteItems.ItemRemoteLink.Id == treeItem.uuid)
            {
                RemoteItems.ItemRemoteLink.Name = e.NewValue;
                RemoteItems.UpdateItemRemoteLink();
                TextBox_Name.Text = e.NewValue;
            }

            RemoteItems.SetItemName(treeItem, e.NewValue);
        }