/// <summary> /// Attach the view to this presenter. /// </summary> /// <param name="model"></param> /// <param name="view"></param> /// <param name="explorerPresenter"></param> public void Attach(object model, object viewBase, ExplorerPresenter explorerPresenter) { view = (ViewBase)viewBase; jobListView = view.GetControl <ListView>("jobListView"); refreshButton = view.GetControl <ButtonView>("refreshButton"); downloadButton = view.GetControl <ButtonView>("downloadButton"); stopButton = view.GetControl <ButtonView>("stopButton"); deleteButton = view.GetControl <ButtonView>("deleteButton"); credentialsButton = view.GetControl <ButtonView>("credentialsButton"); showMyJobsOnlyCheckbox = view.GetControl <CheckBoxView>("showMyJobsCheckbox"); progressBar = view.GetControl <ProgressBarView>("progressBar"); jobListView.SortColumn = "Start time"; jobListView.SortAscending = false; jobListView.AddColumn("Name"); jobListView.AddColumn("Owner"); jobListView.AddColumn("State"); jobListView.AddColumn("# Sims"); jobListView.AddColumn("Progress"); jobListView.AddColumn("Start time"); jobListView.AddColumn("End time"); jobListView.AddColumn("Duration"); jobListView.AddColumn("CPU time"); refreshButton.Clicked += OnRefreshClicked; downloadButton.Clicked += OnDownloadClicked; stopButton.Clicked += OnStopClicked; deleteButton.Clicked += OnDeleteClicked; credentialsButton.Clicked += OnCredentialsClicked; showMyJobsOnlyCheckbox.Changed += OnShowMyJobsChanged; }
/// <summary>Attaches this presenter to a view.</summary> /// <param name="model"></param> /// <param name="viewBase"></param> /// <param name="parentPresenter"></param> public void Attach(object model, object viewBase, ExplorerPresenter parentPresenter) { presenter = parentPresenter; view = (ViewBase)viewBase; modelToRun = (IModel)model; nameOfJobEdit = view.GetControl <EditView>("nameOfJobEdit"); numberCPUCombobox = view.GetControl <DropDownView>("numberCPUCombobox"); apsimTypeToRunCombobox = view.GetControl <DropDownView>("apsimTypeToRunCombobox"); directoryLabel = view.GetControl <LabelView>("directoryLabel"); directoryEdit = view.GetControl <EditView>("directoryEdit"); browseButton = view.GetControl <ButtonView>("browseButton"); versionLabel = view.GetControl <LabelView>("versionLabel"); versionCombobox = view.GetControl <DropDownView>("versionCombobox"); submitButton = view.GetControl <ButtonView>("submitButton"); statusLabel = view.GetControl <LabelView>("statusLabel"); lowPriorityCheckBox = view.GetControl <CheckBoxView>("lowPriorityCheckBox"); nameOfJobEdit.Text = modelToRun.Name + DateTime.Now.ToString("yyyy-MM-dd HH.mm"); numberCPUCombobox.Values = new string[] { "16", "32", "48", "64", "80", "96", "112", "128", "256" }; numberCPUCombobox.SelectedValue = ApsimNG.Cloud.Azure.AzureSettings.Default.NumCPUCores; apsimTypeToRunCombobox.Values = new string[] { "A released version", "A directory", "A zip file" }; if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion)) { apsimTypeToRunCombobox.SelectedValue = "A released version"; } else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory)) { apsimTypeToRunCombobox.SelectedValue = "A directory"; } else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile)) { apsimTypeToRunCombobox.SelectedValue = "A zip file"; } else { apsimTypeToRunCombobox.SelectedValue = "A released version"; } SetupWidgets(); if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion)) { versionCombobox.SelectedValue = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMVersion; } else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory)) { directoryEdit.Text = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMDirectory; } else if (!string.IsNullOrEmpty(ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile)) { directoryEdit.Text = ApsimNG.Cloud.Azure.AzureSettings.Default.APSIMZipFile; } lowPriorityCheckBox.Checked = ApsimNG.Cloud.Azure.AzureSettings.Default.LowPriority; apsimTypeToRunCombobox.Changed += OnVersionComboboxChanged; browseButton.Clicked += OnBrowseButtonClicked; submitButton.Clicked += OnSubmitJobClicked; }
public static CheckBoxView GetCheckBox(ComponentContainer child, StandAloneFormSessionInfo info) { CheckBoxView checkBox = new CheckBoxView() { IsChecked = GetControlData <bool>(child, info), Text = child.DataName }; return(checkBox); }
/// <summary> /// Initializes a new instance of the CheckBoxRenderer class. /// </summary> /// <param name="checkBoxView">A check box view.</param> public CheckBoxRenderer(CheckBoxView checkBoxView) : base(checkBoxView) { this.checkBoxView = checkBoxView; }
public ClickListener(CheckBoxView myCheckbox) { _myCheckbox = myCheckbox; }
public CheckBoxControl(ChildElement elementData, CheckBoxView view) : base(elementData, view) { }
public ActionResult AssignOnVideo() { VideoAppPOCEntities2 db = new VideoAppPOCEntities2(); UserModel ud = new UserModel(); var model = (from r in db.AppUsers where r.RoleID == 2 select new CheckBoxView { UserId = r.UserID, userName = r.userName, RoleId = r.RoleID, //VideoID = a.VideoID }); var data = model.ToList(); CheckBoxView cbv = new CheckBoxView(); cbv.users = data; var usersData = db.AppUsers.ToList(); var getVideoName = db.AppVideos.ToList(); if (getVideoName == null) { TempData["msg"] = "no video can be assign"; } else { try { var selectedVideoId = 0; if (TempData["redirectedVideoId"] != null && TempData["redirectedVideoId"].ToString() != "") { selectedVideoId = Convert.ToInt32(TempData["redirectedVideoId"]); ViewBag.curretSelectedVideoId = selectedVideoId; ud.VideoID = Convert.ToInt32(TempData["redirectedVideoId"]); } else { selectedVideoId = getVideoName[0].VideoID; ud.VideoID = getVideoName[0].VideoID; } var checkedData = (from r in db.AppVideoUsers where r.VideoID == selectedVideoId select r).ToList(); ud.users = usersData; foreach (var item in cbv.users) { foreach (var checkItem in checkedData) { if (item.UserId == checkItem.UserID) { item.isChecked = true; } } } } catch (ArgumentOutOfRangeException e) { Console.WriteLine(e); } } SelectList list = new SelectList(getVideoName, "VideoID", "VideoTitle"); ViewBag.getVideo = list; return(View(cbv)); }