-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWTPicture.cs
71 lines (61 loc) · 1.96 KB
/
WTPicture.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Dapper;
using DapperExtensions;
using WTCOMPLib;
using WinToolAG.Base;
namespace WTUSA
{
public class WTPicture : IWTItem
{
private WinToolAG.Base.WTComp wtc;
private IWTItem _parentItem;
//private string _filename;
public WTPicture(IWTItem parent)
{
if (parent != null)
{
_parentItem = parent;
var wtreg = new WTRegistry();
wtc = WTUSA.WTUSA_WTComp.GetComponentDrawing((int)_parentItem.PKID);
var wtcon = WTConnection.GetConnection();
//_filename = wtcon.Query("select partpics.dxffullfilename from partpics inner join parts on partpics.id = parts.partpicid where parts.id = @partId", new { partId = _parentItem.PKID }).First();
Filename = wtcon.Query<string>("select partpics.dxffullfilename from partpics inner join parts on partpics.[id] = parts.partpicid where parts.[id] = @partsID", new { partsID = _parentItem.PKID }).Single();
}
else
{
_parentItem = null;
}
}
public string Filename
{
get; set;
}
~WTPicture()
{
//Marshal.ReleaseComObject(wtc);
}
public void WritePictureFromDXF(string filename)
{
var wtreg = new WTRegistry();
WTUSA.WTUSA_WTComp.WriteDXFToComponent(filename,(string)_parentItem.PKID);
}
public override string IdOrNr()
{
//PartPic uses "ID"
return "ID";
}
public override void Show()
{
//show the picture window
throw new NotImplementedException();
}
public override string ToString()
{
throw new NotImplementedException();
}
}
}