Exemple #1
0
        public void AddNewOperation(object sender, AddOperationEventArgs e)
        {
            var machine = ((App)Application.Current).Machine;
            var elem    = new BindableCyclogramElement(machine.Cyclogram, e.Operation);

            cyclItems.Add(elem);
            //CyclogramGrid.Items.Add(elem);
        }
Exemple #2
0
        public MainWindow()
        {
            var app = (App)Application.Current;

            InitializeComponent();
            DataContext = this;
            var machine = app.Machine = new MachineAdapter();

            machine.Wires.CollectionChanged           += wiresCollectionChanged;
            machine.Cyclogram.Steps.CollectionChanged += stepsCollectionChanged;

            CyclogramGrid.Columns.Add(new DataGridTextColumn()
            {
                Header  = "",
                Binding = new Binding("Name")
                {
                    Mode = BindingMode.OneWay
                },
            });
            CyclogramGrid.ItemsSource = cyclItems;

            AddWireOperationCommand = new RelayCommand(param =>
            {
                var p = param as WireProxy;
                if (p == null)
                {
                    throw new ArgumentException("Param Type");
                }
                var elem = new BindableCyclogramElement(machine.Cyclogram, p.Wire);
                cyclItems.Add(elem);
            });
            RemoveWireOperationCommand = new RelayCommand(param =>
            {
                var p = param as WireProxy;
                if (p == null)
                {
                    throw new ArgumentException("Param Type");
                }
                machine.RemoveWire(p);
            });
        }