-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataTypeForm.cs
68 lines (56 loc) · 1.45 KB
/
DataTypeForm.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
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Logos4Lib;
namespace Logos4ComApiDemo
{
public partial class DataTypeForm : Form
{
public DataTypeForm()
{
m_history = new Stack<LogosDataType>();
InitializeComponent();
UpdateControls();
}
public LogosDataType DataType
{
get { return m_dataType; }
set { SetDataType(value, false); }
}
private void SetDataType(LogosDataType dataType, bool bInHistory)
{
if (!bInHistory && m_dataType != null)
m_history.Push(m_dataType);
m_dataType = dataType;
UpdateControls();
DataTypeTextBox.Text = dataType.Alias;
TitleTextBox.Text = dataType.Title;
SortTitleTextBox.Text = dataType.SortTitle;
AbbrevTextBox.Text = dataType.AbbreviatedTitle;
ThePanel.Controls.Clear();
object details = dataType.Details;
if (details is ILogosBibleDataTypeDetails)
ThePanel.Controls.Add(new BibleDataTypePane(dataType));
}
private void BackLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
if (m_history.Count != 0)
{
SetDataType(m_history.Pop(), true);
UpdateControls();
}
}
private void ParseTextBox_TextChanged(object sender, EventArgs e)
{
ParseLink.Reference = m_dataType.ParseReference(ParseTextBox.Text);
UpdateControls();
}
private void UpdateControls()
{
BackLink.Visible = m_history.Count != 0;
}
LogosDataType m_dataType;
readonly Stack<LogosDataType> m_history;
}
}