private void DesignerListBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { ViewModelDesignEditor vm = DataContext as ViewModelDesignEditor; if (e.AddedItems.Count > 0) { binderClass cls = e.AddedItems[0] as binderClass; vm.Apply(cls); } }
public int Start(List <IStep> steps) { list = ViewModelDesignEditor.Get(_scenarioFile, null, null); _steps = steps; t1 = new Thread(Render); t1.Start(); return(ModelHelper.period * (list.Count + 10) * 3); }
public DesignEditor(ArduinoDriver arduino) { InitializeComponent(); ViewModelMaxLayout vmLayout = maxlayout.DataContext as ViewModelMaxLayout; vmLayout.DesignMode = true; ViewModelDesignEditor vm = new ViewModelDesignEditor(vmLayout, arduino); DataContext = vm; vm.view = this; }
private void ButtonAdd_OnClick(object sender, RoutedEventArgs e) { //RenderTargetBitmap rtb = new RenderTargetBitmap((int)maxlayout.ActualWidth, (int)maxlayout.ActualHeight, 96, 96, PixelFormats.Pbgra32); //rtb.Render(maxlayout); //PngBitmapEncoder png = new PngBitmapEncoder(); //png.Frames.Add(BitmapFrame.Create(rtb)); //MemoryStream stream = new MemoryStream(); //png.Save(stream); //Bitmap bit = new Bitmap(stream); //Bitmap resizedBit = ResizeBitmap(bit, 200, 80); //BitmapImage newimg = ToBitmapImage(resizedBit); BitmapImage newimg = GetImage(maxlayout); ViewModelDesignEditor vm = DataContext as ViewModelDesignEditor; vm.Datas.Add(new binderClass { imageSource = newimg, rawData = vm.Read() }); vm.OnPropertyChanged("Datas"); }