Beispiel #1
0
 private void link_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (MessageBox.Show("确定删除?", "确认提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         Attachment attach = (sender as Label).DataContext as Attachment;
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         if (client.DelAttachmentById(attach.AttachmentId, attach.Path))
         {
             ConfigUtil config    = new ConfigUtil("FILEPATH");
             string     directory = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, config.Get("FILEPATH"));
             string     filepath  = System.IO.Path.Combine(directory, attach.Path);
             File.Delete(filepath);
             (sender as Label).Visibility = Visibility.Hidden;
         }
     }
 }
 private void link_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (MessageBox.Show("确定删除?", "确认提示", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) {
         Attachment attach = (sender as Label).DataContext as Attachment;
         MoldPartInfoServiceClient client = new MoldPartInfoServiceClient();
         if (client.DelAttachmentById(attach.AttachmentId,attach.Path)) {
             ConfigUtil config = new ConfigUtil("FILEPATH");
             string directory = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, config.Get("FILEPATH"));
             string filepath = System.IO.Path.Combine(directory, attach.Path);
             File.Delete(filepath);
             (sender as Label).Visibility=Visibility.Hidden;
         }
     }
 }