private void RadTreeView_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e) { string header = (e.OriginalSource as RadTreeViewItem).Header as string; switch (header) { case "Inputs": DataContext = new InputsViewModel(_studentService, _teacherService); break; case "Chart": DataContext = new ChartViewModel(_studentService); break; case "Spreadsheet": DataContext = new SpreadsheetViewModel(); break; case "Grid": DataContext = new GridViewModel(_studentService); break; case "Scheduler": DataContext = new SchedulerViewModel(_appointmentService); break; case "Report": DataContext = new ReportViewModel(); break; default: break; } }
private void MakeAndShowInputWindow() { vm = new InputsViewModel(this.viewLoadedParams); MessageBox.Show( $"There are {vm.NodeCount} total nodes & {vm.WireCount} wires," + Environment.NewLine + $"{vm.InputNodes.Count} of which are marked as inputs : " + Environment.NewLine + String.Join(Environment.NewLine, vm.InputNodesNames) ); // Associate ViewModel with Window }
public MainWindow(IStudentService studentService, ITeacherService teacherService, IAppointmentService appointmentService) { _studentService = studentService; _teacherService = teacherService; _appointmentService = appointmentService; StyleManager.ApplicationTheme = new MaterialTheme(); InitializeComponent(); DataContext = new InputsViewModel(_studentService, _teacherService); }
private void MakeAndShowInputWindow() { var viewModel = new InputsViewModel(this.viewLoadedParams); var window = new InputsWindow { // Set the data context for the main grid in the window. MainGrid = { DataContext = viewModel }, // Set the owner of the window to the Dynamo window. Owner = this.viewLoadedParams.DynamoWindow }; window.Left = window.Owner.Left + 400; window.Top = window.Owner.Top + 200; window.Show(); }
public async Task <ActionResult> Index(InputsViewModel inputs) { if (this.ModelState.IsValid) { //save inputs //Another simpler way is to generate input files without save inputs first //But by saving to db first, later easy to improve it to make it more user friendly and scalaable. var runInstance = await SaveInputsAsync(inputs); //generate input files await _fileGenerator.GenerateInputFilesAsync(runInstance.run_instance_id); //redirect return(RedirectToAction("Index", "RunScripts", new { runInstanceId = runInstance.run_instance_id })); } else { return(View(inputs)); } }
private async Task <RunInstance> SaveInputsAsync(InputsViewModel inputs) { var runInstance = new RunInstance() { Setup = inputs.Setup.ToModel() }; foreach (var region in inputs.Regions.Where(r => r.Selected == true)) { runInstance.RunInstance_Region.Add( new RunInstance_Region() { region_code = region.Entity.region_code }); } foreach (var region in inputs.Products.Where(p => p.Selected == true)) { runInstance.RunInstance_Product.Add( new RunInstance_Product() { product_code = region.Entity.product_code }); } foreach (var channel in inputs.Chanlels.Where(c => c.Selected == true)) { runInstance.RunInstance_Channel.Add( new RunInstance_Channel() { channel_code = channel.Entity.channel_code }); } var dataRepository = DataRepositoryTool.GetDataRepository(); await dataRepository.AddAsync(runInstance); return(runInstance); }
public async Task <ActionResult> Index() { var vm = new InputsViewModel(); var dataRepository = DataRepositoryTool.GetDataRepository(); var regions = await dataRepository.GetListAsync <Region>(); var products = await dataRepository.GetListAsync <Product>(); var channels = await dataRepository.GetListAsync <Channel>(); vm.Regions = from r in regions select new SelectableRegion() { Entity = r }; vm.Products = from p in products select new SelectableProduct() { Entity = p }; vm.Chanlels = from c in channels select new SelectableChannel() { Entity = c }; return(View(vm)); }