private void LoadWindows() { UITag = 7; double screenHeight = 768; //只设置了主界面 for (int i = 0; i < 8; i++) { ui[i] = new Windows(); switch (i) { case 0: //主界面 ui[i].MainGrid.Children.Add(new MainUI { Margin = new Thickness(0, 30, 0, 0) }); ui[i].MainGrid.Children.Add(new MainTogether { Margin = new Thickness(0, screenHeight - 165, 0, 0) }); break; case 1: //计划编辑 ui[i].MainGrid.Children.Add(planEdit = new PlanEdit { Margin = new Thickness(0, 30, 0, 0) }); break; case 2: //通讯状态 ui[i].MainGrid.Children.Add(new Comm { Margin = new Thickness(0, 0, 0, 0) }); break; case 3: //电流曲线 for (int index = 0; index < 2; index++) { ui[i].MainGrid.Children.Add(new CurPlotter { Margin = new Thickness(10, 60 + 320 * index, 10, 10), Height = 300, VerticalAlignment = VerticalAlignment.Top, TCarIndex = index, NextPush = true, NextPing = true }); } break; case 4: //结焦状态 ui[i].MainGrid.Children.Add(new BurnStatus { Margin = new Thickness(0, 50, 0, 0), Area = 1 }); ui[i].MainGrid.Children.Add(new BurnStatus { Margin = new Thickness(0, 320, 0, 0), Height = 260, Area = 2 }); break; case 5: //历史记录 ui[i].MainGrid.Children.Add(new QueryRec { Margin = new Thickness(0, 30, 0, 0) }); break; case 6: //用户信息 ui[i].MainGrid.Children.Add(new ContactInfo { Margin = new Thickness(0, 30, 0, 0) }); break; case 7: //系统设置 ui[i].MainGrid.Children.Add(new Setting { Margin = new Thickness(0, 0, 0, 0) }); break; default: break; } ui[i].MainGrid.Children.Add(new Title { Margin = new Thickness(0, 0, 0, 0) }); ui[i].MainGrid.Children.Add(new R.UI.Menu()); } this.Hide(); ui[7].Show(); }
public async Task <IActionResult> PutPlan([FromRoute] int userId, [FromRoute] int id, [FromBody] PlanEdit planEdit) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var currentPlan = _planHelper.GetPlanForDate(userId, DateTime.Today.ToString()); var plan = _planHelper.GetPlan(userId, id).Result; if (plan == null) { return(NotFound()); } if (id != plan.ID || userId != plan.UserID || plan.ID != currentPlan.Result.ID) { return(BadRequest()); } plan.Amount = planEdit.Amount; plan.StartDate = DateTime.Parse(planEdit.StartDate); plan.EndDate = DateTime.Parse(planEdit.EndDate); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlanExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }