private void Button_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.FolderBrowserDialog folderBrowserDlg = new System.Windows.Forms.FolderBrowserDialog(); folderBrowserDlg.Description = "选择图片所在的文件夹..."; folderBrowserDlg.ShowNewFolderButton = true; folderBrowserDlg.RootFolder = Environment.SpecialFolder.MyComputer; if (folderBrowserDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { MessageBox.Show("请等待图片上传结束"); Cursor = Cursors.Wait; string folerName = folderBrowserDlg.SelectedPath; var result = UploadPic(folerName); SmileManagementViewModel vm = DataContext as SmileManagementViewModel; vm.AddSmiles(result, BuiltIns.SmileImageType.Id); MessageBox.Show("上传结束"); Cursor = Cursors.Arrow; } }
public SmileManagement() { DataContext = new SmileManagementViewModel(); InitializeComponent(); }