private void Load_Objects(String sScreen) { String sStateMatch = ""; String sImage = ""; List<OSAE.OSAEObject> screenObjects = OSAEApi.GetObjectsByContainer(sScreen); foreach (OSAE.OSAEObject obj in screenObjects) { ScreenObject sObj = new ScreenObject(); #region CONTROL STATE IMAGE if (obj.Type == "CONTROL STATE IMAGE") { sObj.Object_Name = obj.Property("Object Name").Value; sObj.Control_Name = obj.Name; sObj.Control_Type = obj.Type; OSAE.OSAEObject osaObject = OSAEApi.GetObjectByName(sObj.Object_Name); Image dsi = new Image(); dsi.Tag = sObj.Object_Name; dsi.MouseLeftButtonUp += new MouseButtonEventHandler(State_Image_MouseLeftButtonUp); sObj.Object_State_Time = obj.LastUpd; foreach (OSAE.ObjectProperty p in obj.Properties) { if (p.Value.ToLower() == osaObject.State.Value.ToLower()) { sStateMatch = p.Name.Substring(0, p.Name.LastIndexOf(' ')); } } sImage = OSAEApi.APIpath + obj.Property(sStateMatch + " Image").Value; OSAE.ObjectProperty pZOrder = obj.Property("ZOrder"); OSAE.ObjectProperty pX = obj.Property(sStateMatch + " X"); OSAE.ObjectProperty pY = obj.Property(sStateMatch + " Y"); sObj.Object_State = osaObject.State.Value; sObj.ScreenImage = dsi; aScreenObject.Add(sObj); if (File.Exists(sImage)) { canGUI.Children.Add(dsi); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dsi, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dsi, dY); int dZ = Convert.ToInt32(pZOrder.Value); Canvas.SetZIndex(dsi, dZ); byte[] byteArray = File.ReadAllBytes(sImage); var imageStream = new MemoryStream(byteArray); var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = imageStream; bitmapImage.EndInit(); dsi.Source = bitmapImage; dsi.Visibility = System.Windows.Visibility.Visible; } else { dsi.Source = null; dsi.Visibility = System.Windows.Visibility.Hidden; } aScreenObject.Add(sObj); } #endregion #region CONTROL PROPERTY LABEL else if (obj.Type == "CONTROL PROPERTY LABEL") { sObj.Object_Name = obj.Property("Object Name").Value; String sPropertyName = obj.Property("Property Name").Value; sObj.Property_Name = sPropertyName; String sPropertyValue = OSAEApi.GetObjectPropertyValue(sObj.Object_Name, sPropertyName).Value; String sBackColor = obj.Property("Back Color").Value; String sForeColor = obj.Property("Fore Color").Value; String sPrefix = obj.Property("Prefix").Value; String sSuffix = obj.Property("Suffix").Value; String iFontSize = obj.Property("Font Size").Value; String sFontName = obj.Property("Font Name").Value; Label dpl = new Label(); dpl.Tag = sObj.Object_Name; OSAE.ObjectProperty pX = obj.Property("X"); OSAE.ObjectProperty pY = obj.Property("Y"); canGUI.Children.Add(dpl); sObj.ScreenLabel = dpl; Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dpl, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dpl, dY); if (sPropertyValue != "") { if (sBackColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sBackColor) as SolidColorBrush; dpl.Background = brush; } catch (Exception myerror) { } } if (sForeColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sForeColor) as SolidColorBrush; dpl.Foreground = brush; } catch (Exception myerror) { } } if (iFontSize != "") { try { dpl.FontSize = Convert.ToDouble(iFontSize); } catch (Exception myerror) { } } dpl.Content = sPrefix + sPropertyValue + sSuffix; sObj.Object_State = ""; } else { dpl.Content = ""; } aScreenObject.Add(sObj); } #endregion #region CONTROL STATIC LABEL else if (obj.Type == "CONTROL STATIC LABEL") { String sPropertyValue = obj.Property("Value").Value; String sBackColor = obj.Property("Back Color").Value; String sForeColor = obj.Property("Fore Color").Value; Label dsl = new Label(); OSAE.ObjectProperty pX = obj.Property("X"); OSAE.ObjectProperty pY = obj.Property("Y"); canGUI.Children.Add(dsl); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dsl, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dsl, dY); if (sPropertyValue != "") { if (sBackColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sBackColor) as SolidColorBrush; dsl.Background = brush; } catch (Exception myerror) { } } if (sForeColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sForeColor) as SolidColorBrush; dsl.Foreground = brush; } catch (Exception myerror) { } } dsl.Content = sPropertyValue; } else { dsl.Content = ""; } } #endregion #region CONTROL TIMER LABEL else if (obj.Type == "CONTROL TIMER LABEL") { sObj.Object_Name = obj.Property("Object Name").Value; OSAE.OSAEObject timerObject = OSAEApi.GetObjectByName(sObj.Object_Name); String sBackColor = obj.Property("Back Color").Value; String sForeColor = obj.Property("Font Color").Value; Label dtl = new Label(); OSAE.ObjectProperty pX = obj.Property("X"); OSAE.ObjectProperty pY = obj.Property("Y"); canGUI.Children.Add(dtl); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dtl, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dtl, dY); sObj.Object_State_Time = Convert.ToInt32(timerObject.State.TimeInState).ToString(); sObj.Object_Last_Updated = timerObject.LastUpd; if (sBackColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sBackColor) as SolidColorBrush; dtl.Background = brush; } catch (Exception myerror) { } } if (sForeColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sForeColor) as SolidColorBrush; dtl.Foreground = brush; } catch (Exception myerror) { } } } #endregion // else if (aScreenObject(iLoop).Control_Type = "CONTROL METHOD IMAGE") // iMethodImageCount = iMethodImageCount + 1 // aScreenObject(iLoop).Object_Name = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Object Name") // aScreenObject(iLoop).Control_Index = iMethodImageCount // aControlMethodImage(aControlMethodImage.Count).Tag = iLoop // g_toolTip.SetToolTip(aControlMethodImage(iMethodImageCount), aScreenObject(iLoop).Object_Name) // CMD.Parameters.Clear() // try // { // sImage = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Image"); // sImage = sImage.Replace(".\", "\"); // If File.Exists(gAppPath & sImage) Then sImage = gAppPath & sImage // iZOrder = Val(OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "ZOrder")); // iX = Val("" & OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "X")); // iY = Val("" & OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Y")); // if (File.Exists(sImage)) // { // aControlMethodImage(aScreenObject(iLoop).Control_Index).Image = Image.FromFile(sImage); // aScreenObject(iLoop).Object_State = "" // aControlMethodImage(aScreenObject(iLoop).Control_Index).Left = iX; // aControlMethodImage(aScreenObject(iLoop).Control_Index).Top = iY; // aControlMethodImage(aScreenObject(iLoop).Control_Index).Visible = True; // } // else // { // aControlMethodImage(aScreenObject(iLoop).Control_Index).Image = Nothing; // aControlMethodImage(aScreenObject(iLoop).Control_Index).Visible = False; // } // } // catch (MySqlException myerror) // { // MessageBox.Show("GUI Error Load_Objects 4: " + myerror.Message); // CN.Close(); // } #region CONTROL NAVIGATION IMAGE else if (obj.Type == "CONTROL NAVIGATION IMAGE") { sObj.Object_Name = obj.Property("Screen").Value; sObj.Object_State = ""; Image dni = new Image(); dni.Tag = sObj.Object_Name; try { sImage = obj.Property("Image").Value; if (File.Exists(OSAEApi.APIpath + sImage)) { sImage = OSAEApi.APIpath + sImage; } OSAE.ObjectProperty pZOrder = obj.Property("ZOrder"); OSAE.ObjectProperty pX = obj.Property("X"); OSAE.ObjectProperty pY = obj.Property("Y"); if (File.Exists(sImage)) { canGUI.Children.Add(dni); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dni, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dni, dY); int dZ = Convert.ToInt32(pZOrder.Value); Canvas.SetZIndex(dni, dZ); byte[] byteArray = File.ReadAllBytes(sImage); var imageStream = new MemoryStream(byteArray); var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = imageStream; bitmapImage.EndInit(); dni.Source = bitmapImage; } } catch (MySqlException myerror) { MessageBox.Show("GUI Error Load_Objects 5: " + myerror.Message); } } #endregion #region CONTROL CAMERA VIEWER else if (obj.Type == "CONTROL CAMERA VIEWER") { try { string stream = OSAEApi.GetObjectPropertyValue(obj.Property("Object Name").Value, "Stream Address").Value; OSAE.UI.Controls.VideoStreamViewer vsv = new OSAE.UI.Controls.VideoStreamViewer(stream); canGUI.Children.Add(vsv); OSAE.ObjectProperty pZOrder =obj.Property("ZOrder"); OSAE.ObjectProperty pX = obj.Property("X"); OSAE.ObjectProperty pY = obj.Property("Y"); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(vsv, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(vsv, dY); int dZ = Convert.ToInt32(pZOrder.Value); Canvas.SetZIndex(vsv, dZ); } catch (MySqlException myerror) { MessageBox.Show("GUI Error Load Camera Viewer: " + myerror.Message); } } #endregion #region USER CONTROL else if (obj.Type == "USER CONTROL") { string sUCType = obj.Property("Control Type").Value; if (sUCType == "USER CONTROL WEATHER") { OSAE.UI.Controls.Weather wc = new OSAE.UI.Controls.Weather(); canGUI.Children.Add(wc); OSAE.ObjectProperty pZOrder = obj.Property("ZOrder"); OSAE.ObjectProperty pX = obj.Property("X"); OSAE.ObjectProperty pY = obj.Property("Y"); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(wc, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(wc, dY); int dZ = Convert.ToInt32(pZOrder.Value); Canvas.SetZIndex(wc, dZ); } } #endregion //If iStateImageList.EndsWith(",") Then iStateImageList = iStateImageList.Substring(0, iStateImageList.Length - 1) //Timer1.Enabled = True } }
private void Load_Objects(String sScreen) { MySqlCommand CMD = new MySqlCommand(); // MySqlDataReader myReader = new MySqlDataReader(); String sState = ""; String sStateMatch = ""; String sImage = ""; CMD.Connection = CN; CMD.CommandType = CommandType.Text; //COUNT **ALL** control objects for this screen //CMD.CommandText = "SELECT COUNT(*) as Results FROM osae_v_screen_object WHERE screen_name=?pscreen"; //CMD.Parameters.AddWithValue("?pscreen", sScreen); //try //{ // CN.Open(); // iObjectCount = Convert.ToInt32(CMD.ExecuteScalar()); // CN.Close(); //} //catch (Exception myerror) //{ // MessageBox.Show("GUI Error Load_Objects 1: " + myerror.Message); // CN.Close(); //} CMD.Parameters.Clear(); //Select **ALL** control objects for this screen CMD.CommandText = "SELECT * FROM osae_v_object_property WHERE object_id IN(SELECT control_id FROM osae_v_screen_object WHERE screen_name=?pscreen) AND property_name='ZOrder' ORDER BY property_value"; CMD.Parameters.AddWithValue("?pscreen", sScreen); try { CN.Open(); MySqlDataReader myReader = CMD.ExecuteReader(); while (myReader.Read()) { ScreenObject so = new ScreenObject(); so.Control_Name = Convert.ToString(myReader.GetString("object_name")); so.Control_Type = Convert.ToString(myReader.GetString("object_type")); aScreenObject.Add(so); } CN.Close(); } catch (MySqlException myerror) { MessageBox.Show("GUI Error Load_Objects 2: " + myerror.Message); CN.Close(); } CMD.Parameters.Clear(); foreach (ScreenObject dso in aScreenObject) { if (dso.Control_Type == "CONTROL STATE IMAGE") { dso.Object_Name = OSAEApi.GetObjectProperty(dso.Control_Name, "Object Name"); Image dsi = new Image(); dsi.Tag = dso.Object_Name; dsi.MouseLeftButtonDown += new MouseButtonEventHandler(State_Image_MouseLeftButtonDown); sState = OSAEApi.GetObjectState(dso.Object_Name); CMD.Parameters.Clear(); CMD.CommandText = "SELECT COALESCE(last_state_change,NOW()) FROM osae_v_object WHERE object_name=?ObjectName"; CMD.Parameters.AddWithValue("?ObjectName", dso.Object_Name); try { CN.Open(); dso.Object_State_Time = Convert.ToString(CMD.ExecuteScalar()); CN.Close(); } catch (Exception myerror) { MessageBox.Show("GUI Error Load_Objects 2.5: " + myerror.Message); CN.Close(); } CMD.Parameters.Clear(); CMD.CommandText = "SELECT property_name FROM osae_v_object_property WHERE object_name=?ObjectName AND property_value=?pstate"; CMD.Parameters.AddWithValue("?ObjectName", dso.Control_Name); CMD.Parameters.AddWithValue("?pstate", sState); try { CN.Open(); sStateMatch = Convert.ToString(CMD.ExecuteScalar()); CN.Close(); if (sStateMatch != "") { sStateMatch = sStateMatch.Substring(0, 7); } sImage = OSAEApi.GetObjectProperty(dso.Control_Name, sStateMatch + " Image"); if (File.Exists(OSAEApi.APIpath + sImage)) { sImage = OSAEApi.APIpath + sImage; } OSAE.ObjectProperty pZOrder = OSAEApi.GetObjectPropertyValue(dso.Control_Name, "ZOrder"); OSAE.ObjectProperty pX = OSAEApi.GetObjectPropertyValue(dso.Control_Name, sStateMatch + " X"); OSAE.ObjectProperty pY = OSAEApi.GetObjectPropertyValue(dso.Control_Name, sStateMatch + " Y"); dso.Object_State = sState; dso.ScreenImage = dsi; if (File.Exists(sImage)) { canGUI.Children.Add(dsi); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dsi, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dsi, dY); byte[] byteArray = File.ReadAllBytes(sImage); var imageStream = new MemoryStream(byteArray); var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = imageStream; bitmapImage.EndInit(); //canGUI.Background = new ImageBrush(bitmapImage); dsi.Source = bitmapImage; if (pZOrder.Value == "0") { // dsi.SendToBack(); } else { // dsi.BringToFront(); } dsi.Visibility = System.Windows.Visibility.Visible; } else { dsi.Source = null; dsi.Visibility = System.Windows.Visibility.Hidden; } } catch (Exception myerror) { MessageBox.Show("GUI Error Load_Objects 3: " + myerror.Message); CN.Close(); } } else if (dso.Control_Type == "CONTROL PROPERTY LABEL") { dso.Object_Name = OSAEApi.GetObjectProperty(dso.Control_Name, "Object Name"); String sPropertyName = OSAEApi.GetObjectProperty(dso.Control_Name, "Property Name"); dso.Property_Name = sPropertyName; String sPropertyValue = OSAEApi.GetObjectProperty(dso.Object_Name, sPropertyName); String sBackColor = OSAEApi.GetObjectProperty(dso.Control_Name, "Back Color"); String sForeColor = OSAEApi.GetObjectProperty(dso.Control_Name, "Fore Color"); String sPrefix = OSAEApi.GetObjectProperty(dso.Control_Name, "Prefix"); String sSuffix = OSAEApi.GetObjectProperty(dso.Control_Name, "Suffix"); String iFontSize = OSAEApi.GetObjectProperty(dso.Control_Name, "Font Size"); String sFontName = OSAEApi.GetObjectProperty(dso.Control_Name, "Font Name"); Label dpl = new Label(); dpl.Tag = dso.Object_Name; OSAE.ObjectProperty pX = OSAEApi.GetObjectPropertyValue(dso.Control_Name, "X"); OSAE.ObjectProperty pY = OSAEApi.GetObjectPropertyValue(dso.Control_Name, "Y"); canGUI.Children.Add(dpl); dso.ScreenLabel = dpl; Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dpl, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dpl, dY); if (sPropertyValue != "") { if (sBackColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sBackColor) as SolidColorBrush; dpl.Background = brush; } catch (Exception myerror) { } } if (sForeColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sForeColor) as SolidColorBrush; dpl.Foreground = brush; } catch (Exception myerror) { } } if (iFontSize != "") { try { dpl.FontSize = Convert.ToDouble(iFontSize); } catch (Exception myerror) { } } dpl.Content = sPrefix + sPropertyValue + sSuffix; dso.Object_State = ""; } else { dpl.Content = ""; } } else if (dso.Control_Type == "CONTROL STATIC LABEL") { dso.Object_Name = OSAEApi.GetObjectProperty(dso.Control_Name, "Object Name"); String sPropertyValue = OSAEApi.GetObjectProperty(dso.Object_Name, "Value"); String sBackColor = OSAEApi.GetObjectProperty(dso.Control_Name, "Back Color"); String sForeColor = OSAEApi.GetObjectProperty(dso.Control_Name, "Fore Color"); Label dsl = new Label(); dsl.Tag = dso.Object_Name; OSAE.ObjectProperty pX = OSAEApi.GetObjectPropertyValue(dso.Control_Name, "X"); OSAE.ObjectProperty pY = OSAEApi.GetObjectPropertyValue(dso.Control_Name, "Y"); canGUI.Children.Add(dsl); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dsl, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dsl, dY); if (sPropertyValue != "") { if (sBackColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sBackColor) as SolidColorBrush; dsl.Background = brush; } catch (Exception myerror) { } } if (sForeColor != "") { try { BrushConverter conv = new BrushConverter(); SolidColorBrush brush = conv.ConvertFromString(sForeColor) as SolidColorBrush; dsl.Foreground = brush; } catch (Exception myerror) { } } dsl.Content = sPropertyValue; } else { dsl.Content = ""; } } // else if aScreenObject(iLoop).Control_Type = "CONTROL TIMER LABEL" Then // iTimerLabelCount = iTimerLabelCount + 1 // aScreenObject(iLoop).Control_Index = iTimerLabelCount // aScreenObject(iLoop).Object_Name = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Object Name") // sPropertyName = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Type") // aScreenObject(iLoop).Property_Name = sPropertyName // sPropertyValue = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Object_Name, "OFF Timer") // aScreenObject(iLoop).Property_Value = sPropertyValue // sBackColor = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Back Color") // sForeColor = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Fore Color") // aControlTimerLabel(iTimerLabelCount).Tag = iLoop // sState = OSAEApi.GetObjectState(aScreenObject(iLoop).Object_Name) // aScreenObject(iLoop).Object_State = sState // CMD.Parameters.Clear() // CMD.CommandText = "SELECT COALESCE(last_updated,NOW()) FROM osae_v_object WHERE object_name=?ObjectName" // CMD.Parameters.AddWithValue("?ObjectName", aScreenObject(iLoop).Object_Name) // try // { // CN.Open(); // aScreenObject(iLoop).Object_Last_Updated = CMD.ExecuteScalar; // CN.Close(); // } // catch (MySqlException myerror) // { // MessageBox.Show("GUI Error Load_Objects 2.7: " & myerror.Message); // CN.Close(); // } // CMD.Parameters.Clear(); // CMD.CommandText = "SELECT COALESCE(last_state_change,NOW()) FROM osae_v_object WHERE object_name=?ObjectName"; // CMD.Parameters.AddWithValue("?ObjectName", aScreenObject(iLoop).Object_Name); // try // { // CN.Open(); // aScreenObject(iLoop).Object_State_Time = CMD.ExecuteScalar; // CN.Close(); // } // catch (MySqlException myerror) // { // MessageBox.Show("GUI Error Load_Objects 666: " & myerror.Message); // CN.Close(); // } // iX = Val("" & OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "X")); // iY = Val("" & OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Y")); // if (sBackColor <> "") // { // try // { // aControlTimerLabel(aScreenObject(iLoop).Control_Index).BackColor = Color.FromName(sBackColor); // } // catch (MySqlException myerror) // {} // } // if (sForeColor <> "") // { // try // { // aControlTimerLabel(aScreenObject(iLoop).Control_Index).ForeColor = Color.FromName(sForeColor) // } // catch (MySqlException myerror) // {} // } // aControlTimerLabel(aScreenObject(iLoop).Control_Index).Text = sPropertyValue; // aControlTimerLabel(aScreenObject(iLoop).Control_Index).Width = sPropertyValue.Length * 7; // aControlTimerLabel(aScreenObject(iLoop).Control_Index).Left = iX; // aControlTimerLabel(aScreenObject(iLoop).Control_Index).Top = iY; // aControlTimerLabel(aScreenObject(iLoop).Control_Index).BringToFront(); // aControlTimerLabel(aScreenObject(iLoop).Control_Index).Visible = True; // else if (aScreenObject(iLoop).Control_Type = "CONTROL METHOD IMAGE") // iMethodImageCount = iMethodImageCount + 1 // aScreenObject(iLoop).Object_Name = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Object Name") // aScreenObject(iLoop).Control_Index = iMethodImageCount // aControlMethodImage(aControlMethodImage.Count).Tag = iLoop // g_toolTip.SetToolTip(aControlMethodImage(iMethodImageCount), aScreenObject(iLoop).Object_Name) // CMD.Parameters.Clear() // try // { // sImage = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Image"); // sImage = sImage.Replace(".\", "\"); // If File.Exists(gAppPath & sImage) Then sImage = gAppPath & sImage // iZOrder = Val(OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "ZOrder")); // iX = Val("" & OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "X")); // iY = Val("" & OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Y")); // if (File.Exists(sImage)) // { // aControlMethodImage(aScreenObject(iLoop).Control_Index).Image = Image.FromFile(sImage); // aScreenObject(iLoop).Object_State = "" // aControlMethodImage(aScreenObject(iLoop).Control_Index).Left = iX; // aControlMethodImage(aScreenObject(iLoop).Control_Index).Top = iY; // aControlMethodImage(aScreenObject(iLoop).Control_Index).Visible = True; // } // else // { // aControlMethodImage(aScreenObject(iLoop).Control_Index).Image = Nothing; // aControlMethodImage(aScreenObject(iLoop).Control_Index).Visible = False; // } // } // catch (MySqlException myerror) // { // MessageBox.Show("GUI Error Load_Objects 4: " + myerror.Message); // CN.Close(); // } else if (dso.Control_Type == "CONTROL NAVIGATION IMAGE") { dso.Object_Name = OSAEApi.GetObjectProperty(dso.Control_Name, "Screen"); dso.Object_State = ""; Image dni = new Image(); dni.Tag = dso.Object_Name; //aControlNavImage(iNavImageCount).Tag = iLoop // g_toolTip.SetToolTip(aControlNavImage(iNavImageCount), aScreenObject(iLoop).Object_Name) CMD.Parameters.Clear(); try { sImage = OSAEApi.GetObjectProperty(dso.Control_Name, "Image"); if (File.Exists(OSAEApi.APIpath + sImage)) { sImage = OSAEApi.APIpath + sImage; } OSAE.ObjectProperty pZOrder = OSAEApi.GetObjectPropertyValue(dso.Control_Name, "ZOrder"); OSAE.ObjectProperty pX = OSAEApi.GetObjectPropertyValue(dso.Control_Name, "X"); OSAE.ObjectProperty pY = OSAEApi.GetObjectPropertyValue(dso.Control_Name, "Y"); if (File.Exists(sImage)) { canGUI.Children.Add(dni); Double dX = Convert.ToDouble(pX.Value); Canvas.SetLeft(dni, dX); Double dY = Convert.ToDouble(pY.Value); Canvas.SetTop(dni, dY); byte[] byteArray = File.ReadAllBytes(sImage); var imageStream = new MemoryStream(byteArray); var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.StreamSource = imageStream; bitmapImage.EndInit(); //canGUI.Background = new ImageBrush(bitmapImage); dni.Source = bitmapImage; if (pZOrder.Value == "0") { // dsi.SendToBack(); } else { // dsi.BringToFront(); } } } catch (MySqlException myerror) { MessageBox.Show("GUI Error Load_Objects 5: " + myerror.Message); CN.Close(); } } // ElseIf aScreenObject(iLoop).Control_Type = "USER CONTROL" Then // iUserControlCount += 1 // Dim sUCType As String = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Control Type") // If sUCType = "USER CONTROL WEATHER" Then // Me.Controls.Add(New ucWeather) // aScreenObject(iLoop).Control_Index = Me.Controls.Count - 1 // Me.Controls(aScreenObject(iLoop).Control_Index).Top = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "Y") // Me.Controls(aScreenObject(iLoop).Control_Index).Left = OSAEApi.GetObjectProperty(aScreenObject(iLoop).Control_Name, "X") // Me.Controls(aScreenObject(iLoop).Control_Index).BringToFront() // ' // End If // End If //If iStateImageList.EndsWith(",") Then iStateImageList = iStateImageList.Substring(0, iStateImageList.Length - 1) //Timer1.Enabled = True } }