-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thomas Kissinger
committed
Aug 12, 2017
1 parent
ad0b3f4
commit 09cc0c2
Showing
22 changed files
with
1,563 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 2012 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cmtviswpf", "cmtviswpf\cmtviswpf.csproj", "{FD3934D0-7922-46CD-8F60-4BCCBBEAAEF8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{FD3934D0-7922-46CD-8F60-4BCCBBEAAEF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{FD3934D0-7922-46CD-8F60-4BCCBBEAAEF8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{FD3934D0-7922-46CD-8F60-4BCCBBEAAEF8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{FD3934D0-7922-46CD-8F60-4BCCBBEAAEF8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bin | ||
obj |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Window x:Class="cmtviswpf.About" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
Title="About CMTVIS" Height="280" Width="454" WindowStyle="ToolWindow" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Background="#FF555555"> | ||
<Grid> | ||
<Label Content="CMTVIS" HorizontalAlignment="Left" Margin="94,10,0,0" VerticalAlignment="Top" Foreground="#FFB2E928" FontWeight="Bold" FontSize="36"/> | ||
<Label Content="for WPF" HorizontalAlignment="Left" Margin="244,23,0,0" VerticalAlignment="Top" Foreground="#FFB2E928" FontSize="24" FontStyle="Italic"/> | ||
<Label Content="© Database Technology Group, TU Dresden, 2013" HorizontalAlignment="Left" Margin="36,68,0,0" VerticalAlignment="Top" Foreground="#FFB2E928" FontSize="16" FontStyle="Italic"/> | ||
<Label Content="Version 1.0.0.0" HorizontalAlignment="Left" Margin="36,104,0,0" VerticalAlignment="Top" Foreground="#FFB2E928" FontSize="16" FontStyle="Italic"/> | ||
<Label Content="Further information:" HorizontalAlignment="Left" Margin="36,140,0,0" VerticalAlignment="Top" Foreground="#FFB2E928" FontSize="16" FontStyle="Italic"/> | ||
<Label Content="http://wwwdb.inf.tu-dresden.de/cmtvis" HorizontalAlignment="Left" Margin="116,171,0,0" VerticalAlignment="Top" Foreground="#FFB2E928" FontSize="16" FontStyle="Italic" MouseLeftButtonDown="Label_MouseLeftButtonDown_1" TouchDown="Label_TouchDown_1"/> | ||
<Button Content="Close" Background="#FFB2E928" Foreground="#FF555555" Margin="321,208,19,10" Click="Button_Click_1" /> | ||
|
||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace cmtviswpf | ||
{ | ||
/// <summary> | ||
/// Interaktionslogik für About.xaml | ||
/// </summary> | ||
public partial class About : Window | ||
{ | ||
public About() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void Button_Click_1(object sender, RoutedEventArgs e) | ||
{ | ||
this.Close(); | ||
} | ||
|
||
private void Label_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e) | ||
{ | ||
System.Diagnostics.Process.Start("http://wwwdb.inf.tu-dresden.de/cmtvis"); | ||
} | ||
|
||
private void Label_TouchDown_1(object sender, TouchEventArgs e) | ||
{ | ||
System.Diagnostics.Process.Start("http://wwwdb.inf.tu-dresden.de/cmtvis"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Controls; | ||
using System.Xml.Linq; | ||
|
||
namespace cmtviswpf | ||
{ | ||
public class Answer | ||
{ | ||
const string PLACEHOLDER = "REPLACE THIS WITH YOUR ANSWER"; | ||
|
||
public List<TextBox> textboxes = new List<TextBox>(); | ||
public List<RadioButton> radiobuttons = new List<RadioButton>(); | ||
public List<CheckBox> checkboxes = new List<CheckBox>(); | ||
public XElement element = null; | ||
|
||
public void setXML() | ||
{ | ||
if (textboxes.Count > 0) | ||
{ | ||
element.Value = textboxes[0].Text; | ||
return; | ||
} | ||
if (checkboxes.Count > 0) | ||
{ | ||
element.Value = checkboxes[0].IsChecked == true ? "Yes" : "No"; | ||
return; | ||
} | ||
bool found = false; | ||
foreach (RadioButton cb in radiobuttons) | ||
{ | ||
if (cb.IsChecked == true) | ||
{ | ||
element.Value = (string)cb.Content; | ||
found = true; | ||
break; | ||
} | ||
} | ||
if (!found) | ||
{ | ||
element.Value = PLACEHOLDER; | ||
} | ||
} | ||
|
||
|
||
public void setControl() | ||
{ | ||
if (textboxes.Count > 0) | ||
{ | ||
if (element.Value == PLACEHOLDER) | ||
{ | ||
textboxes[0].Text = ""; | ||
} | ||
else | ||
{ | ||
textboxes[0].Text = element.Value; | ||
} | ||
return; | ||
} | ||
if (checkboxes.Count > 0) | ||
{ | ||
checkboxes[0].IsChecked = element.Value == "Yes"; | ||
return; | ||
} | ||
foreach (RadioButton cb in radiobuttons) | ||
{ | ||
if (element.Value == PLACEHOLDER) | ||
{ | ||
cb.IsChecked = false; | ||
} | ||
else | ||
{ | ||
cb.IsChecked = element.Value == (string) cb.Content; | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Application x:Class="cmtviswpf.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace cmtviswpf | ||
{ | ||
/// <summary> | ||
/// Interaktionslogik für "App.xaml" | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
using System; | ||
using System.Windows.Forms; | ||
|
||
// ------------------------------------------------------------------ | ||
// Wraps System.Windows.Forms.OpenFileDialog to make it present | ||
// a vista-style dialog. | ||
// ------------------------------------------------------------------ | ||
|
||
namespace FolderSelect | ||
{ | ||
/// <summary> | ||
/// Wraps System.Windows.Forms.OpenFileDialog to make it present | ||
/// a vista-style dialog. | ||
/// </summary> | ||
public class FolderSelectDialog | ||
{ | ||
// Wrapped dialog | ||
System.Windows.Forms.OpenFileDialog ofd = null; | ||
|
||
/// <summary> | ||
/// Default constructor | ||
/// </summary> | ||
public FolderSelectDialog() | ||
{ | ||
ofd = new System.Windows.Forms.OpenFileDialog(); | ||
|
||
ofd.Filter = "Folders|\n"; | ||
ofd.AddExtension = false; | ||
ofd.CheckFileExists = false; | ||
ofd.DereferenceLinks = true; | ||
ofd.Multiselect = false; | ||
} | ||
|
||
#region Properties | ||
|
||
/// <summary> | ||
/// Gets/Sets the initial folder to be selected. A null value selects the current directory. | ||
/// </summary> | ||
public string InitialDirectory | ||
{ | ||
get { return ofd.InitialDirectory; } | ||
set { ofd.InitialDirectory = value == null || value.Length == 0 ? Environment.CurrentDirectory : value; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets/Sets the title to show in the dialog | ||
/// </summary> | ||
public string Title | ||
{ | ||
get { return ofd.Title; } | ||
set { ofd.Title = value == null ? "Select a folder" : value; } | ||
} | ||
|
||
/// <summary> | ||
/// Gets the selected folder | ||
/// </summary> | ||
public string FileName | ||
{ | ||
get { return ofd.FileName; } | ||
} | ||
|
||
#endregion | ||
|
||
#region Methods | ||
|
||
/// <summary> | ||
/// Shows the dialog | ||
/// </summary> | ||
/// <returns>True if the user presses OK else false</returns> | ||
public bool ShowDialog() | ||
{ | ||
return ShowDialog(IntPtr.Zero); | ||
} | ||
|
||
/// <summary> | ||
/// Shows the dialog | ||
/// </summary> | ||
/// <param name="hWndOwner">Handle of the control to be parent</param> | ||
/// <returns>True if the user presses OK else false</returns> | ||
public bool ShowDialog(IntPtr hWndOwner) | ||
{ | ||
bool flag = false; | ||
|
||
if (Environment.OSVersion.Version.Major >= 6) | ||
{ | ||
var r = new Reflector("System.Windows.Forms"); | ||
|
||
uint num = 0; | ||
Type typeIFileDialog = r.GetType("FileDialogNative.IFileDialog"); | ||
object dialog = r.Call(ofd, "CreateVistaDialog"); | ||
r.Call(ofd, "OnBeforeVistaDialog", dialog); | ||
|
||
uint options = (uint)r.CallAs(typeof(System.Windows.Forms.FileDialog), ofd, "GetOptions"); | ||
options |= (uint)r.GetEnum("FileDialogNative.FOS", "FOS_PICKFOLDERS"); | ||
r.CallAs(typeIFileDialog, dialog, "SetOptions", options); | ||
|
||
object pfde = r.New("FileDialog.VistaDialogEvents", ofd); | ||
object[] parameters = new object[] { pfde, num }; | ||
r.CallAs2(typeIFileDialog, dialog, "Advise", parameters); | ||
num = (uint)parameters[1]; | ||
try | ||
{ | ||
int num2 = (int)r.CallAs(typeIFileDialog, dialog, "Show", hWndOwner); | ||
flag = 0 == num2; | ||
} | ||
finally | ||
{ | ||
r.CallAs(typeIFileDialog, dialog, "Unadvise", num); | ||
GC.KeepAlive(pfde); | ||
} | ||
} | ||
else | ||
{ | ||
var fbd = new FolderBrowserDialog(); | ||
fbd.Description = this.Title; | ||
fbd.SelectedPath = this.InitialDirectory; | ||
fbd.ShowNewFolderButton = false; | ||
if (fbd.ShowDialog(new WindowWrapper(hWndOwner)) != DialogResult.OK) return false; | ||
ofd.FileName = fbd.SelectedPath; | ||
flag = true; | ||
} | ||
|
||
return flag; | ||
} | ||
|
||
#endregion | ||
} | ||
|
||
/// <summary> | ||
/// Creates IWin32Window around an IntPtr | ||
/// </summary> | ||
public class WindowWrapper : System.Windows.Forms.IWin32Window | ||
{ | ||
/// <summary> | ||
/// Constructor | ||
/// </summary> | ||
/// <param name="handle">Handle to wrap</param> | ||
public WindowWrapper(IntPtr handle) | ||
{ | ||
_hwnd = handle; | ||
} | ||
|
||
/// <summary> | ||
/// Original ptr | ||
/// </summary> | ||
public IntPtr Handle | ||
{ | ||
get { return _hwnd; } | ||
} | ||
|
||
private IntPtr _hwnd; | ||
} | ||
|
||
} |
Oops, something went wrong.