Skip to content

Commit 3931e9d

Browse files
committed
Misc changes that wrap up RC5
1 parent 19a46db commit 3931e9d

File tree

9 files changed

+353
-245
lines changed

9 files changed

+353
-245
lines changed

DB/0.4.7-0.4.8.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,7 @@ CALL osae_sp_object_type_property_add('PERSON','PIN','Password','','',0);
10461046
CALL osae_sp_object_type_update ('WEATHER','WEATHER','Weather Data','SYSTEM','THING',0,1,0,1);
10471047
CALL osae_sp_object_type_update ('COMPUTER','COMPUTER','Core Type: Computer','','THING',0,1,1,1);
10481048
CALL osae_sp_object_type_update ('SERVICE','SERVICE','OSA Service','','SERVICE',0,1,1,1);
1049+
CALL osae_sp_object_type_property_add('THING','URL','String','','',0);
10491050

10501051
CALL osae_sp_object_type_property_add('GUI CLIENT','Current Screen','String','','',0);
10511052
CALL osae_sp_object_type_property_add('GUI CLIENT','Default Screen','String','','',0);

DB/osae.sql

Lines changed: 293 additions & 218 deletions
Large diffs are not rendered by default.

Plugins/OSAE.Email/Email.cs

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,44 @@
33
using System;
44
using System.Net;
55
using System.Net.Mail;
6+
using System.ComponentModel;
67

