protected TileEditorBase(IEditorApplication application, Tileset Tileset, Selection selection) { this.application = application; this.Tileset = Tileset; this.selection = selection; selection.Changed += OnSelectionChanged; }
public void Run(IEditorApplication context, IBehavior behavior) { _log = new Log(context, DriverIdent); try { _driverContext = new DriverContext(context, _log, DriverName, false); // enter your code which should be executed when starting the SCADA Editor Wizard _log.Message("begin test"); _driverContext.Export(XmlSuffixBefore); if (_driverContext.OpenDriver(10)) { _driverContext.ModifyCommonProperties(); _driverContext.ModifyCOMProperties(); ModifyOptions(); _driverContext.CloseDriver(); _driverContext.Export(XmlSuffixAfter); _driverContext.Import(XmlSuffixBefore); } _log.Message("end test"); } catch (Exception ex) { _log.ExpectionMessage($"An exception has been thrown: {ex.Message}", ex); throw; } }
/// <summary> /// Method which is executed on starting the SCADA Editor Wizard /// </summary> /// <param name="context">SCADA editor application object</param> /// <param name="behavior">For future use</param> public void Run(IEditorApplication context, IBehavior behavior) { if (context.Workspace.ActiveProject == null) { MessageBox.Show(string.Format("There is no active project available." + Environment.NewLine + "Please load a project into the workspace!") , "Wizard with WPF GUI"); return; } try { var pageViewModels = new List <IPageViewModel> { new WelcomeViewModel <WelcomePage>(), new SelectionListViewModel <SelectionListPage>(context.Workspace.ActiveProject) }; var mainViewModel = new MainViewModel(pageViewModels); var mainView = new MainView { DataContext = mainViewModel }; var application = new Application(); application.MainWindow = mainView; mainView.Show(); application.Run(); } catch (Exception ex) { MessageBox.Show($"An exception has been thrown: {ex.Message}", "Wizard with WPF GUI"); throw; } }
public LayerListWidget(IEditorApplication application) { this.application = application; RowSeparatorFunc = OurRowSeparatorFunc; ButtonPressEvent += OnButtonPressed; VisibilityRenderer visibilityRenderer = new VisibilityRenderer(); visibilityRenderer.VisibilityChanged += OnVisibilityChange; TreeViewColumn visibilityColumn = new TreeViewColumn("Visibility", visibilityRenderer); visibilityColumn.SetCellDataFunc(visibilityRenderer, (TreeCellDataFunc)VisibilityDataFunc); AppendColumn(visibilityColumn); CellRendererText TextRenderer = new CellRendererText(); TreeViewColumn TypeColumn = new TreeViewColumn(); TypeColumn.PackStart(TextRenderer, true); TypeColumn.SetCellDataFunc(TextRenderer, (TreeCellDataFunc)TextDataFunc); TypeColumn.Title = "Type"; AppendColumn(TypeColumn); HeadersVisible = false; application.SectorChanged += OnSectorChanged; application.TilemapChanged += OnTilemapChanged; application.LevelChanged += OnLevelChanged; FieldOrProperty.Lookup(typeof(Tilemap).GetField("Name")).Changed += OnTilemapModified; FieldOrProperty.Lookup(typeof(Tilemap).GetField("ZPos")).Changed += OnTilemapModified; }
public PathEditor(IEditorApplication application, Path path) { this.application = application; this.path = path; killTimer = false; GLib.Timeout.Add(100, Animate); }
public void Run(IEditorApplication context, IBehavior behavior) { if (context.Workspace.ActiveProject == null) { MessageBox.Show("No project is available. Please active a project."); return; } try { var application = new Application(); var vm = new TplMainViewModel(context.Workspace.ActiveProject); var mainWindow = new Views.MainWindow { DataContext = vm }; application.MainWindow = mainWindow; mainWindow.Show(); application.Run(); } catch (Exception ex) { MessageBox.Show($"An exception has been thrown: {ex.Message}"); } }
public void Run(IEditorApplication context, IBehavior behavior) { if (context.Workspace.ActiveProject == null) { MessageBox.Show("No project is available. Please active a project."); return; } try { var application = new Application(); var pageViewModels = new List <IPageViewModel> { new WelcomeViewModel <WelcomePage>(), new SelectionListViewModel <SelectionListPage>(context.Workspace.ActiveProject) }; var mainView = new MainView { DataContext = new MainViewModel(pageViewModels) }; application.MainWindow = mainView; mainView.Show(); application.Run(); } catch (Exception ex) { MessageBox.Show($"An exception has been thrown: {ex.Message}"); throw; } }
public TileListWidget(IEditorApplication application, Selection selection, Adjustment adjv) { this.selection = selection; selection.Changed += OnSelectionChanged; this.application = application; Tileset.LoadEditorImages = true; SetSizeRequest((TILE_WIDTH + SPACING_X) * TILES_PER_ROW, -1); ButtonPressEvent += OnButtonPress; ButtonReleaseEvent += OnButtonRelease; MotionNotifyEvent += OnMotionNotify; ScrollEvent += OnScroll; AddEvents((int)Gdk.EventMask.ButtonPressMask); AddEvents((int)Gdk.EventMask.ButtonReleaseMask); AddEvents((int)Gdk.EventMask.PointerMotionMask); AddEvents((int)Gdk.EventMask.ScrollMask); SizeAllocated += OnSizeAllocated; application.LevelChanged += OnLevelChanged; vadjustment = adjv; vadjustment.ValueChanged += OnVAdjustmentChangedValue; }
public ObjectCreationEditor(IEditorApplication application, Sector sector, Type objectType, Sprite Icon) { this.application = application; this.sector = sector; this.objectType = objectType; this.Icon = Icon; }
public SectorSwitchNotebook(IEditorApplication application) { this.application = application; SwitchPage += OnSwitchPage; ButtonPressEvent += OnButtonPress; application.LevelChanged += OnLevelChanged; application.SectorChanged += OnSectorChanged; }
public BrushEditor(IEditorApplication application, Tilemap Tilemap, Tileset Tileset, string brushFile) { selection = new Selection(); selection.Changed += OnSelectionChanged; this.application = application; this.Tilemap = Tilemap; brush = Brush.loadFromFile(brushFile, Tileset); }
public GameObjectListWidget(IEditorApplication application) { this.application = application; ButtonPressEvent += OnButtonPressed; TextColumn = COL_NAME; application.SectorChanged += OnSectorChanged; }
public PathEditor(IEditorApplication application, Path path) { this.application = application; this.path = path; field = FieldOrProperty.Lookup(typeof(Path).GetField("Nodes")); application.EditProperties(path, "Path"); killTimer = false; GLib.Timeout.Add(100, Animate); }
public GameObjectListWidget(IEditorApplication application) { this.application = application; ButtonPressEvent += OnButtonPressed; TextColumn = COL_NAME; application.SectorChanged += OnSectorChanged; }
public FillEditor(IEditorApplication application, Tilemap Tilemap, Tileset Tileset, Selection selection) { this.application = application; this.Tilemap = Tilemap; this.Tileset = Tileset; this.selection = selection; application.TilemapChanged += OnTilemapChanged; selection.Changed += OnSelectionChanged; }
public Log(IEditorApplication editorApplication, string driverIdent) { var configurator = new NLogConfigurator(); configurator.Configure(); _editorApplication = editorApplication; _driverApiName = driverIdent + "API"; }
public SectorSwitchNotebook(IEditorApplication application) { this.application = application; SwitchPage += OnSwitchPage; ButtonPressEvent += OnButtonPress; application.LevelChanged += OnLevelChanged; application.SectorChanged += OnSectorChanged; FieldOrProperty.Lookup(typeof(Sector).GetField("Name")).Changed += OnSectorRenamed; }
public TilegroupSelector(IEditorApplication application, TileListWidget tileList) { this.tileList = tileList; application.LevelChanged += OnLevelChanged; CellRendererText renderer = new CellRendererText(); PackStart(renderer, false); SetCellDataFunc(renderer, TextDataFunc); Changed += OnTileGroupChoosen; }
public void Run(IEditorApplication context, IBehavior behavior) { try { ImportVars(context, behavior); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
public TilegroupSelector(IEditorApplication application, TileListWidget tileList) { this.tileList = tileList; application.LevelChanged += OnLevelChanged; CellRendererText renderer = new CellRendererText(); PackStart(renderer, false); SetCellDataFunc(renderer, TextDataFunc); Changed += OnTileGroupChosen; }
public void Run(IEditorApplication context, IBehavior behavior) { try { frmDescription frm = new frmDescription("Editor", "Wizard", context.Name); frm.ShowDialog(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
public void Start(IEditorApplication context, IBehavior behavior) { try { frmDescription frm = new frmDescription("Editor", "Service", context.Name); frm.Show(); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }
public void Run(IEditorApplication context, IBehavior behavior) { try { // To load assemblies during runtime, Activor.CreateInstances is uses here (but there are more options available in .NET, e. g. IoC container) // by loading an assembly LateBoundAssembly.dll and instantiation of class LateBoundAssembly.SampleClass // Properties\AddInInfo.cs contains attribute [assembly: AddinModule("LateBoundAssembly.dll")] to add the DLL zu the Add-In Package var result = Activator.CreateInstance("LateBoundAssembly", "LateBoundAssembly.SampleClass"); context.DebugPrint(result.Unwrap().GetType().FullName, DebugPrintStyle.Standard); } catch (Exception e) { context.DebugPrint(e.Message, DebugPrintStyle.Error); } }
public static void CheckIds(IEditorApplication application, Sector sector, bool AlertGood) { System.Text.StringBuilder sb = new System.Text.StringBuilder("These tilemaps have bad ids in sector " + sector.Name + ":"); List <int> invalidtiles; // Any bad found yet? bool bad = false; foreach (Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) { invalidtiles = CheckIds(tilemap, application.CurrentLevel.Tileset); if (invalidtiles.Count != 0) { bad = true; if (String.IsNullOrEmpty(tilemap.Name)) { sb.Append(Environment.NewLine + "Tilemap (" + tilemap.ZPos + ")"); } else { sb.Append(Environment.NewLine + tilemap.Name + " (" + tilemap.ZPos + ")"); } } } MessageType msgtype; string message; if (!bad) { if (!AlertGood) { return; } msgtype = MessageType.Info; message = "No invalid tile ids in any tilemap in sector " + sector.Name + "."; } else { msgtype = MessageType.Warning; message = sb.ToString(); } MessageDialog md = new MessageDialog(null, DialogFlags.DestroyWithParent, msgtype, ButtonsType.Close, message); md.Run(); md.Destroy(); }
public ObjectListWidget(IEditorApplication application) { this.application = application; SetSizeRequest( COLUMN_WIDTH * TILES_PER_ROW, -1); ButtonPressEvent += OnButtonPress; AddEvents((int) Gdk.EventMask.ButtonPressMask); AddEvents((int) Gdk.EventMask.AllEventsMask); AddEvents((int) Gdk.EventMask.ScrollMask); Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask, DragTargetEntries, DragAction.Default); DragBegin += OnDragBegin; ScrollEvent += OnScroll; application.LevelChanged += OnLevelChanged; }
public DriverContext(IEditorApplication editorApplication, Log log, string driverName, bool useTempFolder) { _log = log; if (useTempFolder) { _xmlFolderPath = Environment.GetEnvironmentVariable("TEMP") + "\\TestDriverAPI\\"; } else { _xmlFolderPath = Path.GetFullPath(".\\XMLData\\"); } IWorkspace iWorkSpace = editorApplication.Workspace; IProject iProject = iWorkSpace.ActiveProject; IDriverCollection iDrivers = iProject.DriverCollection; _driverObject = iDrivers[driverName]; }
/// <summary> /// Method which is executed on starting the SCADA Editor Wizard /// </summary> /// <param name="context">SCADA editor application object</param> /// <param name="behavior">For future use</param> public void Run(IEditorApplication context, IBehavior behavior) { try { if (context.Workspace.ActiveProject == null) { MessageBox.Show(string.Format("There is no active project available." + Environment.NewLine + "Please load a project into the workspace!") , "Wizard with WPF GUI"); return; } // Check the time consumption call 10000 times a property called "Name" of IProject DateTime start = DateTime.Now; for (int i = 0; i < 10000; i++) { var name = context.Name; } MessageBox.Show($"Calling 10000 times a property in main thread takes {(DateTime.Now - start).TotalMilliseconds}ms"); // Check the time consumption using a background thread start = DateTime.Now; var task = Task.Factory.StartNew(() => { for (int i = 0; i < 10000; i++) { var name = context.Name; } }); task.Wait(); MessageBox.Show($"Calling 10000 times a property in background thread takes {(DateTime.Now - start).TotalMilliseconds}ms"); } catch (Exception e) { MessageBox.Show(e.Message); } }
public void Run(IEditorApplication context, IBehavior behavior) { try { // Books.xml is copied to the output directory during compilation. In Properties\AddInInfo.cs there is an attribute defined to include the file to the package: // [assembly: ImportAddinFile("Books.xml") ] // The file gets extracted to the Add-In's directory. Property AssemblyDirectory determines the Add-Ins directory. var xmlDocument = XDocument.Load(Path.Combine(AssemblyDirectory, "Books.xml")); foreach (var bookElement in xmlDocument.Elements("catalog").Elements("book")) { context.DebugPrint(bookElement.Element("title").Value, DebugPrintStyle.Standard); } } catch (Exception e) { context.DebugPrint(e.Message, DebugPrintStyle.Error); } }
public TileListWidget(IEditorApplication application, Selection selection) { this.selection = selection; selection.Changed += OnSelectionChanged; this.application = application; Tileset.LoadEditorImages = true; SetSizeRequest((TILE_WIDTH + SPACING_X) * TILES_PER_ROW, -1); ButtonPressEvent += OnButtonPress; ButtonReleaseEvent += OnButtonRelease; MotionNotifyEvent += OnMotionNotify; ScrollEvent += OnScroll; AddEvents((int) Gdk.EventMask.ButtonPressMask); AddEvents((int) Gdk.EventMask.ButtonReleaseMask); AddEvents((int) Gdk.EventMask.PointerMotionMask); AddEvents((int) Gdk.EventMask.ScrollMask); application.LevelChanged += OnLevelChanged; }
public void Run(IEditorApplication context, IBehavior behavior) { var equipmentStructure = new EquipmentModeling.EquipmentModel("MyEquipment", new EquipmentGroup("Group_1", new EquipmentGroup("Sub 1"), new EquipmentGroup("Sub 2")), new EquipmentGroup("Group_2", new EquipmentGroup("Sub_3", new EquipmentGroup("Sub_4", new EquipmentGroup("Sub_5"))))); try { var creator = new EquipmentCreator(); creator.Create(context, equipmentStructure); } catch (Exception ex) { context.DebugPrint("ERROR: Exception: " + ex.Message, DebugPrintStyle.Error); throw; } }
/// <summary> /// This creates an equiment model in zenon by parsing an xml template /// previously exported from zenon. This template gets modified according to the /// given equipment model. The xml gets saved in a temporary file and imported /// to the zenon editor. /// </summary> /// <param name="model">must describe an equipment model</param> /// <exception cref="ArgumentException">is thrown if argument is not of type Equipment modelling</exception> public void Create(IEditorApplication context, IModel model) { #region Argument Validation if (!(model is EquipmentModel)) { throw new ArgumentException("The argument is not of type 'EquipmentModeling'"); } if (context == null || context.Workspace.ActiveProject == null) { throw new ArgumentException("There is no active project in the workspace!"); } #endregion // Creating and naming the equipment model var xmlEquipmentModel = GetEquipmentModel(); xmlEquipmentModel.Element(Constants.Name).Value = (model as EquipmentModel).Name; xmlEquipmentModel.Element(Constants.Guid).Value = (model as EquipmentModel).InternalGuid; // setting all first level groups in equipment model SetEquipmentGroups(ref xmlEquipmentModel, model); // iterating through first level groups and setting child groups recursively foreach (var group in (model as EquipmentModel)?.EquipmentGroups) { SetEquipmentSubGroups(ref xmlEquipmentModel, group.InternalGuid, group.EquipmentGroups); } // Creating the Equipment Model in a zenon compatible format var xmlTemplate = GetEquipmentModelXml(); xmlTemplate.Root.Element(Constants.Apartment).Add(new XElement(Constants.SystemModel, xmlEquipmentModel)); // Create a file for import var xmlFile = CreateTempFilePath("EquipmentModel.xml"); File.WriteAllText(xmlFile, xmlTemplate.ToString()); //import file to Editor context.Workspace.ActiveProject.EquipmentModeling.ImportFromXml(xmlFile); // Cleanup File.Delete(xmlFile); }
public ResizeDialog(Sector sector, IEditorApplication app) { this.sector = sector; application = app; Glade.XML gxml = new Glade.XML("editor.glade", "resizeDialog"); gxml.Autoconnect(this); if(resizeDialog == null || WidthEntry == null || HeightEntry == null) throw new Exception("Couldn't load resize Dialog"); uint width = 0; uint height = 0; foreach(Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) { if(tilemap.Width > width) width = tilemap.Width; if(tilemap.Height > height) height = tilemap.Height; } WidthEntry.Text = width.ToString(); HeightEntry.Text = height.ToString(); resizeDialog.ShowAll(); }
public ObjectListWidget(IEditorApplication application, Adjustment adjv) { this.application = application; SetSizeRequest(COLUMN_WIDTH * TILES_PER_ROW, -1); ButtonPressEvent += OnButtonPress; AddEvents((int)Gdk.EventMask.ButtonPressMask); AddEvents((int)Gdk.EventMask.AllEventsMask); AddEvents((int)Gdk.EventMask.ScrollMask); Gtk.Drag.SourceSet(this, Gdk.ModifierType.Button1Mask, DragTargetEntries, DragAction.Copy | DragAction.Default); SizeAllocated += OnSizeAllocated; DragBegin += OnDragBegin; ScrollEvent += OnScroll; DragDataGet += OnDragDataGet; application.LevelChanged += OnLevelChanged; vadjustment = adjv; vadjustment.ValueChanged += OnVAdjustmentChangedValue; }
public LayerListWidget(IEditorApplication application) { this.application = application; ButtonPressEvent += OnButtonPressed; VisibilityRenderer visibilityRenderer = new VisibilityRenderer(); visibilityRenderer.VisibilityChanged += OnVisibilityChange; TreeViewColumn visibilityColumn = new TreeViewColumn("Visibility", visibilityRenderer); visibilityColumn.SetCellDataFunc(visibilityRenderer, VisibilityDataFunc); AppendColumn(visibilityColumn); CellRendererText TextRenderer = new CellRendererText(); TreeViewColumn TypeColumn = new TreeViewColumn(); TypeColumn.PackStart(TextRenderer, true); TypeColumn.SetCellDataFunc(TextRenderer, TextDataFunc); TypeColumn.Title = "Type"; AppendColumn(TypeColumn); HeadersVisible = false; application.SectorChanged += OnSectorChanged; application.TilemapChanged += OnTilemapChanged; }
public ObjectsEditor(IEditorApplication application, Sector sector) { this.application = application; this.sector = sector; }
public PropertiesView(IEditorApplication application) { this.application = application; }
public TilemapBorder(IEditorApplication application) { this.application = application; }
public SectorRenderer(IEditorApplication application, Level level, Sector sector) { this.application = application; this.level = level; this.sector = sector; Layer layer = new Layer(); backgroundNode = new NodeWithChilds(); backgroundColorNode = new ColorNode(backgroundNode, new Color(1f, 1f, 1f, 1f)); layer.Add(-900, backgroundColorNode); foreach (Background background in sector.GetObjects(typeof(Background))) { Node node = background.GetSceneGraphNode(); if (node == null) { continue; } backgroundNode.AddChild(node); } foreach (Tilemap tilemap in sector.GetObjects(typeof(Tilemap))) { Node node = new TilemapNode(tilemap, level.Tileset); ColorNode colorNode = new ColorNode(node, new Color(1f, 1f, 1f, 1f), true); layer.Add(tilemap.ZPos, colorNode); colors[tilemap] = colorNode; } objectsNode = new NodeWithChilds(); objectsColorNode = new ColorNode(objectsNode, new Color(1f, 1f, 1f, 1f)); layer.Add(1, objectsColorNode); foreach (IObject Object in sector.GetObjects(typeof(IObject))) { Node node = Object.GetSceneGraphNode(); if (node != null) { objectsNode.AddChild(node); } } // fill remaining place with one color sectorFill = new SceneGraph.Rectangle(); sectorFill.Fill = true; ColorNode color = new ColorNode(sectorFill, new Drawing.Color(0.4f, 0.3f, 0.4f)); layer.Add(-10000, color); // draw border around sector... sectorBBox = new SceneGraph.Rectangle(); sectorBBox.Fill = false; color = new ColorNode(sectorBBox, new Drawing.Color(1, 0.3f, 1)); layer.Add(1000, color); // draw border around selected layer... color = new ColorNode(new TilemapBorder(application), new Drawing.Color(1, 1, 0)); layer.Add(1001, color); OnSizeChanged(sector); this.SceneGraphRoot = layer; sector.ObjectAdded += OnObjectAdded; sector.ObjectRemoved += OnObjectRemoved; sector.SizeChanged += OnSizeChanged; application.TilemapChanged += OnTilemapChanged; FieldOrProperty.Lookup(typeof(Tilemap).GetField("ZPos")).Changed += OnTilemapZPosModified; }
private void ImportVars(IEditorApplication context, IBehavior behavior) { IVariableCollection variableCollection = context.Workspace.ActiveProject.VariableCollection; frmDescription frmSelection = new frmDescription(); if (frmSelection.ShowDialog() == System.Windows.Forms.DialogResult.OK) { variableCollection = context.Workspace.ActiveProject.VariableCollection; //Displays all variable names in the zenon editor foreach (IVariable variable in variableCollection) { context.DebugPrint("Variable name: " + variable.Name + " / Channel: " + variable.DataBlock, DebugPrintStyle.Standard); } IDataType myDatatype = context.Workspace.ActiveProject.DataTypeCollection["REAL"]; // Treiber mappen IDriverCollection driverCollection = context.Workspace.ActiveProject.DriverCollection; if (driverCollection == null || driverCollection.Count < 1) { return; } IDriver sel_driver = null; //Displays all available drivers in zenon foreach (IDriver driver in driverCollection) { if (driver.Name == "S7TCP32") { sel_driver = driver; context.DebugPrint("Driver ausgewäht = " + sel_driver.Name, DebugPrintStyle.Standard); } } #region Numerisch //Einlesen von CSV für numerische Variablen List <GTINumVal> GTINumValues = new List <GTINumVal>(); try { context.DebugPrint("Einlesen von: " + frmSelection.file_numeric, DebugPrintStyle.Standard); GTINumValues = ReadCSV(frmSelection.file_numeric); } catch (Exception creationException) { context.DebugPrint("Reading CSV error: " + creationException.Message, DebugPrintStyle.Error); return; } if (GTINumValues.Count < 1) { context.DebugPrint("Reading CSV error", DebugPrintStyle.Error); return; } foreach (GTINumVal tempVal in GTINumValues) { string myVariableName = tempVal.Name; // Jetzt werden die Variablen erstellt if (variableCollection[myVariableName] == null) { try { switch (tempVal.GtiDatentyp) { case "LW": myDatatype = context.Workspace.ActiveProject.DataTypeCollection["DINT"]; break; case "FLOAT": myDatatype = context.Workspace.ActiveProject.DataTypeCollection["REAL"]; break; case "WORT": myDatatype = context.Workspace.ActiveProject.DataTypeCollection["INT"]; break; case "BCD-DL": myDatatype = context.Workspace.ActiveProject.DataTypeCollection["INT"]; break; case "S7-BYTE": myDatatype = context.Workspace.ActiveProject.DataTypeCollection["USINT"]; break; default: myDatatype = context.Workspace.ActiveProject.DataTypeCollection["REAL"]; break; } variableCollection.Create(myVariableName, sel_driver, ChannelType.DriverVariable, myDatatype); if (variableCollection[myVariableName] == null) { context.DebugPrint("Variable could not be created.", DebugPrintStyle.Error); return; } variableCollection[myVariableName].DataBlock = tempVal.DataBlock; variableCollection[myVariableName].Offset = tempVal.Offset; //variableCollection[myVariableName].Unit = "%"; variableCollection[myVariableName].SignalMaximumRange = tempVal.MaxWert; variableCollection[myVariableName].SignalMinimumRange = tempVal.MinWert; variableCollection[myVariableName].MeasuringMaximumRange = tempVal.MaxNorm; variableCollection[myVariableName].MeasuringMinimumRange = tempVal.MinNorm; variableCollection[myVariableName].Digits = tempVal.Komma; variableCollection[myVariableName].NetAddress = tempVal.Netzadresse; } catch (Exception creationException) { context.DebugPrint("Variable creation error: " + creationException.Message, DebugPrintStyle.Error); } context.DebugPrint("Variable " + variableCollection[myVariableName].Name + " has been created.", DebugPrintStyle.Standard); } else { context.DebugPrint("The variable " + variableCollection[myVariableName].Name + " exists already!", DebugPrintStyle.Warning); } } #endregion #region Logisch //Einlesen von CSV für numerische Variablen List <GTILogVal> GTILogValues = new List <GTILogVal>(); try { context.DebugPrint("Einlesen von: " + frmSelection.file_logic, DebugPrintStyle.Standard); GTILogValues = ReadLogCSV(frmSelection.file_logic); } catch (Exception creationException) { context.DebugPrint("Reading CSV error: " + creationException.Message, DebugPrintStyle.Error); return; } if (GTINumValues.Count < 1) { context.DebugPrint("Reading CSV error", DebugPrintStyle.Error); return; } foreach (GTILogVal tempVal in GTILogValues) { string myVariableName = tempVal.Name; // Jetzt werden die Variablen erstellt if (variableCollection[myVariableName] == null) { try { myDatatype = context.Workspace.ActiveProject.DataTypeCollection["BOOL"]; variableCollection.Create(myVariableName, sel_driver, ChannelType.DriverVariable, myDatatype); if (variableCollection[myVariableName] == null) { context.DebugPrint("Variable could not be created.", DebugPrintStyle.Error); return; } variableCollection[myVariableName].DataBlock = tempVal.DataBlock; variableCollection[myVariableName].Offset = tempVal.Offset; variableCollection[myVariableName].BitNumber = tempVal.Bit; variableCollection[myVariableName].NetAddress = tempVal.Netzadresse; } catch (Exception creationException) { context.DebugPrint("Variable creation error: " + creationException.Message, DebugPrintStyle.Error); } context.DebugPrint("Variable " + variableCollection[myVariableName].Name + " has been created.", DebugPrintStyle.Standard); } else { context.DebugPrint("The variable " + variableCollection[myVariableName].Name + " exists already!", DebugPrintStyle.Warning); } } #endregion #region Limits //Einlesen von CSV für numerische Variablen List <GTIAlert> GTIAlerts = new List <GTIAlert>(); GTIAlerts = ReadAlertCSV(frmSelection.file_alert); context.DebugPrint("Number: " + GTIAlerts.Count(), DebugPrintStyle.Standard); foreach (GTIAlert alert in GTIAlerts) { context.DebugPrint("Alert: " + alert.Number + " / Name: " + alert.AlarmText + " / Variable: " + alert.Variable, DebugPrintStyle.Standard); } if (variableCollection == null || variableCollection.Count < 1) { return; } //Alle Variablen als "False" setzten foreach (IVariable variable in variableCollection) { for (int i = 0; i < variable.EditorLimitValueCount; i++) { variable.DeleteEditorLimitValue(i); } if (GTIAlerts.Where(x => x.Variable == variable.Name).Count() > 0) { variable.CreateEditorLimitValue(); IEditorLimitValue limit = variable.GetEditorLimitValue(0); limit.IsActive = true; limit.Text = GTIAlerts.Where(x => x.Variable == variable.Name).FirstOrDefault().AlarmText; } } #endregion } }
public BrushEditor(IEditorApplication application, Tileset Tileset, string brushFile) : base(application, Tileset, new Selection()) { brush = Brush.loadFromFile(brushFile, Tileset); ActionName = "Tile Brush"; }
public FillEditor(IEditorApplication application, Tileset Tileset, Selection selection) : base(application, Tileset, selection) { ActionName = "Flood Fill"; }
public PropertiesView(IEditorApplication application) { this.application = application; }
public ObjectCreationEditor(IEditorApplication application, Sector sector, Type objectType) { this.application = application; this.sector = sector; this.objectType = objectType; }