public ucPlace(ImageSource strImageSource, bool bIsPoolTable, PresentationObject ppType, bool bIsSittingPlace = true) { InitializeComponent(); // Set the image source of the user control SetImage(strImageSource); if (ppType == PresentationObject.BAR_CHAIR) { PlaceName = "כיסא "; } if (ppType == PresentationObject.POOL_TABLE) { PlaceName = "שולחן "; } PlaceName += m_nIndexTable++; // Set local members this.m_bIsPoolTable = bIsPoolTable; this.m_ppPlaceType = ppType; this.m_bIsSittingPlace = bIsSittingPlace; // Open the check OpenCheck(); // Check if it's sitting place if (!bIsSittingPlace) { this.imgBusyStatus.Visibility = System.Windows.Visibility.Collapsed; this.txbName.Visibility = System.Windows.Visibility.Collapsed; } }
public static void Main(string[] args) { var circle = new PresentationObject(); circle.Height = 100; circle.Width = 100; System.Console.WriteLine("Height: {0}", circle.Height); var text = new Text(); text.Height = 10; System.Console.WriteLine("Height: {0}", text.Height); text.Copy(); }
public ObjectDetails(string strName, PresentationObject poType) { this.poType = poType; this.strName = strName; }
/// <summary> /// Get the presentation objects from file /// </summary> /// <param name="strFilePath">The file path</param> /// <returns>Dictionary of location to object tyoe</returns> public static PresentationDetails ReadPresentation(string strFilePath) { Dictionary <Point, ObjectDetails> dicResult = new Dictionary <Point, ObjectDetails>(); int nLastElementId = 0; PointConverter converter = new PointConverter(); try { // Creating the xml reader XmlReader reader = XmlReader.Create(strFilePath); // As long as not end of file while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element && reader.Name == ROOT_ELEMENT) { // Checking that the root element isn't empty element if (!reader.IsEmptyElement) { // Get the element last ID nLastElementId = int.Parse(reader.GetAttribute(LAST_ID_ARRTRIBUTE)); // As long we havn't got yet to the end element while (reader.NodeType != XmlNodeType.EndElement) { reader.Read(); if (reader.Name == OBJECT_ELEMENT) { // Get attributes values Point pCurrent = (Point)converter.ConvertFromString(reader.GetAttribute(POINT_ATTRIBUTE)); PresentationObject currentObject = (PresentationObject)Enum.Parse(typeof(PresentationObject), reader.GetAttribute(TYPE_ATTRIBUTE)); string strName = reader.GetAttribute(NAME_ATTRIBUTE); ObjectDetails details = new ObjectDetails(); details.poType = currentObject; details.strName = strName; // Adding to dictionary dicResult.Add(pCurrent, details); } } } } } } catch (FileNotFoundException ex) { // TODO : write to log throw new Exception("קובץ התצוגה שקיים אינו קיים"); } catch (NotSupportedException ex) { // TODO : write to log throw new Exception("קובץ תצוגה מושחת אנא טען קובץ אחר"); } catch (ArgumentException ex) { // TODO : write to log throw new Exception("קובץ תצוגה מושחת אנא טען קובץ אחר"); } catch (FormatException ex) { // TODO : write to log throw new Exception("קובץ תצוגה מושחת אנא טען קובץ אחר"); } catch (Exception ex) { // TODO : write to log throw new Exception("שגיאה בקריאת נתונים מקובץ אנא נסה שוב"); } return(new PresentationDetails(nLastElementId, dicResult)); }