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.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.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 // Check Enable Buttons, changing the object on an existing control should ?? Update the original control, renaming it? txtControlName.Text = currentScreen + " - " + cboObject.SelectedValue; cboState1.IsEnabled = true; chkSlider.IsEnabled = OSAEObjectPropertyManager.ObjectPropertyExists(cboObject.SelectedValue.ToString(), "Level"); Enable_Buttons(); }
/// <summary> /// Load the objects from the DB into the combo box /// </summary> private void LoadCurrentScreenObject(string controlName) { string sCheckName = ""; OSAEImageManager imgMgr = new OSAEImageManager(); cboObject.Text = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "Object Name").Value; cboState1.SelectedValue = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 1 Name").Value; try { sCheckName = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 1 Image").Value; if (sCheckName != "") { State1Img1 = imgMgr.GetImage(sCheckName); imgState1Img1.Source = LoadImage(State1Img1.Data); Validate_Initial_Coordinates(); lblState1X.IsEnabled = false; lblState1Y.IsEnabled = false; txtState1X.IsEnabled = true; txtState1Y.IsEnabled = true; lblZOrder.IsEnabled = true; txtZOrder.IsEnabled = true; btnLoadS1I2.IsEnabled = true; imgState1Img2.IsEnabled = true; } } catch { } try { sCheckName = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 1 Image 2").Value; if (sCheckName != "") { State1Img2 = imgMgr.GetImage(sCheckName); imgState1Img2.Source = LoadImage(State1Img2.Data); txtDelay.IsEnabled = true; chkRepeat.IsEnabled = true; btnLoadS1I3.IsEnabled = true; Validate_Initial_Coordinates(); } } catch { } try { sCheckName = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 1 Image 3").Value; if (sCheckName != "") { State1Img3 = imgMgr.GetImage(sCheckName); imgState1Img3.Source = LoadImage(State1Img3.Data); txtDelay.IsEnabled = true; chkRepeat.IsEnabled = true; btnLoadS1I4.IsEnabled = true; Validate_Initial_Coordinates(); } } catch { } try { sCheckName = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 1 Image 4").Value; if (sCheckName != "") { State1Img4 = imgMgr.GetImage(sCheckName); imgState1Img4.Source = LoadImage(State1Img4.Data); txtDelay.IsEnabled = true; chkRepeat.IsEnabled = true; Validate_Initial_Coordinates(); } } catch { } txtState1X.Text = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 1 X").Value; txtState1Y.Text = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 1 Y").Value; txtZOrder.Text = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "ZOrder").Value; cboState2.SelectedValue = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 2 Name").Value; try { sCheckName = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 2 Image").Value; if (sCheckName != "") { State2Img1 = imgMgr.GetImage(sCheckName); imgState2Img1.Source = LoadImage(State2Img1.Data); Validate_Initial_Coordinates(); lblState2X.IsEnabled = true; lblState2Y.IsEnabled = true; txtState2X.IsEnabled = true; txtState2Y.IsEnabled = true; lblZOrder.IsEnabled = true; txtZOrder.IsEnabled = true; btnLoadS2I2.IsEnabled = true; } } catch { } try { sCheckName = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 2 Image 2").Value; if (sCheckName != "") { State2Img2 = imgMgr.GetImage(sCheckName); imgState2Img2.Source = LoadImage(State2Img2.Data); txtDelay.IsEnabled = true; chkRepeat.IsEnabled = true; btnLoadS2I3.IsEnabled = true; Validate_Initial_Coordinates(); } } catch { } try { sCheckName = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 2 Image 3").Value; if (sCheckName != "") { State2Img3 = imgMgr.GetImage(sCheckName); imgState2Img3.Source = LoadImage(State2Img3.Data); txtDelay.IsEnabled = true; chkRepeat.IsEnabled = true; btnLoadS2I4.IsEnabled = true; Validate_Initial_Coordinates(); } } catch { } try { sCheckName = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 2 Image 4").Value; if (sCheckName != "") { State2Img4 = imgMgr.GetImage(sCheckName); imgState2Img4.Source = LoadImage(State2Img4.Data); txtDelay.IsEnabled = true; chkRepeat.IsEnabled = true; Validate_Initial_Coordinates(); } } catch { } txtState2X.Text = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 2 X").Value; txtState2Y.Text = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "State 2 Y").Value; chkSlider.IsEnabled = OSAEObjectPropertyManager.ObjectPropertyExists(cboObject.SelectedValue.ToString(), "Level"); if (chkSlider.IsEnabled) { try { chkSlider.IsChecked = Convert.ToBoolean(OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "Show Slider").Value); } catch { chkSlider.IsChecked = false; } if (chkSlider.IsChecked.Value) { cboSliderMethod.SelectedValue = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "Slider Method").Value; } } try { chkRepeat.IsChecked = Convert.ToBoolean(OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "Repeat Animation").Value); } catch { chkRepeat.IsChecked = true; } try { txtDelay.Text = OSAEObjectPropertyManager.GetObjectPropertyValue(controlName, "Frame Delay").Value; } catch { txtDelay.Text = "500"; } }