/// <summary> /// Constructor /// </summary> public outputPortType() { // loading the asterics.ini file to get the correct colors for the components if (File.Exists(Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\AsTeRICS\\ACS\\asterics.ini")) { ini = new Asterics.ACS.IniFile(Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\AsTeRICS\\ACS\\asterics.ini"); } else if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "asterics.ini")) { ini = new Asterics.ACS.IniFile(AppDomain.CurrentDomain.BaseDirectory + "asterics.ini"); } else { MessageBox.Show(Asterics.ACS.Properties.Resources.IniFileNotFoundText, Asterics.ACS.Properties.Resources.IniFileNotFoundHeader, MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } portRectangle = new Rectangle(); portRectangle.Height = ACS.LayoutConstants.OUTPORTRECTANGLEHEIGHT; portRectangle.Width = ACS.LayoutConstants.OUTPORTRECTANGLEWIDTH; portRectangle.RadiusX = 3; portRectangle.RadiusY = 3; portRectangle.Stroke = new SolidColorBrush(Colors.Black); BrushConverter bc = new BrushConverter(); String outPortColor = ini.IniReadValue("Layout", "outportcolor"); if (outPortColor.Equals("")) { outPortColor = ACS.LayoutConstants.OUTPORTRECTANGLECOLOR; } portRectangle.Fill = (Brush)bc.ConvertFrom(outPortColor); this.descriptionField = "Output port description"; }
/// <summary> /// Constructor /// </summary> public componentTypesComponentType() { // loading the asterics.ini file to get the correct colors for the components if (File.Exists(Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\AsTeRICS\\ACS\\asterics.ini")) { ini = new Asterics.ACS.IniFile(Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData) + "\\AsTeRICS\\ACS\\asterics.ini"); } else if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "asterics.ini")) { ini = new Asterics.ACS.IniFile(AppDomain.CurrentDomain.BaseDirectory + "asterics.ini"); } else { MessageBox.Show(Asterics.ACS.Properties.Resources.IniFileNotFoundText, Asterics.ACS.Properties.Resources.IniFileNotFoundHeader, MessageBoxButton.OK, MessageBoxImage.Error); Application.Current.Shutdown(); } // init graphical elements componentCanvas = new Canvas(); label = new TextBlock(); mainRectangle = new Rectangle(); mainRectangle.Height = ACS.LayoutConstants.MAINRECTANGLEHEIGHT; mainRectangle.Width = ACS.LayoutConstants.MAINRECTANGLEWIDTH; mainRectangle.Stroke = new SolidColorBrush(Colors.Black); BrushConverter bc = new BrushConverter(); String bodyColor = ini.IniReadValue("Layout", "bodycolor"); if (bodyColor.Equals("")) { bodyColor = ACS.LayoutConstants.MAINRECTANGLECOLOR; } mainRectangle.Fill = (Brush)bc.ConvertFrom(bodyColor); mainRectangle.RadiusX = 4; mainRectangle.RadiusY = 4; label.FontSize = 12; componentCanvas.Children.Add(mainRectangle); componentCanvas.Children.Add(label); Canvas.SetLeft(mainRectangle, ACS.LayoutConstants.MAINRECTANGLEOFFSETX); Canvas.SetTop(mainRectangle, ACS.LayoutConstants.MAINRECTANGLEOFFSETY); Canvas.SetLeft(label, 20); Canvas.SetTop(label, 70); componentCanvas.Width = ACS.LayoutConstants.COMPONENTCANVASWIDTH; componentCanvas.Height = ACS.LayoutConstants.COMPONENTCANVASHEIGHT; portsList = new OrderedDictionary(); }