private void metroButton1_Click(object sender, EventArgs e) { Person person = new Person { Name = txtName.Text, Phone = txtphone.Text, Fax = txtFax.Text, Website = txtwebsite.Text, Type = TypeOfPerson.Supplier }; MyValidationContext vContext = CustomValidation.IsValid <Person>(person); if (vContext.IsValid) { context.People.Add(person); if (context.SaveChanges() > 0) { MessageBox.Show("successfull Add Supplier", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); GetSupplier(); ControlHelpers.EmptyGroupBox(this.groupForm); } } else { foreach (var item in vContext.results) { MessageBox.Show(item.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public override void CreateControl(DotvvmControl container, PropertyDisplayMetadata property, DynamicDataContext context) { var textBox = new DotVVM.BusinessPack.Controls.TextBox(context.BindingCompilationService); container.Children.Add(textBox); var cssClass = ControlHelpers.ConcatCssClasses(ControlCssClass, property.Styles?.FormControlCssClass); if (!string.IsNullOrEmpty(cssClass)) { textBox.Attributes["class"] = cssClass; } textBox.FormatString = property.FormatString; textBox.SetBinding(TextBox.TextProperty, context.CreateValueBinding(property.PropertyInfo.Name)); if (property.DataType == DataType.Password) { textBox.Type = TextBoxType.Password; } else if (property.DataType == DataType.MultilineText) { textBox.Type = TextBoxType.MultiLine; } if (textBox.IsPropertySet(DynamicEntity.EnabledProperty)) { ControlHelpers.CopyProperty(textBox, DynamicEntity.EnabledProperty, textBox, TextBox.EnabledProperty); } }
private void metroButton2_Click(object sender, EventArgs e) { try { Person person = context.People.FirstOrDefault(a => a.ID == selectedPerson.ID); person.Name = txtName.Text; person.Fax = txtFax.Text; person.Phone = txtphone.Text; person.Website = txtwebsite.Text; MyValidationContext vContext = CustomValidation.IsValid <Person>(person); if (vContext.IsValid) { context.Entry(person).State = System.Data.Entity.EntityState.Modified; if (context.SaveChanges() > 0) { MessageBox.Show("successfull Edit Supplier", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); GetSupplier(); ControlHelpers.EmptyGroupBox(this.groupForm); } } else { foreach (var item in vContext.results) { MessageBox.Show(item.ErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch { MessageBox.Show("Invalid Operation"); } }
public ActionResult Register() { //DropDown ViewBag.CompanyList = ControlHelpers.AllCompaniesListDropDown(); ViewBag.BranchList = new SelectList(Enumerable.Empty <SelectListItem>(), "BranchId", "BranchName"); ViewBag.BusinessTypeList = ControlHelpers.BusinessTypeEnumListDropDown(); return(View()); }
public ActionResult OrganisationDetails() { HomeOrganisationDetailsView model = HomeViewHelpers.CreateHomeOrganisationDetailsView(User); //DropDown ViewBag.OrganisationList = ControlHelpers.AllOrganisationsListDropDown(); return(View(model)); }
private void NetworkListManager_NetworkConnectivityChanged(Guid networkId, NETWORKLIST.NLM_CONNECTIVITY newConnectivity) { this.EnableForm(false); //wait for network to disconnect ControlHelpers.Sleep(2000).Wait(); PopulateControls(); this.EnableForm(); }
public GridViewColumn CreateColumn(GridView gridView, PropertyDisplayMetadata property, DynamicDataContext context) { var column = CreateColumnCore(gridView, property, context); column.CssClass = ControlHelpers.ConcatCssClasses(column.CssClass, property.Styles?.GridCellCssClass); column.HeaderCssClass = ControlHelpers.ConcatCssClasses(column.HeaderCssClass, property.Styles?.GridHeaderCellCssClass); return(column); }
void ShellUi.SwitchUi( Ui newUi) { var control = newUi as Control; ControlHelpers.SafeReplace( control, this); }
public async Task <ActionResult> Create(AppUserView model) { if (ModelState.IsValid) { //initialise the task creation flags bool createUserOnHoldTask = false; //Retrieve Branch Branch branch = BranchHelpers.GetBranch(db, model.SelectedBranchId.Value); //Create a new AppUser then write here AppUser appUser = AppUserHelpers.CreateAppUser(model.FirstName, model.LastName, branch.BranchId, model.EntityStatus, model.Email, model.PrivacyLevel, model.UserRole); BranchUser branchUser = null; var user = new ApplicationUser { UserName = model.Email, Email = model.Email, AppUserId = appUser.AppUserId, FullName = model.FirstName + " " + model.LastName, CurrentUserRole = model.UserRole }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { //set on-hold task flag if (model.EntityStatus == EntityStatusEnum.OnHold) { createUserOnHoldTask = true; } //Now Update related entities //BranchUser - set the status as ACTIVE as the link is active even though the entities linked are not. branchUser = BranchUserHelpers.CreateBranchUser(appUser.AppUserId, branch.BranchId, branch.CompanyId, model.UserRole, EntityStatusEnum.Active); //Task creation if (createUserOnHoldTask) { UserTaskHelpers.CreateUserTask(TaskTypeEnum.UserOnHold, "New user on hold, awaiting administrator/manager activation", appUser.AppUserId, appUser.AppUserId, EntityStatusEnum.Active); } return(RedirectToAction("UserAdmin", "Admin")); } //Delete the appUser account as this has not gone through AppUserHelpers.DeleteAppUser(appUser.AppUserId); AddErrors(result); } // If we got this far, something failed, redisplay form - set up the drop downs dependant on what was there originally from the model Branch userBranch = BranchHelpers.GetCurrentBranchForUser(AppUserHelpers.GetGuidFromUserGetAppUserId(User.Identity.GetAppUserId())); //DropDown ViewBag.BranchList = ControlHelpers.AllBranchesForCompanyListDropDown(userBranch.CompanyId, userBranch.BranchId); ViewBag.UserRoleList = ControlHelpers.UserRoleEnumListDropDown(); ViewBag.EntityStatusList = ControlHelpers.EntityStatusEnumListDropDown(); return(View(model)); }
private void ClearBorder(DependencyObject dependencyObject) { Border parentItem = ControlHelpers.FindParent <Border>(dependencyObject); if (parentItem != null) { parentItem.BorderThickness = new Thickness(0); parentItem.BorderBrush = null; } }
private void HighlightBorder(DependencyObject dependencyObject, Thickness thickness, Brush brush) { Border parentItem = ControlHelpers.FindParent <Border>(dependencyObject); if (parentItem != null) { parentItem.BorderThickness = thickness; parentItem.BorderBrush = brush; } }
public void MouseControlTurnControl() { var screenSize = new Vector3(1000, 1000); var screenCoordinatesDelta = new Vector3(100, 0); var mouseSensivity = 1f; var rotationAngle = ControlHelpers.RotationAngle(screenCoordinatesDelta, screenSize, mouseSensivity); Assert.AreEqual(new Vector3(36, 0, 0), rotationAngle); }
private void InitDgv() { ColumnServerCheckBox = new DataGridViewCheckBoxColumn(); ColumnServerName = new DataGridViewTextBoxColumn(); ColumnServerZoneNo = new DataGridViewTextBoxColumn(); ColumnServerInstanceNo = new DataGridViewTextBoxColumn(); ColumnServerPublicIp = new DataGridViewTextBoxColumn(); ColumnServerPrivateIp = new DataGridViewTextBoxColumn(); ColumnServerStatus = new DataGridViewTextBoxColumn(); ColumnServerOperation = new DataGridViewTextBoxColumn(); ColumnServerCheckBox.HeaderText = "CheckBox"; ColumnServerName.HeaderText = "Name"; ColumnServerZoneNo.HeaderText = "ZoneNo"; ColumnServerInstanceNo.HeaderText = "InstanceNo"; ColumnServerPublicIp.HeaderText = "PublicIp"; ColumnServerPrivateIp.HeaderText = "PrivateIp"; ColumnServerStatus.HeaderText = "Status"; ColumnServerOperation.HeaderText = "Operation"; ColumnServerCheckBox.Name = "CheckBox"; ColumnServerName.Name = "Name"; ColumnServerZoneNo.Name = "ZoneNo"; ColumnServerInstanceNo.Name = "InstanceNo"; ColumnServerPublicIp.Name = "PublicIp"; ColumnServerPrivateIp.Name = "PrivateIp"; ColumnServerStatus.Name = "Status"; ColumnServerOperation.Name = "Operation"; dgvServerList.Columns.AddRange(new DataGridViewColumn[] { ColumnServerCheckBox, ColumnServerName, ColumnServerZoneNo, ColumnServerInstanceNo, ColumnServerPublicIp, ColumnServerPrivateIp, ColumnServerStatus, ColumnServerOperation }); dgvServerList.AllowUserToAddRows = false; dgvServerList.RowHeadersVisible = false; dgvServerList.BackgroundColor = Color.White; dgvServerList.AutoResizeColumns(); dgvServerList.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; dgvServerList.Columns["Operation"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dgvServerList.AllowUserToResizeRows = false; ControlHelpers.dgvDesign(dgvServerList); dgvServerList.CellContentClick += new DataGridViewCellEventHandler(ControlHelpers.dgvSingleCheckBox); dgvServerList.CellContentClick += new DataGridViewCellEventHandler(ControlHelpers.dgvLineColorChange); }
/// <summary> /// DataBind all TextBoxes /// </summary> private void BindControls() { ControlHelpers.ClearTextBoxBindings(this); DescriptionTextBox.DataBindings.Add("Text", _repositoriesBindingSource, "Description"); FullNameTextBox.DataBindings.Add("Text", _repositoriesBindingSource, "full_name"); HtmlUrlTextBox.DataBindings.Add("Text", _repositoriesBindingSource, "html_url"); LanguageTextBox.DataBindings.Add("Text", _repositoriesBindingSource, "language"); LastUpdatedTextBox.DataBindings.Add("Text", _repositoriesBindingSource, "LastUpdated"); StarGazersCountTextBox.DataBindings.Add("Text", _repositoriesBindingSource, "StarGazersCount"); }
// GET: AppUsers/Create public ActionResult Create() { Branch userBranch = BranchHelpers.GetCurrentBranchForUser(AppUserHelpers.GetGuidFromUserGetAppUserId(User.Identity.GetAppUserId())); //DropDowns ViewBag.BranchList = ControlHelpers.AllBranchesForCompanyListDropDown(userBranch.CompanyId, userBranch.BranchId); ViewBag.UserRoleList = ControlHelpers.UserRoleEnumListDropDown(); ViewBag.EntityStatusList = ControlHelpers.EntityStatusEnumListDropDown(); return(View()); }
private void PopulateMediaServerControls() { Settings settings = Settings.Get(); tbMediaUsername.Text = settings.MediaServer.Username; tbMediaPassword.Text = settings.MediaServer.Password; tbMediaDomain.Text = settings.MediaServer.Domain; lblMediaSource.Text = settings.MediaFileTransfer.SourceDirectory; lblMediaDestination.Text = settings.MediaFileTransfer.TargetDirectory; lblExcludeFolder.Text = settings.ExcludedFolderFromMediaTransfer; bool isOffline = true; try { isOffline = Utilities.MediaServer.IsShareOffline(settings.MediaServer); } catch (Exception ex) { //timerMediaServerOffline.Enabled = false; //settings.MediaServer.ShareName = ""; //Settings.Save(settings); ControlHelpers.ShowMessageBox(ex.Message, ControlHelpers.MessageBoxType.Error); } lblMediaNetworkShare.Text = settings.MediaServer.ShareName; if (!string.IsNullOrEmpty(settings.MediaServer.ShareName)) { //timerMediaServerOffline.Enabled = true; } if (isOffline) { btnMediaFolderOffline.Text = "Bring Media Share Online"; toolTip.SetToolTip(picParentalControls, "Media Share is Offline (Parental Controls are On)"); picParentalControls.Image = P2PVpn.Properties.Resources.Stop_red1; btnMediaFolderOffline.Image = P2PVpn.Properties.Resources.Start2; statusStrip.SetStatusBarLabel(lblStatusMediaShare, "Media Share is Offline", P2PVpn.Properties.Resources.Stop_red1); } else { btnMediaFolderOffline.Text = "Bring Media Share Offline"; toolTip.SetToolTip(picParentalControls, "Media Share is Online (Parental Controls are Off)"); picParentalControls.Image = P2PVpn.Properties.Resources.Start1; btnMediaFolderOffline.Image = P2PVpn.Properties.Resources.Stop_red2; statusStrip.SetStatusBarLabel(lblStatusMediaShare, "Media Share is Online", P2PVpn.Properties.Resources.Start2); } lblMediaCopyProgress.Text = ""; cbMediaParentalTime.SelectedIndexChanged -= cbMediaParentalTime_SelectedIndexChanged; cbMediaParentalTime.Text = Utilities.MediaServer.GetSelectedOfflineValue(settings.MediaServer); cbMediaParentalTime.SelectedIndexChanged += cbMediaParentalTime_SelectedIndexChanged; //timerMediaServerOffline_Tick(null, null); //WatchFileSystem(); }
private void fetView_FileExplorerView_ParentMouseDoubleClick(object sender, FileExplorerViewItem parent) { if (fetTree.SelectedTreeViewItem != null) { TreeViewItem treeViewParent = ControlHelpers.FindParent <TreeViewItem>(fetTree.SelectedTreeViewItem); if (treeViewParent != null) { treeViewParent.IsSelected = true; } } }
private async void buttonStorageDelete_Click(object sender, EventArgs e) { try { int checkBoxCount = 0; foreach (DataGridViewRow item in dgvStorageList.Rows) { if (bool.Parse(item.Cells["CheckBox"].Value.ToString())) { checkBoxCount++; } } if (checkBoxCount != 1) { throw new Exception("select one Storage"); } DialogResult result = MessageBox.Show("Do you really want to run?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result != DialogResult.Yes) { return; } ControlHelpers.ButtonStatusChange(buttonBlockStorageDelete, "Requested"); foreach (DataGridViewRow item in dgvStorageList.Rows) { if (bool.Parse(item.Cells["CheckBox"].Value.ToString())) { string obj = item.Cells["InstanceNo"].Value.ToString(); if (obj == null && obj.Length == 0) { throw new Exception("serverInstanceNo is null"); } else { await DeleteBlockStorageInstances(item.Cells["InstanceNo"].Value.ToString()); } } } var taskDelay = Task.Delay(1000); await taskDelay; await GetBlockStorageInfoLoad(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { ControlHelpers.ButtonStatusChange(buttonBlockStorageDelete, "Delete"); } }
/// <summary> /// Fetch repository in repository TextBox /// </summary> /// <returns></returns> private async Task FetchSelectedRepository() { if (string.IsNullOrWhiteSpace(RepositoryTextBox.Text)) { MessageBox.Show(@"Requires a repository"); return; } WorkingPictureBox.Image = spinner; if (RepositoryListBox.DataSource != null) { _lastSelectedRepositoryName = RepositoryListBox.Text; } RepositoryListBox.DataSource = null; try { _repositoriesBindingList = new BindingList <Repository>(await GitOperations.DownLoadPublicRepositoriesAsync(RepositoryTextBox.Text)); } catch (Exception ex) { WorkingPictureBox.Image = null; // a consideration is rate limit MessageBox.Show($@"Failed to get repositories {ex.Message}"); return; } _repositoriesBindingSource.DataSource = _repositoriesBindingList; RepositoryListBox.DataSource = _repositoriesBindingSource; if (_repositoriesBindingSource.Count > 0) { RepositoryListBox.SelectedIndex = 0; } BindControls(); ControlHelpers.SetWaterMarkers(this); if (!string.IsNullOrWhiteSpace(_lastSelectedRepositoryName)) { var index = RepositoryListBox.FindString(_lastSelectedRepositoryName); if (index >= 0) { RepositoryListBox.SelectedIndex = index; } } ActiveControl = RepositoryListBox; WorkingPictureBox.Image = null; }
public ActionResult Create([Bind(Include = "ItemDescription,ItemType,QuantityRequired,QuantityFulfilled,QuantityOutstanding,UoM,RequiredFrom,RequiredTo,AcceptDamagedItems,AcceptOutOfDateItems,CollectionAvailable,ListingStatus,SelectedCampaignId,CallingAction,CallingController")] RequirementListingAddView requirementListing) { if (ModelState.IsValid) { RequirementListingHelpers.CreateRequirementListingFromRequirementListingAddView(db, requirementListing, User); return(RedirectToAction(requirementListing.CallingAction, requirementListing.CallingController)); } ViewBag.CampaignList = ControlHelpers.AllActiveCampaignsForUserListDropDown(AppUserHelpers.GetAppUserIdFromUser(User), null); return(View(requirementListing)); }
protected virtual void InitializeValidation(HtmlGenericControl formGroup, HtmlGenericControl labelElement, HtmlGenericControl controlElement, IFormEditorProvider editorProvider, PropertyDisplayMetadata property, DynamicDataContext dynamicDataContext) { if (dynamicDataContext.ValidationMetadataProvider.GetAttributesForProperty(property.PropertyInfo).OfType <RequiredAttribute>().Any()) { labelElement.Attributes["class"] = ControlHelpers.ConcatCssClasses(labelElement.Attributes["class"] as string, "dynamicdata-required"); } if (editorProvider.CanValidate) { controlElement.SetValue(Validator.ValueProperty, editorProvider.GetValidationValueBinding(property, dynamicDataContext)); } }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var labels = (from column in _propertyColumn let txt = ControlHelpers.GetPropValue(_results[indexPath.Row], column.Key)?.ToString() ?? string.Empty select new Tuple <string, int>(txt, column.Value.WidthInPercent)) .ToList(); var cell = tableView.DequeueReusableCell(MultiColumnCell.Id) as MultiColumnCell ?? new MultiColumnCell(tableView.Bounds, labels.ToArray()); return(cell); }
private void TreViewItem_Drop(object sender, DragEventArgs e) { ClearBorder(e.Source as DependencyObject); if (e.Data.GetDataPresent(DataFormats.FileDrop)) { TreeViewItem tItem = ControlHelpers.FindParent <TreeViewItem>(e.Source as DependencyObject); if (tItem != null) { DroppedTreeviewItem = tItem; DroppedFiles = (string[])e.Data.GetData(DataFormats.FileDrop); SetContextMenuStatus(true); } } }
private async Task Execute() { try { ControlHelpers.ButtonStatusChange(buttonExecute, "Requested"); string cmdText = string.Empty; if (fastColoredTextBoxTemplate.SelectedText.Length > 0) { cmdText = fastColoredTextBoxTemplate.SelectedText; } else { cmdText = fastColoredTextBoxTemplate.Text; } List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); var dict = JsonConvert.DeserializeObject <Dictionary <string, string> >(cmdText); foreach (var a in dict) { parameters.Add(new KeyValuePair <string, string>(a.Key.ToString(), a.Value.ToString())); } SoaCall soaCall = new SoaCall(); Task <string> task = null; if (textBoxEndPoint.Text.Contains("kms") || comboBoxScriptTemplates.Text.Contains("mssql")) // if (textBoxEndPoint.Text.Contains("kms") ) { task = soaCall.WebApiCall(textBoxEndPoint.Text, RequestType.POST, comboBoxScriptTemplates.Text, cmdText, textBoxAccessKey.Text, textBoxSecretKey.Text); } else { task = soaCall.WebApiCall(textBoxEndPoint.Text, RequestType.POST, comboBoxScriptTemplates.Text, parameters, textBoxAccessKey.Text, textBoxSecretKey.Text); } string response = await task; JToken jt = JToken.Parse(response); fastColoredTextBoxResult.Text = jt.ToString(Newtonsoft.Json.Formatting.Indented); } catch (Exception) { throw; } finally { ControlHelpers.ButtonStatusChange(buttonExecute, "Execute"); } }
void CreateMaterialImage(List <PictureBoxHotspot.ImageElement> pc, Point matpos, Size matsize, string text, string mattag, string mattip, Color matcolour, Color textcolour) { System.Drawing.Imaging.ColorMap colormap = new System.Drawing.Imaging.ColorMap(); colormap.OldColor = Color.White; // this is the marker colour to replace colormap.NewColor = matcolour; Bitmap mat = ControlHelpers.ReplaceColourInBitmap(EDDiscovery.Properties.Resources.materialmarkerorangefilled, new System.Drawing.Imaging.ColorMap[] { colormap }); ControlHelpers.DrawTextCentreIntoBitmap(ref mat, text, stdfont, textcolour); PictureBoxHotspot.ImageElement ie = new PictureBoxHotspot.ImageElement( new Rectangle(matpos.X, matpos.Y, matsize.Width, matsize.Height), mat, mattag, mattip); pc.Add(ie); }
public override void LoadSettings(string settings) { var obj = new ExcelTemplateReportSettings(); if (!string.IsNullOrEmpty(settings)) { obj = (ExcelTemplateReportSettings)(Serialization.DeserializeObject(settings, typeof(ExcelTemplateReportSettings))); } txtDataSheetName.Text = obj.DataSheetName; chkContainsHeaderRow.Checked = obj.ContainsHeaderRow; ctlXlsFileName.Url = obj.XlsFileName; ctlXlsxFileName.Url = obj.XlsxFileName; txtOutputFileName.Text = obj.OutputFileName; ControlHelpers.InitDropDownByValue(ddDispositionType, obj.DispositionType); }
private void metroButton3_Click(object sender, EventArgs e) { Person person = context.People.FirstOrDefault(a => a.ID == selectedPerson.ID); if (person != null) { person.IsDeleted = true; context.Entry(person).State = System.Data.Entity.EntityState.Modified; if (context.SaveChanges() > 0) { MessageBox.Show("successfull Delete Customer", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); GetCustomers(); ControlHelpers.EmptyGroupBox(this.groupForm); } } }
protected virtual HtmlGenericControl InitializeFormGroup(DotvvmControl hostControl, PropertyDisplayMetadata property, DynamicDataContext dynamicDataContext, out HtmlGenericControl labelElement, out HtmlGenericControl controlElement) { var formGroup = new HtmlGenericControl("div"); formGroup.Attributes["class"] = ControlHelpers.ConcatCssClasses(FormGroupCssClass, property.Styles?.FormRowCssClass); hostControl.Children.Add(formGroup); labelElement = new HtmlGenericControl("label"); formGroup.Children.Add(labelElement); controlElement = new HtmlGenericControl("div"); controlElement.Attributes["class"] = ControlHelpers.ConcatCssClasses(property.Styles?.FormControlContainerCssClass); formGroup.Children.Add(controlElement); return(formGroup); }
public override void OnResize() { _dbParser.PositionTopRightInside(this); _btnNext.PositionBottomRightInside(this); _tbInput.PositionBelow(_dbParser); _tbInput.StretchLeftInside(this); _tbInput.StretchRightInside(this); _tbInput.StretchDownTo(_btnNext); _tbInput.Label.PositionAbove(_tbInput); var parserControls = Settings.Get.SelectedParser.Value.Controls.ToList(); ControlHelpers.AnchorLoop(parserControls, c => c.PositionRightOf(_tbInput.Label), (o, c) => c.PositionRightOf(o)); }
private async void buttonStorageReload_Click(object sender, EventArgs e) { try { ControlHelpers.ButtonStatusChange(buttonStorageReload, "Requested"); await GetBlockStorageInfoLoad(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { ControlHelpers.ButtonStatusChange(buttonStorageReload, "Reload"); } }