Skip to content

Commit

Permalink
Misc changes that wrap up RC5
Browse files Browse the repository at this point in the history
  • Loading branch information
VaughnRupp committed Mar 3, 2016
1 parent 19a46db commit 3931e9d
Show file tree
Hide file tree
Showing 9 changed files with 353 additions and 245 deletions.
1 change: 1 addition & 0 deletions DB/0.4.7-0.4.8.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,7 @@ CALL osae_sp_object_type_property_add('PERSON','PIN','Password','','',0);
CALL osae_sp_object_type_update ('WEATHER','WEATHER','Weather Data','SYSTEM','THING',0,1,0,1);
CALL osae_sp_object_type_update ('COMPUTER','COMPUTER','Core Type: Computer','','THING',0,1,1,1);
CALL osae_sp_object_type_update ('SERVICE','SERVICE','OSA Service','','SERVICE',0,1,1,1);
CALL osae_sp_object_type_property_add('THING','URL','String','','',0);

CALL osae_sp_object_type_property_add('GUI CLIENT','Current Screen','String','','',0);
CALL osae_sp_object_type_property_add('GUI CLIENT','Default Screen','String','','',0);
Expand Down
511 changes: 293 additions & 218 deletions DB/osae.sql

Large diffs are not rendered by default.

62 changes: 43 additions & 19 deletions Plugins/OSAE.Email/Email.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,44 @@
using System;
using System.Net;
using System.Net.Mail;
using System.ComponentModel;

