-
Notifications
You must be signed in to change notification settings - Fork 979
Expand file tree
/
Copy pathExample.cs
More file actions
56 lines (49 loc) · 1.64 KB
/
Example.cs
File metadata and controls
56 lines (49 loc) · 1.64 KB
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
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Example.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace WpfExamples
{
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
public class Example
{
public Example(Type mainWindowType, string title = null, string description = null)
{
this.MainWindowType = mainWindowType;
this.Title = title ?? mainWindowType.Namespace;
this.Description = description;
try
{
this.Thumbnail = new BitmapImage(new Uri("pack://application:,,,/Images/" + this.ThumbnailFileName));
}
catch (Exception e)
{
Debug.WriteLine(e);
}
}
public string Title { get; private set; }
public string Description { get; set; }
private Type MainWindowType { get; set; }
public ImageSource Thumbnail { get; set; }
public string ThumbnailFileName
{
get
{
return this.MainWindowType.Namespace + ".png";
}
}
public override string ToString()
{
return this.Title;
}
public Window Create()
{
return Activator.CreateInstance(this.MainWindowType) as Window;
}
}
}