public void Setup() { // Create VMs controlVM = new ControlViewModel(); //dataVM = new DataViewModel(); // Link VMs to VMs //controlVM.DataVM = dataVM; // Create models yearsModel = new YearsModel(); dataModel = new DataModel(); graphModel = new GraphModel(); // Link models to VMs controlVM.YearsModel = yearsModel; controlVM.DataModel = dataModel; filePaths = Directory.GetFiles("res\\TaxCSV", "*.csv"); for (int i = 0; i < filePaths.Length; i++) { controlVM.YearsModel.Years.Add(i, Parser.ParseCSV(filePaths[i])); } }
public ActionResult Edit(ControlViewModel control) { //db.Entry(control).State = EntityState.Modified; //db.SaveChanges(); //********************************************** if (User.Identity.IsAuthenticated) { if (ModelState.Values.ElementAt(1).Value.AttemptedValue != "") { using (ApplicationDbContext db = new ApplicationDbContext()) { if (control.id != null) { var userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(db)); var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(db)); var user = userManager.FindById(control.id); user.Email = control.email; user.UserName = control.username; roleManager.FindById(control.id).Name = control.Rol; if (control.password != "") { user.PasswordHash = control.password; } } return(RedirectToAction("Index")); } } return(View(control)); } return(RedirectToAction("Register", "Account")); }
public ActionResult Create(ControlViewModel control) { if (User.Identity.IsAuthenticated) { if (ModelState.Values.ElementAt(0).Value.AttemptedValue != "" && ModelState.Values.ElementAt(1).Value.AttemptedValue != "" && ModelState.Values.ElementAt(2).Value.AttemptedValue != "") { using (ApplicationDbContext db = new ApplicationDbContext()) { var userManager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(db)); var user = new ApplicationUser() { UserName = control.username, }; var result = userManager.Create(user, control.password); if (result.Succeeded) { var result2 = userManager.AddToRole(userManager.FindByName(user.UserName).Id, control.Rol); return(RedirectToAction("Index")); } var roleManager = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(db)); ViewBag.Rol = new SelectList(roleManager.Roles.Select(r => r.Name).ToList()); return(View(control)); } } return(RedirectToAction("Create")); } return(RedirectToAction("Register", "Account")); }
public Tool(IPackageContext packageContext, IBuildInfo buildContext, IBuildDistributor buildDistributor, ControlViewModel viewModel) { _packageContext = packageContext; _dte = packageContext.GetDTE(); _dte2 = packageContext.GetDTE2(); if (_dte == null) { throw new InvalidOperationException("Unable to get DTE instance."); } _dteStatusBar = packageContext.GetStatusBar(); if (_dteStatusBar == null) { TraceManager.TraceError("Unable to get IVsStatusbar instance."); } _toolWindowManager = new ToolWindowManager(packageContext); _buildContext = buildContext; _buildDistributor = buildDistributor; _viewModel = viewModel; _solutionEvents = _dte.Events.SolutionEvents; Initialize(); }
/// <summary> /// Recursive method to iterate in the controls obtained from the GetControlsIterator /// </summary> /// <param name="parent">The actual control in the search</param> /// <param name="control">The control to be searched</param> /// <param name="VisualParentDictionary">Stores the controls and their parent found previously</param> /// <returns></returns> public static IStateObject FindVisualParent(IControlsContainer parent, ControlViewModel control, Dictionary<string, IStateObject> VisualParentDictionary) { if (parent == null) { return null; // GetControlsIterator can return null controls } var Controls = parent.GetControlsIterator(); IStateObject VisualParent = null; for (var i = 0; i < Controls.Count(); i++) { var ctl = Controls.ElementAt(i); if (ctl == control) { if (!VisualParentDictionary.ContainsKey(control.UniqueID)) VisualParentDictionary.Add(control.UniqueID, parent); return parent as IStateObject; } else { VisualParent = FindVisualParent(ctl, control, VisualParentDictionary); if (VisualParent != null) { return VisualParent; } } } return VisualParent; }
public RouteItemViewModel( ControlViewModel control, IEnumerable<PriorityType> priorityTypes, RouteElement orginalRouteElement ) { this._priorityTypes = new ObservableCollection<PriorityType>( priorityTypes ); this._control = control; this._orginalRouteElement = orginalRouteElement; this.CanStopOnIt = orginalRouteElement.CanStop; }
public ControlView() { InitializeComponent(); _recordInfoCollection = (CollectionViewSource)Resources["RecordInfoListKey"]; Observable.FromEventPattern <TextChangedEventArgs>(RecordSearchBox, "TextChanged") .Throttle(TimeSpan.FromMilliseconds(SEARCH_REFRESH_DELAY_MS)) .ObserveOnDispatcher() .Subscribe(t => _recordInfoCollection.View.Refresh()); // Design time! if (DesignerProperties.GetIsInDesignMode(this)) { var appConfiguration = new CapFrameXConfiguration(); var recordDirectoryObserver = new RecordDirectoryObserver(appConfiguration, new LoggerFactory().CreateLogger <RecordDirectoryObserver>()); DataContext = new ControlViewModel(new RecordDirectoryObserver(appConfiguration, new LoggerFactory().CreateLogger <RecordDirectoryObserver>()), new EventAggregator(), new CapFrameXConfiguration(), new RecordDataProvider(recordDirectoryObserver, appConfiguration, new LoggerFactory().CreateLogger <RecordDataProvider>())); } SetSortSettings((DataContext as ControlViewModel).AppConfiguration); }
private void Control_Loaded(object sender, System.Windows.RoutedEventArgs e) { var messenger = new Messenger(); messenger.Register <UpdateHeaderMessage>(this, m => UpdateHeader(m)); DataContext = new ControlViewModel(messenger); }
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { Debug.Assert(DataContext != null); _viewModel = (ControlViewModel)DataContext; _viewModel.SetGridColumnsRef(Grid.Columns); _viewModel.PropertyChanged += ViewModelOnPropertyChanged; }
public ControlWindow() { InitializeComponent(); ControlViewModel controlViewModel = new ControlViewModel(); DataContext = controlViewModel; Closed += (o, e) => { Process.GetCurrentProcess().Kill(); }; }
public MainWindow() { InitializeComponent(); var controlViewModel = new ControlViewModel(); ControlView.DataContext = controlViewModel; }
public MainWindowViewModel() { base.DisplayName = "MainWindowViewModel"; ControlVM = new ControlViewModel(); MenuVM = new MenuViewModel(); ControlVM.LogEntryVM.AddEntry("Application Started"); }
public IActionResult Control(string id) { var viewModel = new ControlViewModel { Id = id }; return(View(viewModel)); }
private void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { Debug.Assert(DataContext != null); _viewModel = (ControlViewModel)DataContext; _viewModel.GridColumnsRef = Grid.Columns; _viewModel.PropertyChanged += ViewModelOnPropertyChanged; _viewModel.Model.SolutionItem.Projects.CollectionChanged += ProjectsOnCollectionChanged; }
protected override void OnActivate(CancelEventArgs e) { ToolWindowPane toolWindow = Package.GetToolWindow(); ControlViewModel viewModel = ToolWindow.GetViewModel(toolWindow); viewModel.SyncColumnSettings(); base.OnActivate(e); }
private static void SendMessageToSetIsRunning(ControlViewModel model, bool isRunning) { var message = new ControlModelChangedMessage { IsRunning = isRunning }; model.ControlModelChangedHandler(message); }
private ControlView CreateMyControl() { var packageContext = (IPackageContext)Package; var viewMode = new ControlViewModel(new ControlModel(), packageContext); var view = new ControlView { DataContext = viewMode }; return(view); }
private void SaveControlSettings() { ControlViewModel viewModel = GetViewModel(this); viewModel.SyncColumnSettings(); var packageContext = (IPackageContext)Package; packageContext.SaveSettings(); }
public static UpgradeHelpers.Interfaces.IViewModel FindForm(this IControl icontrol) { ControlViewModel control = icontrol as ControlViewModel; while (control != null && !(control is UpgradeHelpers.Interfaces.IViewModel)) { control = control.ParentInternal; } return((UpgradeHelpers.Interfaces.IViewModel)control); }
protected virtual void Dispose(bool flag) { if (!_isDisposed) { SplitScreenNode = null; if (ControlViewModel != null) { ControlViewModel.Dispose(); } } }
public PartialViewResult userDetail(string user) { using (ApplicationDbContext db = new ApplicationDbContext()) { var userD = db.Users.Where(u => u.UserName == user).ToList(); ControlViewModel control = new ControlViewModel(); control.email = userD.ElementAt(0).Email; control.username = userD.ElementAt(0).UserName; return(PartialView("_UserDetail", control)); } }
//показать таблицу промежуточного контроля private void DisplayControlsTable() { if (CBDiscInControl.SelectedItem != null && CBGroupInControl.SelectedItem != null) { controlsCollection = new ControlsCollection(_teacher.Id, GetIdDiscipline(CBDiscInControl.SelectedItem.ToString()), GetIdGroup(CBGroupInControl.SelectedItem.ToString())); ControlViewModel controlViewModel = new ControlViewModel(controlsCollection.ControlList); DataGridControls.DataContext = controlViewModel; } }
public CommandLinePlugin() { viewModel = new ControlViewModel(); //viewModel.PropertyChanged += HandleViewModelPropertyChanged; controller = new ContentPipelineController(); aliasCodeGenerator = new AliasCodeGenerator(); aliasCodeGenerator.Initialize(controller); // todo? //CodeWriter.GlobalContentCodeGenerators.Add(aliasCodeGenerator); }
public Loader() { // Make models YearsModel = new YearsModel(); GraphModel = new GraphModel(); DataModel = new DataModel(); // Load CSVs LoadYears(); // make viewmodels MainVM = new MainViewModel(); DataVM = new DataViewModel(); ControlVM = new ControlViewModel(); GraphVM = new GraphViewModel(); OutputVM = new OutputViewModel(); SettingsVM = new SettingsViewModel(); // Link VMs MainVM.DataVM = DataVM; MainVM.SettingsVM = SettingsVM; DataVM.ControlVM = ControlVM; DataVM.GraphVM = GraphVM; DataVM.OutputVM = OutputVM; ControlVM.MainVM = MainVM; ControlVM.DataVM = DataVM; ControlVM.OutputVM = OutputVM; ControlVM.GraphVM = GraphVM; SettingsVM.MainVM = MainVM; // Connect models to VMs DataVM.DataModel = DataModel; DataVM.YearsModel = YearsModel; DataVM.GraphModel = GraphModel; ControlVM.YearsModel = YearsModel; ControlVM.GraphModel = GraphModel; ControlVM.DataModel = DataModel; GraphVM.GraphModel = GraphModel; GraphVM.YearsModel = YearsModel; GraphVM.DataModel = DataModel; OutputVM.DataModel = DataModel; DataVM.DataInit(); }
public MainViewModel() { SongListViewModel = new SongListViewModel(this); PlayListViewModel = new PlayListViewModel(this); TagsPanelViewModel = new TagsPanelViewModel(this); ControlViewModel = new ControlViewModel(this); SongList = SongListModel.Instance.GetSongsDb(); PlayList = PlayListModel.Instance.LoadSongs(SongList); SelectTagsCommand = new DelegateCommand <Button>(OnSelectTags); ClosingCommand = new DelegateCommand(OnClosing); }
public void Setup() { ControlVM = new ControlViewModel(); YearsModel yearsModel = new YearsModel(); DataModel dataModel = new DataModel(); ControlVM.YearsModel = yearsModel; ControlVM.DataModel = dataModel; filePaths = Directory.GetFiles("res\\TaxCSV", "*.csv"); for (int i = 0; i < filePaths.Length; i++) { ControlVM.YearsModel.Years.Add(i, Parser.ParseCSV(filePaths[i])); } }
private void ToolInitialize() { try { _controlSettings = LoadSettings(this); ToolWindowPane toolWindow = GetToolWindow(); IPackageContext packageContext = this; ControlViewModel viewModel = ToolWindow.GetViewModel(toolWindow); var buildContext = new BuildContext(packageContext, viewModel.FindProjectItem); var tool = new Tool.Tool(packageContext, buildContext, buildContext, viewModel); } catch (Exception ex) { ex.TraceUnknownException(); } }
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { ValueProviderResult formIdResult = bindingContext.ValueProvider.GetValue("FormId"); if (formIdResult == null) return null; long formId = long.Parse(formIdResult.AttemptedValue); ValueProviderResult controlIdResult = bindingContext.ValueProvider.GetValue(bindingContext.ModelName + ".Id"); if (controlIdResult == null) return null; int controlId = int.Parse(controlIdResult.AttemptedValue); FormViewModel form; ControlViewModel model = FormControlManager.GetControl(formId, controlId, out form); if (model == null) return null; bindingContext.ModelMetadata = ModelMetadataProviders.Current.GetMetadataForType(() => model, model.GetType()); return base.BindModel(controllerContext, bindingContext); }
public MainWindowViewModel() { SocketControl = new ControlViewModel { IsHex = true, DeveloperCommand = "010203" }; ITcpClient tcpClient = new EasyTcpClient { Ip = "192.168.10.227", Port = 4040 }; var endBytesIdentifier = new byte[] { 0x0a, 0x0b }; tcpClient.Connect(endBytesIdentifier); SocketControl.TcpClient.Connect("192.168.10.227", 4040, new byte[] { 0xa, 0xb }); SocketControl.TcpClient.DataEvent += DataIncoming; }
public InitializationViewModel(Camera c, ControlViewModel cvm) { base.DisplayName = "InitializationViewModel"; _camera = c; _controlViewModel = cvm; _enableReadyButton = false; SetReadings(); CommandOK = new RelayCommand(param => this.Ready(param), cc => { return(_enableReadyButton); }); _dispatcherTimer = new DispatcherTimer(); _dispatcherTimer.Tick += new EventHandler(_dispatcherTimer_Tick); _dispatcherTimer.Interval = new TimeSpan(0, 0, 1); _dispatcherTimer.Start(); _startTime = DateTime.Now; }
public PartialViewResult ActionLink() { //var datas = new List<string>() { }; //datas.Add("1 Kg"); datas.Add("1 lb"); datas.Add("16 Oz"); using (ApplicationDbContext db = new ApplicationDbContext()) { var user = db.Users.Select(u => u.UserName).ToList(); List <ControlViewModel> obj = new List <ControlViewModel>(); for (int i = 0; i < user.Count; i++) { ControlViewModel control = new ControlViewModel(); control.username = user[i]; obj.Add(control); } return(PartialView("_User", obj)); } }
public void Setup() { // Create VMs mainVM = new MainViewModel(); dataVM = new DataViewModel(); controlVM = new ControlViewModel(); outputVM = new OutputViewModel(); graphVM = new GraphViewModel(); // Link VMs to VMs dataVM.ControlVM = controlVM; dataVM.GraphVM = graphVM; //controlVM.DataVM = dataVM; controlVM.MainVM = mainVM; // Create models yearsModel = new YearsModel(); dataModel = new DataModel(); graphModel = new GraphModel(); // Link models to VMs dataVM.YearsModel = yearsModel; dataVM.DataModel = dataModel; dataVM.GraphModel = graphModel; controlVM.YearsModel = yearsModel; controlVM.DataModel = dataModel; controlVM.GraphModel = graphModel; outputVM.DataModel = dataModel; graphVM.YearsModel = yearsModel; graphVM.GraphModel = graphModel; graphVM.DataModel = dataModel; string[] filePaths = Directory.GetFiles("res\\TaxCSV", "*.csv"); for (int i = 0; i < filePaths.Length; i++) { IncomeYearModel year = Parser.ParseCSV(filePaths[i]); yearsModel.Years.Add(year.Year, year); } }
public void ControlClicked( ControlViewModel control ) { this.RouteEditor.ControlCliced( control ); }
public void ControlCliced( ControlViewModel control ) { if ( this.SelectedRoad == null ) { return; } this.SelectedRoad.ControlClicked( control ); }
private void SetIsNotRunningToTrue(ControlViewModel model) { SendMessageToSetIsRunning(model, false); }
public void ControlClicked( ControlViewModel control ) { }
public void ControlClicked( ControlViewModel controlViewModel ) { if ( this.IsAddMode ) { this.AddToList( controlViewModel ); } else { this.SelectControl( controlViewModel ); } }
private void SelectControl( ControlViewModel controlViewModel ) { var controlToSelect = this.Items.FirstOrDefault( f => f.Control.Control.Id == controlViewModel.Control.Id ); this.SelectedItem = controlToSelect; if ( controlToSelect == null ) { return; } }
private void AddToList( ControlViewModel controlViewModel ) { var canAdd = this._orignalRoute.CanAdd( controlViewModel.Control ); if ( !canAdd ) { return; } var path = this._orignalRoute.Add( ( IRouteElement ) controlViewModel.Control ); var conv = path.Select( p => this._converter.Convert( p ) ).ToArray(); Execute.OnUIThread( () => conv.ForEach( this.Items.Add ) ); }