-
-
Notifications
You must be signed in to change notification settings - Fork 187
/
MainForm.cs
65 lines (57 loc) · 1.84 KB
/
MainForm.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DiffPlex.WindowsForms.Controls;
using TestData = DiffPlex.Wpf.Demo.TestData;
namespace DiffPlex.WindowsForms
{
public partial class MainForm : Form
{
/// <summary>
/// The diff viewer control.
/// </summary>
private DiffViewer diffView;
/// <summary>
/// Initializes a new instance of the Form2 class.
/// </summary>
public MainForm()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
var now = DateTime.Now;
var isDark = now.Hour < 6 || now.Hour >= 18;
BackColor = isDark ? Color.FromArgb(255, 32, 32, 32) : Color.FromArgb(255, 251, 251, 251);
diffView = new DiffViewer
{
Margin = new Padding(0),
Dock = DockStyle.Fill,
ForeColor = isDark ? Color.FromArgb(255, 240, 240, 240) : Color.FromArgb(255, 32, 32, 32),
OldText = TestData.DuplicateText(TestData.OldText, 20),
NewText = TestData.DuplicateText(TestData.NewText, 20)
};
MainLayoutPanel.Controls.Add(diffView, 0, 0);
diffView.SetHeaderAsOldToNew();
}
private void SwitchButton_Click(object sender, EventArgs e)
{
if (diffView.IsInlineViewMode)
{
diffView.ShowSideBySide();
return;
}
diffView.ShowInline();
}
private void FutherActionsButton_Click(object sender, EventArgs e)
{
diffView.OpenViewModeContextMenu();
}
}
}