Skip to content

Commit

Permalink
Added image selection control
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoodworth committed Mar 25, 2013
1 parent 5166e91 commit 6f93003
Show file tree
Hide file tree
Showing 18 changed files with 2,353 additions and 2,143 deletions.
1,963 changes: 987 additions & 976 deletions DB/osae.sql

Large diffs are not rendered by default.

1,963 changes: 987 additions & 976 deletions DB/osae_040.sql

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion GUI2/GUI2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
14 changes: 14 additions & 0 deletions GUI2/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public void Load_Screen(string sScreen)
stateImages.Clear();
propLabels.Clear();
navImages.Clear();
methodImages.Clear();
cameraViewers.Clear();
canGUI.Children.Clear();

Expand Down Expand Up @@ -261,6 +262,19 @@ private void Update_Objects()
}
#endregion

#region CONTROL NAVIGATION IMAGE
else if (newCtrl.ControlType == "CONTROL METHOD IMAGE")
{
foreach (OSAE.UI.Controls.MethodImage method in methodImages)
{
if (newCtrl.ControlName == method.screenObject.Name)
{
oldCtrl = true;
}
}
}
#endregion

#region CONTROL CAMERA VIEWER
else if (newCtrl.ControlType == "CONTROL CAMERA VIEWER")
{
Expand Down
2 changes: 1 addition & 1 deletion Installer/DBInstall/DBInstall/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public partial class Form1 : Form
string directory = "";
string existing = "";
string current = "0.1.0";
string newVersion = "0.3.9";
string newVersion = "0.4.0";
string machine = "";
MySqlConnection connection;

Expand Down
18 changes: 13 additions & 5 deletions Installer/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Section -Prerequisites
${EndIf}
${Else}
File "dotNetFx40_Full_setup.exe"
ExecWait "$INSTDIR\dotNetFx40_Full_setup.exe"
ExecWait "$INSTDIR\dotNetFx40_Full_setup.exe /q /norestart"
${EndIf}
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x86" 'Installed'
${If} $0 == 1
Expand Down Expand Up @@ -108,12 +108,12 @@ Section Server s1
SetOutPath "$INSTDIR"
File "..\DB\osae.sql"
File "MySql.Data.dll"
File "mysql-5.5.21-win32.msi"
ExecWait 'msiexec /q /log "$INSTDIR\MySQLINstall.log" /i mysql-5.5.21-win32.msi installdir="$PROGRAMFILES\MySql"'
File "mysql-5.5.22-win32.msi"
ExecWait 'msiexec /q /log "$INSTDIR\MySQLINstall.log" /i mysql-5.5.22-win32.msi installdir="$PROGRAMFILES\MySql"'
SetOutPath "$PROGRAMFILES\MySql"
ExecWait '"$PROGRAMFILES\MySql\bin\mysqld.exe" --install MySQL --defaults-file="$PROGRAMFILES\MySql\my.ini"'
ExecWait '"$PROGRAMFILES\MySql\bin\MySQLInstanceConfig.exe" -i -q "-lc:mysql_install_log.txt" ServerType=DEVELOPMENT DatabaseType=MIXED ConnectionUsage=DSS Port=3306 RootPassword=password'
Delete "mysql-5.5.21-win32.msi"
Delete "mysql-5.5.22-win32.msi"
File "my.ini"

SimpleSC::RestartService "MySql" "" 30
Expand Down Expand Up @@ -178,6 +178,7 @@ Section Server s1
CreateDirectory "Email"
CreateDirectory "Jabber"
CreateDirectory "Network Monitor"
CreateDirectory "Rest"
CreateDirectory "Script Processor"
CreateDirectory "Speech"
CreateDirectory "Weather"
Expand All @@ -204,6 +205,11 @@ Section Server s1
File "..\output\Plugins\Network Monitor\Network Monitor.osapd"
File "..\output\Plugins\Network Monitor\OSAE.NetworkMonitor.dll"
File "..\output\Plugins\Network Monitor\Screenshot.jpg"

SetOutPath "$INSTDIR\Plugins\Rest"
File "..\output\Plugins\Rest\Rest.osapd"
File "..\output\Plugins\Rest\OSAE.Rest.dll"
File "..\output\Plugins\Rest\Screenshot.jpg"

SetOutPath "$INSTDIR\Plugins\Script Processor"
File "..\output\Plugins\Script Processor\Script Processor.osapd"
Expand Down Expand Up @@ -232,6 +238,7 @@ Section Server s1
CreateDirectory "mobile"
CreateDirectory "Images"
CreateDirectory "css"
CreateDirectory "js"

SetOutPath "$INSTDIR\Plugins\Web Server\wwwroot\bootstrap"
CreateDirectory "css"
Expand Down Expand Up @@ -266,7 +273,8 @@ Section Server s1
SetOutPath "$INSTDIR\Plugins\Web Server\wwwroot\css"
File "..\WebUI\css\*.*"


SetOutPath "$INSTDIR\Plugins\Web Server\wwwroot\js"
File "..\WebUI\js\*.*"

SetOutPath $INSTDIR
File "UltiDev.WebServer.msi"
Expand Down
12 changes: 10 additions & 2 deletions Installer/installer_x64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Section -Prerequisites
${EndIf}
${Else}
File "dotNetFx40_Full_setup.exe"
ExecWait "$INSTDIR\dotNetFx40_Full_setup.exe"
ExecWait "$INSTDIR\dotNetFx40_Full_setup.exe /q /norestart"
${EndIf}
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\VisualStudio\10.0\VC\VCRedist\x64" 'Installed'
${If} $0 == 1
Expand Down Expand Up @@ -181,6 +181,7 @@ Section Server s1
CreateDirectory "Email"
CreateDirectory "Jabber"
CreateDirectory "Network Monitor"
CreateDirectory "Rest"
CreateDirectory "Script Processor"
CreateDirectory "Speech"
CreateDirectory "Weather"
Expand All @@ -207,6 +208,11 @@ Section Server s1
File "..\output\Plugins\Network Monitor\Network Monitor.osapd"
File "..\output\Plugins\Network Monitor\OSAE.NetworkMonitor.dll"
File "..\output\Plugins\Network Monitor\Screenshot.jpg"

SetOutPath "$INSTDIR\Plugins\Rest"
File "..\output\Plugins\Rest\Rest.osapd"
File "..\output\Plugins\Rest\OSAE.Rest.dll"
File "..\output\Plugins\Rest\Screenshot.jpg"

SetOutPath "$INSTDIR\Plugins\Script Processor"
File "..\output\Plugins\Script Processor\Script Processor.osapd"
Expand Down Expand Up @@ -235,6 +241,7 @@ Section Server s1
CreateDirectory "mobile"
CreateDirectory "Images"
CreateDirectory "css"
CreateDirectory "js"

SetOutPath "$INSTDIR\Plugins\Web Server\wwwroot\bootstrap"
CreateDirectory "css"
Expand Down Expand Up @@ -269,7 +276,8 @@ Section Server s1
SetOutPath "$INSTDIR\Plugins\Web Server\wwwroot\css"
File "..\WebUI\css\*.*"


SetOutPath "$INSTDIR\Plugins\Web Server\wwwroot\js"
File "..\WebUI\js\*.*"

SetOutPath $INSTDIR
File "UltiDev.WebServer.msi"
Expand Down
17 changes: 8 additions & 9 deletions OSAE.UI.Controls/AddControlMethodImage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" Height="280" Width="500" Margin="20">
mc:Ignorable="d" Height="280" Width="410" Margin="20">
<Grid>
<Label Content="Object" Height="28" HorizontalAlignment="Left" Margin="11,92,0,0" x:Name="label" VerticalAlignment="Top" Width="73" />
<ComboBox Height="23" HorizontalAlignment="Left" Margin="128,92,0,0" x:Name="objectComboBox" VerticalAlignment="Top" Width="357" ItemsSource="{Binding Path=object_name}" DisplayMemberPath="object_name" SelectedValuePath="object_name" IsEditable="False" SelectionChanged="objectComboBox_SelectionChanged" />
<ComboBox Height="23" HorizontalAlignment="Left" Margin="128,92,0,0" x:Name="objectComboBox" VerticalAlignment="Top" Width="270" ItemsSource="{Binding Path=object_name}" DisplayMemberPath="object_name" SelectedValuePath="object_name" IsEditable="False" SelectionChanged="objectComboBox_SelectionChanged" />
<Label Content="Method" Height="28" HorizontalAlignment="Left" Margin="11,123,0,0" x:Name="label2" VerticalAlignment="Top" Width="73" />
<ComboBox Height="23" HorizontalAlignment="Left" Margin="128,128,0,0" x:Name="methodComboBox" VerticalAlignment="Top" Width="357" ItemsSource="{Binding Path=method_name}" DisplayMemberPath="method_name" SelectedValuePath="method_name" IsEditable="False"/>
<ComboBox Height="23" HorizontalAlignment="Left" Margin="128,128,0,0" x:Name="methodComboBox" VerticalAlignment="Top" Width="270" ItemsSource="{Binding Path=method_name}" DisplayMemberPath="method_name" SelectedValuePath="method_name" IsEditable="False"/>
<Label Content="Parameter 1" Height="28" HorizontalAlignment="Left" Margin="11,163,0,0" x:Name="label3" VerticalAlignment="Top" Width="73" />
<Label Content="Parameter 2" Height="28" HorizontalAlignment="Left" Margin="11,203,0,0" x:Name="label4" VerticalAlignment="Top" Width="73" />
<TextBox HorizontalAlignment="Left" Height="28" Margin="128,163,0,0" TextWrapping="Wrap" Name="txtParam1" VerticalAlignment="Top" Width="357"/>
<TextBox HorizontalAlignment="Left" Height="28" Margin="128,203,0,0" TextWrapping="Wrap" Name="txtParam2" VerticalAlignment="Top" Width="357"/>
<TextBox HorizontalAlignment="Left" Height="28" Margin="128,163,0,0" TextWrapping="Wrap" Name="txtParam1" VerticalAlignment="Top" Width="270"/>
<TextBox HorizontalAlignment="Left" Height="28" Margin="128,203,0,0" TextWrapping="Wrap" Name="txtParam2" VerticalAlignment="Top" Width="270"/>
<Button Content="Add" HorizontalAlignment="Left" Margin="11,248,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_3"/>
<Button Content="Cancel" HorizontalAlignment="Left" Margin="410,248,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_4"/>
<Button Content=".." HorizontalAlignment="Left" Margin="357,58,0,0" VerticalAlignment="Top" Width="24" Click="Button_Click_1"/>
<TextBox x:Name="txtImagePath" HorizontalAlignment="Left" Height="23" Margin="129,57,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="223"/>
<Button Content="Cancel" HorizontalAlignment="Left" Margin="323,248,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_4"/>
<Button Content="Select" HorizontalAlignment="Left" Margin="128,58,0,0" VerticalAlignment="Top" Width="51" Click="Button_Click_1"/>
<Label Content="Image" HorizontalAlignment="Left" Margin="11,54,0,0" VerticalAlignment="Top"/>
<Image HorizontalAlignment="Left" Height="75" Margin="395,5,0,0" VerticalAlignment="Top" Width="75" x:Name="imgMethod"/>
<Image HorizontalAlignment="Left" Height="75" Margin="198,5,0,0" VerticalAlignment="Top" Width="75" x:Name="imgMethod"/>


</Grid>
Expand Down
74 changes: 41 additions & 33 deletions OSAE.UI.Controls/AddControlMethodImage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace OSAE.UI.Controls
public partial class AddControlMethodImage : UserControl
{
private string currentScreen;
OSAEImage img = new OSAEImage();

public AddControlMethodImage(string screen)
{
Expand All @@ -35,32 +36,13 @@ private void LoadObjects()

private void Button_Click_3(object sender, RoutedEventArgs e)
{
string fileName = Path.GetFileName(txtImagePath.Text).Split('.')[0];
string ext = Path.GetFileName(txtImagePath.Text).Split('.')[1];

OSAEImageManager imgMgr = new OSAEImageManager();

int imgID = 0;
byte[] byt;

if (ext.ToLower() == "jpg" || ext.ToLower() == "jpeg")
{
byt = imgMgr.getJPGFromImageControl((BitmapImage)imgMethod.Source);
imgID = imgMgr.AddImage(fileName, ext, byt);
}
else if (ext.ToLower() == "png")
{
byt = imgMgr.getPNGFromImageControl((BitmapImage)imgMethod.Source);
imgID = imgMgr.AddImage(fileName, ext, byt);
}

string sName = currentScreen + " - " + objectComboBox.Text;
OSAEObjectManager.ObjectAdd(sName, sName, "CONTROL METHOD IMAGE", "", currentScreen, true);
OSAEObjectPropertyManager.ObjectPropertySet(sName, "Object Name", objectComboBox.Text, "GUI");
OSAEObjectPropertyManager.ObjectPropertySet(sName, "Method Name", methodComboBox.Text, "GUI");
OSAEObjectPropertyManager.ObjectPropertySet(sName, "Param 1", txtParam1.Text, "GUI");
OSAEObjectPropertyManager.ObjectPropertySet(sName, "Param 2", txtParam2.Text, "GUI");
OSAEObjectPropertyManager.ObjectPropertySet(sName, "Image", fileName, "GUI");
OSAEObjectPropertyManager.ObjectPropertySet(sName, "Image", img.Name, "GUI");
OSAEObjectPropertyManager.ObjectPropertySet(sName, "X", "100", "GUI");
OSAEObjectPropertyManager.ObjectPropertySet(sName, "Y", "100", "GUI");
OSAEObjectPropertyManager.ObjectPropertySet(sName, "Zorder", "1", "GUI");
Expand All @@ -72,7 +54,7 @@ private void Button_Click_3(object sender, RoutedEventArgs e)

private void Button_Click_4(object sender, RoutedEventArgs e)
{

NotifyParentFinished();
}

private void objectComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand All @@ -83,18 +65,14 @@ private void objectComboBox_SelectionChanged(object sender, SelectionChangedEven

private void Button_Click_1(object sender, RoutedEventArgs e)
{
// Configure open file dialog box
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.FileName = "Document"; // Default file name
dlg.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
"JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
"Portable Network Graphic (*.png)|*.png"; // Filter files by extension

if (dlg.ShowDialog() == true)
{
imgMethod.Source = new BitmapImage(new Uri(dlg.FileName));
txtImagePath.Text = dlg.FileName;
}
selectImageWindow dlgSelectImage = new selectImageWindow();
ctrlSelectImage si = new ctrlSelectImage();
si.ImagePicked += si_ImagePicked;
dlgSelectImage.Width = si.Width + 80;
dlgSelectImage.Height = si.Height + 80;
dlgSelectImage.Content = si;
dlgSelectImage.Show();

}

/// <summary>
Expand All @@ -109,5 +87,35 @@ private void NotifyParentFinished()
Window parentWindow = Window.GetWindow(this);
parentWindow.Close();
}

protected void si_ImagePicked(object sender, EventArgs e)
{
OSAEImageManager imgMgr = new OSAEImageManager();

img = imgMgr.GetImage((int)sender);
imgMethod.Source = LoadImage(img.Data);
}

private static BitmapImage LoadImage(byte[] imageData)
{
if (imageData == null || imageData.Length == 0) return null;
var image = new BitmapImage();
using (var mem = new MemoryStream(imageData))
{
mem.Position = 0;
image.BeginInit();
image.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
image.CacheOption = BitmapCacheOption.OnLoad;
image.UriSource = null;
image.StreamSource = mem;
image.EndInit();
}
image.Freeze();
return image;
}
}




}
3 changes: 1 addition & 2 deletions OSAE.UI.Controls/AddControlNavigationImage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" Height="308" Width="294" Margin="20">
<Grid>
<Button Name="btnOpen" Content=".." HorizontalAlignment="Left" Margin="263,43,0,0" VerticalAlignment="Top" Width="24" Click="btnOpen_Click" RenderTransformOrigin="2.833,1.273"/>
<TextBox x:Name="txtPath" HorizontalAlignment="Left" Height="23" Margin="83,42,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="175"/>
<Button Name="btnOpen" Content="Select" HorizontalAlignment="Left" Margin="83,44,0,0" VerticalAlignment="Top" Width="67" Click="btnOpen_Click" RenderTransformOrigin="2.833,1.273"/>
<Label Content="Image" HorizontalAlignment="Left" Margin="10,40,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtName" HorizontalAlignment="Left" Height="23" Margin="83,10,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="204"/>
<Label Content="Name" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/>
Expand Down
Loading

0 comments on commit 6f93003

Please sign in to comment.