Skip to content

Commit

Permalink
2.0.0 Stable Version
Browse files Browse the repository at this point in the history
  • Loading branch information
Catboy96 committed Apr 2, 2018
1 parent 42bed6c commit 1529b42
Show file tree
Hide file tree
Showing 11 changed files with 367 additions and 224 deletions.
6 changes: 3 additions & 3 deletions Automator/Automator/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
</configuration>
</configuration>
20 changes: 10 additions & 10 deletions Automator/Automator/Automator.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Automator</RootNamespace>
<AssemblyName>Automator</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<MyType>Custom</MyType>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -50,24 +51,24 @@
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="ExtraTools, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\DialogBoxForMaterialDesignToolkitInXaml.1.0.0\lib\net45\ExtraTools.dll</HintPath>
</Reference>
<Reference Include="MaterialDesignColors, Version=1.1.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignColors.1.1.3\lib\net45\MaterialDesignColors.dll</HintPath>
</Reference>
<Reference Include="MaterialDesignThemes.Wpf, Version=2.4.0.1044, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.2.4.0.1044\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml.Serialization" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand All @@ -94,7 +95,6 @@
<ItemGroup>
<Import Include="System.Threading.Tasks" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
Expand Down
313 changes: 182 additions & 131 deletions Automator/Automator/MainWindow.xaml

Large diffs are not rendered by default.

105 changes: 99 additions & 6 deletions Automator/Automator/MainWindow.xaml.vb
Original file line number Diff line number Diff line change
@@ -1,26 +1,119 @@
Class MainWindow
Imports System.Windows.Forms
Imports ExtraTools

Class MainWindow

Private Sub btnNewFile_Click(sender As Object, e As RoutedEventArgs)
If txtCode.Text <> "" Then
If MessageBox.Show("Create a new file? All unsaved changes will be lost.", "", MessageBoxButton.YesNo, MessageBoxImage.Question) = MessageBoxResult.Yes Then
DialogBox.Show("Create a new file?", "All unsaved changes will be lost.", "YES", "NO")
If DialogBox.Result = DialogBox.ResultEnum.LeftButtonClicked Then
txtCode.Clear()
End If
End If
End Sub

Private Sub btnSave_Click(sender As Object, e As RoutedEventArgs)

Dim strOut As String = "#include ""DigiKeyboard.h""" & vbCrLf & vbCrLf
If tgbLoop.IsChecked = True Then
strOut = strOut & "void setup() {}" & vbCrLf & vbCrLf
strOut = strOut & "void loop() {" & vbCrLf & "DigiKeyboard.sendKeyStroke(0);" & vbCrLf & "DigiKeyboard.delay(1000);" & vbCrLf
Else
strOut = strOut & "void loop() {}" & vbCrLf & vbCrLf
strOut = strOut & "void setup() {" & vbCrLf & "DigiKeyboard.sendKeyStroke(0);" & vbCrLf & "DigiKeyboard.delay(1000);" & vbCrLf
End If
strOut = strOut & txtCode.Text & vbCrLf & "}"
Dim sfd As New SaveFileDialog
With sfd
.AddExtension = True
.CheckPathExists = True
.DefaultExt = "ino"
.Filter = "Arduino Code File | *.ino"
.Title = "Save Arduino code to..."
End With
If sfd.ShowDialog() = Forms.DialogResult.OK Then
Dim sw As New IO.StreamWriter(sfd.FileName, False, Text.Encoding.UTF8)
sw.Write(strOut)
sw.Close()
sw.Dispose()
End If
End Sub

Private Sub btnInput_Click(sender As Object, e As RoutedEventArgs)
If tgbReturn.IsChecked = True Then
txtCode.AppendText("DigiKeyboard.println("""");")
txtCode.AppendText(vbCrLf & "DigiKeyboard.println("""");")
Else
txtCode.AppendText("DigiKeyboard.print("""");")
txtCode.AppendText(vbCrLf & "DigiKeyboard.print("""");")
End If
End Sub

Private Sub btnDelay_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText("DigiKeyboard.delay();")
txtCode.AppendText(vbCrLf & "DigiKeyboard.delay();")
End Sub

Private Sub btnAdd_Click(sender As Object, e As RoutedEventArgs)
If lstKeys.SelectedItems.Count = 0 Or cboKey.Text = "" Then Exit Sub
Dim strAdd As String = $"DigiKeyboard.sendKeyStroke(KEY_{cboKey.Text}, "
Dim flgPrimKey As Boolean = False
If keyCmd.IsSelected = True Then
strAdd &= "MOD_GUI_LEFT"
flgPrimKey = True
End If
If keyOption.IsSelected = True Then
If flgPrimKey = True Then
strAdd &= " | MOD_ALT_LEFT"
Else
strAdd &= "MOD_ALT_LEFT"
flgPrimKey = True
End If
End If
If keyControl.IsSelected = True Then
If flgPrimKey = True Then
strAdd &= " | MOD_CONTROL_LEFT"
Else
strAdd &= "MOD_CONTROL_LEFT"
flgPrimKey = True
End If
End If
If keyShift.IsSelected = True Then
If flgPrimKey = True Then
strAdd &= " | MOD_SHIFT_LEFT"
Else
strAdd &= "MOD_SHIFT_LEFT"
End If
End If
strAdd &= ");"
txtCode.AppendText(vbCrLf & strAdd)
End Sub

Private Sub btnSendGUI_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(0, MOD_GUI_LEFT);")
End Sub

Private Sub btnSendReturn_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ENTER);")
End Sub

Private Sub btnSendSpace_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_SPACE);")
End Sub

Private Sub btnSendDown_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_DOWN);")
End Sub

Private Sub btnSendUp_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_UP);")
End Sub

Private Sub btnSendLeft_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_LEFT);")
End Sub

Private Sub btnSendRight_Click(sender As Object, e As RoutedEventArgs)
txtCode.AppendText(vbCrLf & "DigiKeyboard.sendKeyStroke(KEY_ARROW_RIGHT);")
End Sub

Private Sub btnInfo_Click(sender As Object, e As RoutedEventArgs)
Process.Start("https://github.com/CYRO4S/Automator")
End Sub
End Class
51 changes: 26 additions & 25 deletions Automator/Automator/My Project/Resources.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 45 additions & 47 deletions Automator/Automator/My Project/Settings.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1529b42

Please sign in to comment.