78
public class Email : OSAEPluginBase
89
{
910
string gAppName;
11+
private OSAE.General.OSAELog Log;
1012

11-
private OSAE.General.OSAELog Log;// = new General.OSAELog();
12-
1313
public override void ProcessCommand(OSAEMethod method)
1414
{
1515
//process command
1616
try
17-
{
18-
string to = string.Empty;
17+
{
18+
1919
string parameter2 = string.Empty;
2020
string subject = string.Empty;
2121
string body = string.Empty;
22-
OSAEObjectProperty prop = OSAEObjectPropertyManager.GetObjectPropertyValue(method.Parameter1, "Email Address");
23-
24-
if (prop != null) to = prop.Value;
25-
if (to == string.Empty) to = method.Parameter1;
2622

2723
// To
28-
MailMessage mailMsg = new MailMessage();
29-
mailMsg.To.Add(to);
24+
MailAddress to;
25+
OSAEObjectProperty prop = OSAEObjectPropertyManager.GetObjectPropertyValue(method.Parameter1, "Email Address");
26+
if (prop != null)
27+
{
28+
if (prop.Value == string.Empty) to = new MailAddress(method.Parameter1);
29+
else to = new MailAddress(prop.Value);
30+
}
31+
else
32+
to = new MailAddress(method.Parameter1);
3033

3134
// From
32-
MailAddress mailAddress = new MailAddress(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "From Address").Value);
33-
mailMsg.From = mailAddress;
35+
MailAddress from = new MailAddress(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "From Address").Value);
36+
37+
MailMessage mailMsg = new MailMessage(from, to);
3438

3539
// Subject and Body
3640
mailMsg.Subject = "Message from OSAE";
3741
mailMsg.Body = Common.PatternParse(method.Parameter2);
42+
mailMsg.BodyEncoding = System.Text.Encoding.UTF8;
43+
3844
parameter2 = Common.PatternParse(method.Parameter2);
3945

4046
// Make sure there is a body of text.
@@ -56,6 +62,8 @@ public override void ProcessCommand(OSAEMethod method)
5662
if (subject.Equals(string.Empty))
5763
{
5864
mailMsg.Subject = "Message from OSAE";
65+
mailMsg.SubjectEncoding = System.Text.Encoding.UTF8;
66+
5967
mailMsg.Body = parameter2;
6068
}
6169
else
@@ -80,21 +88,34 @@ public override void ProcessCommand(OSAEMethod method)
8088
Log.Info("from: " + mailMsg.From);
8189
Log.Info("subject: " + mailMsg.Subject);
8290
Log.Info("body: " + mailMsg.Body);
83-
Log.Info("smtpServer: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "SMTP Server").Value);
84-
Log.Info("smtpPort: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "SMTP Port").Value);
91+
Log.Info("smtpServer: " + smtpClient.Host);
92+
Log.Info("smtpPort: " + smtpClient.Port);
8593
Log.Info("username: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Username").Value);
8694
Log.Info("password: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Password").Value);
87-
Log.Info("ssl: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "ssl").Value);
95+
Log.Info("ssl: " + smtpClient.EnableSsl);
96+
smtpClient.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
97+
string userState = "test message1";
98+
smtpClient.SendAsync(mailMsg, userState);
8899

89-
smtpClient.Send(mailMsg);
100+
//smtpClient.Send(mailMsg);
90101
}
91102
catch (Exception ex)
92103
{ Log.Error("Error Sending email" , ex); }
93104
}
94105

95-
/// <summary>
96-
/// Interface implementation, this plugin does not perform any actions on shutdown
97-
/// </summary>
106+
public void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
107+
{
108+
// Get the unique identifier for this asynchronous operation.
109+
String token = (string)e.UserState;
110+
111+
if (e.Cancelled) Log.Info(token + " Send canceled.");
112+
113+
if (e.Error != null)
114+
Log.Info(token + " " +e.Error.ToString());
115+
else
116+
Log.Info("Message sent.");
117+
}
118+
98119
public override void Shutdown()
99120
{
100121
Log.Info("*** Shutting Down ***");
@@ -108,8 +129,11 @@ public override void RunInterface(string pluginName)
108129
Log.Info("Email Plugin is Starting...");
109130

110131
OwnTypes();
132+
111133
}
112134

135+
136+
113137
public void OwnTypes()
114138
{
115139
//Added the follow to automatically own Speech Base types that have no owner.

Plugins/OSAE.ScriptProcessor/ScriptProcessor.vb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ Public Class ScriptProcessor
349349
If oTemp.Type <> sValue Then
350350
sNesting(iNestingLevel) = "FAIL"
351351
End If
352+
ElseIf sOption.ToUpper = "NAME" Then
353+
Dim oTemp As OSAEObject
354+
oTemp = OSAE.OSAEObjectManager.GetObjectByName(sObject)
355+
If oTemp.Name <> sValue Then
356+
sNesting(iNestingLevel) = "FAIL"
357+
End If
352358
Else
353359
pProperty = OSAEObjectPropertyManager.GetObjectPropertyValue(sObject, sOption)
354360
If pProperty.DataType = "String" Then pProperty.Value = pProperty.Value.ToUpper

UI/OSAE.UI.Controls/AddControlClickImage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@
7171
</TransformGroup>
7272
</TextBox.RenderTransform>
7373
</TextBox>
74-
<TextBox x:Name="txtNormalX" HorizontalAlignment="Left" Height="22" Margin="224,33,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="42" Text="100" IsEnabled="False"/>
75-
<TextBox x:Name="txtNormalY" HorizontalAlignment="Left" Height="22" Margin="224,59,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="42" RenderTransformOrigin="0.534,2.077" Text="100" IsEnabled="False"/>
74+
<TextBox x:Name="txtNormalX" HorizontalAlignment="Left" Height="22" Margin="224,33,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="42" Text="100"/>
75+
<TextBox x:Name="txtNormalY" HorizontalAlignment="Left" Height="22" Margin="224,59,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="42" RenderTransformOrigin="0.534,2.077" Text="100"/>
7676
<Label Content="X" HorizontalAlignment="Left" Margin="202,29,0,0" VerticalAlignment="Top" IsEnabled="False"/>
7777
<Label Content="Y" HorizontalAlignment="Left" Margin="202,62,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.588,1.846" IsEnabled="False"/>
7878
<Label Content="ZOrder" HorizontalAlignment="Left" Margin="171,88,0,0" VerticalAlignment="Top" IsEnabled="False"/>

UI/OSAE.UI.Controls/AddControlClickImage.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public AddControlClickImage(string screen, string user,string controlName = "")
3939
// We have a hit, this is an Update call, se call the preload
4040
sMode = "Update";
4141
sOriginalName = controlName;
42-
txtControlName.Text = controlName;
4342
LoadCurrentScreenObject(controlName);
43+
txtControlName.Text = sOriginalName;
4444
}
4545
}
4646

