using log4net;
using PdmSwPlugin.Commmon.Util.UI;
using PdmSwPlugin.Common.Entity.DrawAudit;
using PdmSwPlugin.Common.Interface;
using PdmSwPlugin.Common.Util.Http;
using SolidWorks.Interop.sldworks;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Windows;
namespace PdmSwPlugin.DrawApprove
{
///
/// XamlWindow.xaml 的交互逻辑
///
public partial class XamlWindow : Window, INotifyPropertyChanged, ISwAppSetter
{
#region ...
public virtual event PropertyChangedEventHandler PropertyChanged;
public virtual void RaisePropertyChanged(string name)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public void RaiseAndSetIfChanged(ref T old, T @new, [CallerMemberName] string propertyName = null)
{
old = @new;
if (propertyName != null)
{
RaisePropertyChanged(propertyName);
}
}
#endregion
private string _title;
public string title
{
get => _title;
set => RaiseAndSetIfChanged(ref _title, value);
}
public SldWorks SwApp => this.swApp;
private readonly DrawAudit drawInfo;
private readonly ILog Logger;
private readonly HttpClient Client;
private readonly SldWorks swApp;
public XamlWindow(string title, DrawAudit da, HttpClient Client, ILog Logger, SldWorks swApp)
{
this.title = title ?? string.Empty;
drawInfo = da;
this.Client = Client;
this.Logger = Logger;
this.swApp = swApp;
DataContext = this;
InitializeComponent();
}
private void Ok_Click(object sender, RoutedEventArgs e)
{
byte[] blob = richBox.GetBlob();
MaskAdorner.ShowMask(content, "请求中,请稍候...");
Task.Run(() =>
{
try
{
drawInfo.pass = false;
drawInfo.comment = "123";
drawInfo.commentBlob = blob;
Result