public class Email : OSAEPluginBase
{
string gAppName;
private OSAE.General.OSAELog Log;

private OSAE.General.OSAELog Log;// = new General.OSAELog();

public override void ProcessCommand(OSAEMethod method)
{
//process command
try
{
string to = string.Empty;
{

string parameter2 = string.Empty;
string subject = string.Empty;
string body = string.Empty;
OSAEObjectProperty prop = OSAEObjectPropertyManager.GetObjectPropertyValue(method.Parameter1, "Email Address");

if (prop != null) to = prop.Value;
if (to == string.Empty) to = method.Parameter1;

// To
MailMessage mailMsg = new MailMessage();
mailMsg.To.Add(to);
MailAddress to;
OSAEObjectProperty prop = OSAEObjectPropertyManager.GetObjectPropertyValue(method.Parameter1, "Email Address");
if (prop != null)
{
if (prop.Value == string.Empty) to = new MailAddress(method.Parameter1);
else to = new MailAddress(prop.Value);
}
else
to = new MailAddress(method.Parameter1);

// From
MailAddress mailAddress = new MailAddress(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "From Address").Value);
mailMsg.From = mailAddress;
MailAddress from = new MailAddress(OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "From Address").Value);

MailMessage mailMsg = new MailMessage(from, to);

// Subject and Body
mailMsg.Subject = "Message from OSAE";
mailMsg.Body = Common.PatternParse(method.Parameter2);
mailMsg.BodyEncoding = System.Text.Encoding.UTF8;

parameter2 = Common.PatternParse(method.Parameter2);

// Make sure there is a body of text.
Expand All @@ -56,6 +62,8 @@ public override void ProcessCommand(OSAEMethod method)
if (subject.Equals(string.Empty))
{
mailMsg.Subject = "Message from OSAE";
mailMsg.SubjectEncoding = System.Text.Encoding.UTF8;

mailMsg.Body = parameter2;
}
else
Expand All @@ -80,21 +88,34 @@ public override void ProcessCommand(OSAEMethod method)
Log.Info("from: " + mailMsg.From);
Log.Info("subject: " + mailMsg.Subject);
Log.Info("body: " + mailMsg.Body);
Log.Info("smtpServer: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "SMTP Server").Value);
Log.Info("smtpPort: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "SMTP Port").Value);
Log.Info("smtpServer: " + smtpClient.Host);
Log.Info("smtpPort: " + smtpClient.Port);
Log.Info("username: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Username").Value);
Log.Info("password: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "Password").Value);
Log.Info("ssl: " + OSAEObjectPropertyManager.GetObjectPropertyValue(gAppName, "ssl").Value);
Log.Info("ssl: " + smtpClient.EnableSsl);
smtpClient.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
string userState = "test message1";
smtpClient.SendAsync(mailMsg, userState);

smtpClient.Send(mailMsg);
//smtpClient.Send(mailMsg);
}
catch (Exception ex)
{ Log.Error("Error Sending email" , ex); }
}

/// <summary>
/// Interface implementation, this plugin does not perform any actions on shutdown
/// </summary>
public void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
{
// Get the unique identifier for this asynchronous operation.
String token = (string)e.UserState;

if (e.Cancelled) Log.Info(token + " Send canceled.");

if (e.Error != null)
Log.Info(token + " " +e.Error.ToString());
else
Log.Info("Message sent.");
}

public override void Shutdown()
{
Log.Info("*** Shutting Down ***");
Expand All @@ -108,8 +129,11 @@ public override void RunInterface(string pluginName)
Log.Info("Email Plugin is Starting...");

OwnTypes();

}



public void OwnTypes()
{
//Added the follow to automatically own Speech Base types that have no owner.
Expand Down
6 changes: 6 additions & 0 deletions Plugins/OSAE.ScriptProcessor/ScriptProcessor.vb
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ Public Class ScriptProcessor
If oTemp.Type <> sValue Then
sNesting(iNestingLevel) = "FAIL"
End If
ElseIf sOption.ToUpper = "NAME" Then
Dim oTemp As OSAEObject
oTemp = OSAE.OSAEObjectManager.GetObjectByName(sObject)
If oTemp.Name <> sValue Then
sNesting(iNestingLevel) = "FAIL"
End If
Else
pProperty = OSAEObjectPropertyManager.GetObjectPropertyValue(sObject, sOption)
If pProperty.DataType = "String" Then pProperty.Value = pProperty.Value.ToUpper
Expand Down
4 changes: 2 additions & 2 deletions UI/OSAE.UI.Controls/AddControlClickImage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
</TransformGroup>
</TextBox.RenderTransform>
</TextBox>
<TextBox x:Name="txtNormalX" HorizontalAlignment="Left" Height="22" Margin="224,33,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="42" Text="100" IsEnabled="False"/>
<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"/>
<TextBox x:Name="txtNormalX" HorizontalAlignment="Left" Height="22" Margin="224,33,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="42" Text="100"/>
<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"/>
<Label Content="X" HorizontalAlignment="Left" Margin="202,29,0,0" VerticalAlignment="Top" IsEnabled="False"/>
<Label Content="Y" HorizontalAlignment="Left" Margin="202,62,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.588,1.846" IsEnabled="False"/>
<Label Content="ZOrder" HorizontalAlignment="Left" Margin="171,88,0,0" VerticalAlignment="Top" IsEnabled="False"/>
Expand Down
4 changes: 2 additions & 2 deletions UI/OSAE.UI.Controls/AddControlClickImage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public AddControlClickImage(string screen, string user,string controlName = "")
// We have a hit, this is an Update call, se call the preload
sMode = "Update";
sOriginalName = controlName;
txtControlName.Text = controlName;
LoadCurrentScreenObject(controlName);
txtControlName.Text = sOriginalName;
}
}

Expand Down Expand Up @@ -114,7 +114,7 @@ private void LoadCurrentScreenObject(string controlName)
/// </summary>
private void LoadObjects()
{
DataSet dataSet = OSAESql.RunSQL("SELECT object_name FROM osae_v_object order by object_name");
DataSet dataSet = OSAESql.RunSQL("SELECT object_name FROM osae_v_object WHERE object_type !='SCREEN' AND base_type != 'CONTROL' order by object_name");
cboPressObject.ItemsSource = dataSet.Tables[0].DefaultView;
cboReleaseObject.ItemsSource = dataSet.Tables[0].DefaultView;
DataSet dataSet2 = OSAESql.RunSQL("SELECT script_name FROM osae_script order by script_name");
Expand Down
6 changes: 3 additions & 3 deletions UI/OSAE.UI.Controls/AddControlStateImage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,9 @@ private void btnLoadS2I4_Click(object sender, RoutedEventArgs e)

private void cboObject_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
DataSet dataSet = OSAESql.RunSQL("SELECT state_label, state_name FROM osae_v_object_state where object_name = '" + cboObject.SelectedValue + "' order by state_label");
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");
cboState1.ItemsSource = dataSet.Tables[0].DefaultView;
DataSet dataSet2 = OSAESql.RunSQL("SELECT method_label, method_name FROM osae_v_object_method where object_name = '" + cboObject.SelectedValue + "' order by method_label");
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");
cboSliderMethod.ItemsSource = dataSet2.Tables[0].DefaultView;

// The Screen - Object Is default name for the screen control, so update it based on the selection here
Expand Down Expand Up @@ -762,7 +762,7 @@ private void cboState1_SelectionChanged(object sender, SelectionChangedEventArgs
btnLoadS1I1.IsEnabled = true;
imgState1Img1.IsEnabled = true;
cboState2.IsEnabled = true;
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");
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");
cboState2.ItemsSource = dataSet.Tables[0].DefaultView;
}

Expand Down
2 changes: 2 additions & 0 deletions UI/Screens/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public void Load_Screen(string sScreen)
}
else
{
canGUI.Height = bitmapImage.Height;
canGUI.Width = bitmapImage.Width;
this.Height = bitmapImage.Height;
this.Width = bitmapImage.Width;
gHeightRatio = 1;
Expand Down
2 changes: 1 addition & 1 deletion UI/Web/controls/ctrlEmbedded.ascx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected void Page_Load(object sender, EventArgs e)
width = ControlWidth.ToString();
height = ControlHeight.ToString();
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() + ";");
imgSnapShot.ImageUrl = Source;
imgSnapShot.ImageUrl = @Source;
imgSnapShot.Width = System.Web.UI.WebControls.Unit.Parse(width);
imgSnapShot.Height = System.Web.UI.WebControls.Unit.Parse(height);
}
Expand Down

0 comments on commit 3931e9d

Please sign in to comment.