@@ -114,7 +114,7 @@ private void LoadCurrentScreenObject(string controlName)
114114
/// </summary>
115115
private void LoadObjects()
116116
{
117-
DataSet dataSet = OSAESql.RunSQL("SELECT object_name FROM osae_v_object order by object_name");
117+
DataSet dataSet = OSAESql.RunSQL("SELECT object_name FROM osae_v_object WHERE object_type !='SCREEN' AND base_type != 'CONTROL' order by object_name");
118118
cboPressObject.ItemsSource = dataSet.Tables[0].DefaultView;
119119
cboReleaseObject.ItemsSource = dataSet.Tables[0].DefaultView;
120120
DataSet dataSet2 = OSAESql.RunSQL("SELECT script_name FROM osae_script order by script_name");

UI/OSAE.UI.Controls/AddControlStateImage.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,9 @@ private void btnLoadS2I4_Click(object sender, RoutedEventArgs e)
435435

436436
private void cboObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
437437
{
438-
DataSet dataSet = OSAESql.RunSQL("SELECT state_label, state_name FROM osae_v_object_state where object_name = '" + cboObject.SelectedValue + "' order by state_label");
438+
DataSet dataSet = OSAESql.RunSQL("SELECT state_label, state_name FROM osae_v_object_state where object_name = '" + cboObject.SelectedValue.ToString().Replace("'", "''") + "' order by state_label");
439439
cboState1.ItemsSource = dataSet.Tables[0].DefaultView;
440-
DataSet dataSet2 = OSAESql.RunSQL("SELECT method_label, method_name FROM osae_v_object_method where object_name = '" + cboObject.SelectedValue + "' order by method_label");
440+
DataSet dataSet2 = OSAESql.RunSQL("SELECT method_label, method_name FROM osae_v_object_method where object_name = '" + cboObject.SelectedValue.ToString().Replace("'", "''") + "' order by method_label");
441441
cboSliderMethod.ItemsSource = dataSet2.Tables[0].DefaultView;
442442

443443
// The Screen - Object Is default name for the screen control, so update it based on the selection here
@@ -762,7 +762,7 @@ private void cboState1_SelectionChanged(object sender, SelectionChangedEventArgs
762762
btnLoadS1I1.IsEnabled = true;
763763
imgState1Img1.IsEnabled = true;
764764
cboState2.IsEnabled = true;
765-
DataSet dataSet = OSAESql.RunSQL("SELECT state_label, state_name FROM osae_v_object_state where object_name = '" + cboObject.SelectedValue + "' AND state_name !='" + cboState1.SelectedValue + "' order by state_label");
765+
DataSet dataSet = OSAESql.RunSQL("SELECT state_label, state_name FROM osae_v_object_state where object_name = '" + cboObject.SelectedValue.ToString().Replace("'", "''") + "' AND state_name !='" + cboState1.SelectedValue + "' order by state_label");
766766
cboState2.ItemsSource = dataSet.Tables[0].DefaultView;
767767
}
768768

UI/Screens/MainWindow.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ public void Load_Screen(string sScreen)
179179
}
180180
else
181181
{
182+
canGUI.Height = bitmapImage.Height;
183+
canGUI.Width = bitmapImage.Width;
182184
this.Height = bitmapImage.Height;
183185
this.Width = bitmapImage.Width;
184186
gHeightRatio = 1;

UI/Web/controls/ctrlEmbedded.ascx.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ protected void Page_Load(object sender, EventArgs e)
2323
width = ControlWidth.ToString();
2424
height = ControlHeight.ToString();
2525
imgSnapShot.Attributes.Add("Style", "position:absolute;top:" + (Int32.Parse(screenObject.Property("Y").Value) + 50).ToString() + "px;left:" + (Int32.Parse(screenObject.Property("X").Value) + 10).ToString() + "px;z-index:" + (Int32.Parse(screenObject.Property("ZOrder").Value) + 10).ToString() + ";");
26-
imgSnapShot.ImageUrl = Source;
26+
imgSnapShot.ImageUrl = @Source;
2727
imgSnapShot.Width = System.Web.UI.WebControls.Unit.Parse(width);
2828
imgSnapShot.Height = System.Web.UI.WebControls.Unit.Parse(height);
2929
}

0 commit comments

Comments
 (0)