public MainForm() { InitializeComponent(); _dm = new DownloadManager(); // Bind _db.Progress <-> this.Progress DataBindings.Add("Progress", _dm, "Progress", true, DataSourceUpdateMode.OnPropertyChanged); }
public MainForm() { InitializeComponent(); Text = "SharpMapTracker v" + Constants.MAP_TRACKER_VERSION; DataBindings.Add("TopMost", alwaysOnTopCheckBox, "Checked"); DataBindings.Add("TrackMoveableItems", trackMoveableItemsCheckBox, "Checked"); DataBindings.Add("TrackSplashes", trackSplashesCheckBox, "Checked"); DataBindings.Add("TrackMonsters", trackMonstersCheckBox, "Checked"); DataBindings.Add("TrackNPCs", trackNpcsCheckBox, "Checked"); DataBindings.Add("TrackOnlyCurrentFloor", trackOnlyCurrentFloorCheckBox, "Checked"); DataBindings.Add("RetrackTiles", retrackTilesToolStripMenuItem, "Checked"); DataBindings.Add("NPCAutoTalk", npcAutoTalkCheckBox, "Checked"); DataBindings.Add("ShareTrackedMap", shareTrackedMapCheckBox, "Checked"); Trace.Listeners.Add(new TextBoxTraceListener(traceTextBox)); Trace.Listeners.Add(new TextWriterTraceListener("log.txt")); Trace.AutoFlush = true; KeyDown += new KeyEventHandler(MainForm_KeyDown); Load += MainForm_Load; FormClosed += new FormClosedEventHandler(MainForm_FormClosed); miniMap.MiniMapClick += new EventHandler <MiniMapClickEventArgs>(miniMap_MiniMapClick); }
public Form2(MyModelClass model) { InitializeComponent(); this.model = model; bindingSource1.DataSource = model; DataBindings.Add("BackColor", bindingSource1, "AnotherColor"); }
protected virtual void BindControllerToIcon() { Binding binding = new Binding("Icon", Controller, "AppointmentType"); binding.Format += AppointmentTypeToIconConverter; DataBindings.Add(binding); }
public ProfilePage() { InitializeComponent(); DJObserverable.OnPartyStart += CommenceParty; DJObserverable.OnPartyEnd += OnPartyEnd; DataBindings.Add("CurrentUser", topPanel, "CurrentUser", true, DataSourceUpdateMode.OnPropertyChanged); }
public Contacts() { InitializeComponent(); _vm.ContactBindingSource = contactBindingSource; _vm.EmailBindingSource = emailsBindingSource; _vm.PhoneBindingSource = phonesBindingSource; _vm.Initialize(); Load += delegate { _vm.Load(); }; NewBtn.Click += delegate { _vm.New(); }; DeleteBtn.Click += delegate { _vm.Delete(); }; SaveBtn.Click += delegate { _vm.Save(); }; FirstBtn.Click += delegate { _vm.First(); }; LastBtn.Click += delegate { _vm.Last(); }; NextBtn.Click += delegate { _vm.Next(); }; PreviousBtn.Click += delegate { _vm.Previous(); }; NewEmailBtn.Click += delegate { _vm.NewEmail(); }; DeleteEmailBtn.Click += delegate { _vm.DeleteEmail(); }; NewPhoneBtn.Click += delegate { _vm.NewPhone(); }; DeletePhoneBtn.Click += delegate { _vm.DeletePhone(); }; DataBindings.Add("Text", _vm, "Title"); }
/// <summary> /// 创建 <see cref="QueryPageContainer" /> 的新实例(QueryPageContainer) /// </summary> public QueryPageContainer(Session session, Entity.QueryParam queryParam, SuperTabControl control) { Session = session; QueryParam = queryParam; if (!Program.IsRunning) { return; } QueryPage = new QueryPage(Session, queryParam) { Dock = DockStyle.Fill, BackColor = SystemColors.Window }; _panel = new SuperTabControlPanel(); _panel.Controls.Add(QueryPage); AttachedControl = _panel; _panel.TabItem = this; _tabControl = control; var idx = control.Tabs.OfType <QueryPageContainer>().LastOrDefault(); _tabControl.CreateTab(this, _panel, idx == null ? 0 : control.Tabs.IndexOf(idx) + 1); Text = queryParam.Name; Image = Properties.Resources.calendar_16; DataBindings.Add("Text", queryParam, "Name", false, DataSourceUpdateMode.OnPropertyChanged); BindQueryState(); EnableImageAnimation = false; this.DoubleClick += QueryPageContainer_DoubleClick; }
private void MainFormLoad(object sender, EventArgs e) { FormClosing += MainFormFormClosing; //Associate settings property event handlers. _frmSettings.SettingChanging += FrmSettingsSettingChanging; _frmSettings.SettingsSaving += FrmSettingsSettingsSaving; //Data bind settings properties with straightforward associations. var bndBackColor = new Binding("BackColor", _frmSettings, "FormBackColor", true, DataSourceUpdateMode.OnPropertyChanged); DataBindings.Add(bndBackColor); var bndLocation = new Binding("Location", _frmSettings, "FormLocation", true, DataSourceUpdateMode.OnPropertyChanged); DataBindings.Add(bndLocation); // Assign Size property, since databinding to Size doesn't work well. Size = _frmSettings.FormSize; //For more complex associations, manually assign associations. var savedText = _frmSettings.FormText; //Since there is no default value for FormText. if (savedText != null) { Text = savedText; } }
public ValueBox(String name) { Name = name; Anchor = AnchorStyles.Bottom | AnchorStyles.Right; Font = new Font("Microsoft Sans Serif", 20f, FontStyle.Bold, GraphicsUnit.Pixel, 204); ForeColor = Color.FromArgb(255, 255, 255); Margin = new Padding(0); ShortcutsEnabled = false; AllowDrop = false; RightToLeft = RightToLeft.No; TextAlign = HorizontalAlignment.Center; BorderStyle = BorderStyle.None; Visible = true; Label.Click += (sender, e) => { Focus(); SelectionStart = Text.Length; }; Label.Font = Font; Label.Margin = Margin; Label.Parent = this; Label.AutoSize = false; Label.RightToLeft = RightToLeft.Yes; Label.TextAlign = ContentAlignment.MiddleCenter; Label.ForeColor = ForeColor; Label.Visible = true; DataBindings.Add(new Binding("EndString", this, "EndString")); PropertyChanged += OnEndStringChanged; Label.BringToFront(); Controls.Add(Label); }
public AimAnnotationComponentControl(AimAnnotationComponent component) : base(component) { _component = component; InitializeComponent(); _bindingSource = new BindingSource(); _bindingSource.DataSource = _component; SuspendLayout(); var yOffset = 0; foreach (Control ctrl in Controls) { yOffset = Math.Max(yOffset, ctrl.Bottom); } yOffset = Math.Max(5, yOffset); var szTemplate = Size - new Size(Margin.Horizontal, Margin.Vertical + yOffset); _templateCtrlAimTemplate = new Template.TemplateControl(_component); _templateCtrlAimTemplate.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; _templateCtrlAimTemplate.Location = new Point(3, yOffset); _templateCtrlAimTemplate.Name = "_templateCtrlAimTemplate"; _templateCtrlAimTemplate.Size = szTemplate; _templateCtrlAimTemplate.TabIndex = 2; Controls.Add(_templateCtrlAimTemplate); ResumeLayout(false); PerformLayout(); InitializeAnnotationTypeCombo(); _templateCtrlAimTemplate.DataBindings.Add("Visible", _bindingSource, "AimTemplateVisible", true, DataSourceUpdateMode.OnPropertyChanged); DataBindings.Add("Enabled", _bindingSource, "AnnotationModuleEnabled", true, DataSourceUpdateMode.OnPropertyChanged); }
/// <summary> /// When using Data Binding operations via the DataSource property of the ComboBox. This /// adds the required Bindings for the CheckBoxes. /// </summary> public void AddBindings() { // Note, the text uses "DisplayMemberSingleItem", not "DisplayMember" (unless its not assigned) DataBindings.Add( "Text", _ComboBoxItem, _CheckBoxComboBox.DisplayMemberSingleItem ); // The ValueMember must be a bool type property usable by the CheckBox.Checked. DataBindings.Add( "Checked", _ComboBoxItem, _CheckBoxComboBox.ValueMember, false, // This helps to maintain proper selection state in the Binded object, // even when the controls are added and removed. DataSourceUpdateMode.OnPropertyChanged, false, null, null); // Helps to maintain the Checked status of this // checkbox before the control is visible if (_ComboBoxItem is INotifyPropertyChanged) { ((INotifyPropertyChanged)_ComboBoxItem).PropertyChanged += new PropertyChangedEventHandler( CheckBoxComboBoxItem_PropertyChanged); } }
public MyForm() { MyBusinessObject obj = new MyBusinessObject(); Button btn = new Button(); btn.Click += delegate { Foo++; }; DataBindings.Add("Foo", obj, "Bar", false, DataSourceUpdateMode.OnPropertyChanged); Controls.Add(btn); }
public void ImplementMember(Type type) { IEntityForm form = GetParentForm(this) as IEntityForm; if (form != null) { DataBindings.Add(new Binding("Text", form.EntitySource, MemberName, true, DataSourceUpdateMode.OnPropertyChanged)); } }
/// <summary> /// Binds a property from the given object to the checkbox /// </summary> /// <param name="Object"></param> /// <param name="PropertyName"></param> /// <param name="ResetBindings"></param> public void Bind(object Object, string PropertyName, bool ResetBindings = true) { if (ResetBindings) { DataBindings.Clear(); } DataBindings.Add("Checked", Object, PropertyName); }
public Form2(MyModelClass model) { InitializeComponent(); this.model = model; bindingSource1.DataSource = model; DataBindings.Add("BackColor", bindingSource1, "AnotherColor"); model.PropertyChanged += new PropertyChangedEventHandler(model_PropertyChanged); }
public LatestView() { InitializeComponent(); var viewModel = new LatestViewModel(); DataBindings.Add("Text", viewModel, nameof(viewModel.MeasureDate)); MeasureValueLabel.DataBindings.Add("Text", viewModel, nameof(viewModel.MeasureValue)); }
//生成64位程序会导致无法用设计器编辑 public MainWindow() { //由于蜜汁原因,在x64下频繁绘制足够大的GIF时,其它控件不会根据databinding自动刷新,所以需要让BindHandle手动调用MainWindow.Update() //不确定是否会产生额外的刷新 BindHandleProviderExtension.main_window = this; InitializeComponent(); //初始化 var config = LoadConfig(); InitButton.Visible = config.ShowInitButton; pixiv_client = new Client(config); MainExplorer.SetClient(pixiv_client); TagBox.SetClient(pixiv_client); AuthorBox.SetClient(pixiv_client); queueComboBox.SetClient(pixiv_client); //UI //parent为主窗口的话,透明时会透出主窗口的背景,而主窗口背景不能设为透明,所以需要更改parent SystemTrayIcon.Icon = Properties.Resources.baseIcon; PageLabel.Parent = this.MainExplorer; PageLabel.Location = new System.Drawing.Point(PageLabel.Location.X - MainExplorer.Location.X, PageLabel.Location.Y - MainExplorer.Location.Y); NextButton.Parent = this.MainExplorer; NextButton.Location = new System.Drawing.Point(NextButton.Location.X - MainExplorer.Location.X, NextButton.Location.Y - MainExplorer.Location.Y); PrevButton.Parent = this.MainExplorer; PrevButton.Location = new System.Drawing.Point(PrevButton.Location.X - MainExplorer.Location.X, PrevButton.Location.Y - MainExplorer.Location.Y); SwitchBookmarkButton.Parent = this.MainExplorer; SwitchBookmarkButton.Location = new System.Drawing.Point(SwitchBookmarkButton.Location.X - MainExplorer.Location.X, SwitchBookmarkButton.Location.Y - MainExplorer.Location.Y); BookmarkPageLabel.Parent = SwitchBookmarkButton; BookmarkPageLabel.Location = new System.Drawing.Point(0, 0); //设置事件 FormClosing += OnClose;//关闭按钮不关闭,而是最小化 KeyUp += new KeyEventHandler(MainExplorer.OnKeyUp); NextButton.Click += new EventHandler(MainExplorer.SlideRight); PrevButton.Click += new EventHandler(MainExplorer.SlideLeft); idLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(MainExplorer.OpenInBrowser); OpenLocalLabel.LinkClicked += new LinkLabelLinkClickedEventHandler(MainExplorer.OpenInLocal); SwitchBookmarkButton.MouseClick += new MouseEventHandler(MainExplorer.SwitchBookmarkStatus); queueComboBox.QueueChanged += new EventHandler <QueueChangeEventArgs>(OnQueueComboBoxChanged); AuthorBox.AuthorModified += (object sender, EventArgs e) => queueComboBox.UpdateContent(); PlayButton.Click += (object sender, EventArgs e) => MainExplorer.Play(); RandomSlideCheckBox.Click += (object sender, EventArgs e) => MainExplorer.random_slide = RandomSlideCheckBox.Checked; InitButton.Click += (object sender, EventArgs e) => pixiv_client.InitTask().Wait(); SystemTrayIcon.DoubleClick += (object sender, EventArgs e) => this.Visible = !this.Visible; ExitAction.Click += (object sender, EventArgs e) => { FormClosing -= OnClose; this.Close(); };//退出时先移除阻止关闭的handle //绑定属性 PageLabel.DataBindings.Add(new Binding("Text", MainExplorer.GetBindHandle <string>("IndexText"), "Content")); DescBrowser.DataBindings.Add(new Binding("DocumentText", MainExplorer.GetBindHandle <string>("DescText"), "Content")); PlayButton.DataBindings.Add(new Binding("Text", MainExplorer.GetBindHandle <string>("TotalPageText"), "Content")); idLabel.DataBindings.Add(new Binding("Text", MainExplorer.GetBindHandle <string>("IdText"), "Content")); SwitchBookmarkButton.DataBindings.Add(new Binding("Image", MainExplorer.GetBindHandle <System.Drawing.Bitmap>("FavIcon"), "Content")); BookmarkPageLabel.DataBindings.Add(new Binding("Visible", MainExplorer.GetBindHandle <bool>("PageInvalid"), "Content")); TagBox.DataBindings.Add(new Binding("Tags", MainExplorer.GetBindHandle <List <string> >("Tags"), "Content")); AuthorBox.DataBindings.Add(new Binding("UserId", MainExplorer.GetBindHandle <int>("UserId"), "Content")); DataBindings.Add(new Binding("Text", pixiv_client.GetBindHandle <string>("VerifyState"), "Content")); //onListCheckBoxClick(null,null); }
private void InitializeDataBinding() { gridControlQueue.DataSource = _viewModel.InterfaceResults; gridControlLogsDisplay.DataSource = _viewModel.Logs; DataBindings.Add(new Binding("Text", _viewModel.Configuration, nameof(_viewModel.Configuration.MainFormTitle))); lookUpEditSelectTestKit.Properties.DataSource = _viewModel.KitNames; //lookUpEditSelectTestKit.Properties.DisplayMember = "Kit"; //lookUpEditSelectTestKit.Properties.ValueMember = "Id"; }
public Form1() { InitializeComponent(); bind = new DuomenuBind(); Form2 form = new Form2(bind); form.Show(); DuomenuEilute.DataBindings.Add("Text", bind, "Tekstas", false, DataSourceUpdateMode.OnPropertyChanged); DataBindings.Add("Text", bind, "Tekstas"); }
private void MainFormLoad(object sender, System.EventArgs e) { textBox1.DataBindings.Add(nameof(TextBox.Text), _victim, nameof(VictimClass.VictimProperty), false, DataSourceUpdateMode.OnPropertyChanged); Binding binding = new Binding(nameof(FormProperty), _victim, nameof(VictimClass.FormProperty), true, DataSourceUpdateMode.OnPropertyChanged); binding.BindingComplete += BindingBindingComplete; binding.Format += BindingFormat; binding.Parse += BindingParse; DataBindings.Add(binding); }
public DiceUserControl() { InitializeComponent(); BackgroundImageLayout = ImageLayout.Stretch; Binding bind = new Binding("BackgroundImage", bsDice, "LastThrowDiceValue"); bind.Format += (s, e) => { e.Value = dices[((e.Value as RainyDiceValue) != null ? (e.Value as RainyDiceValue).SequenceNumber : 6)]; }; DataBindings.Add(bind); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Controller == null) { return; } DataBindings.Add("Text", Controller, "Caption"); SubscribeControlsEvents(); LoadFormData(Controller.EditedAppointmentCopy); }
public void AssignCommand(ICommand command) { if (command == null) { return; } this.command = command; DataBindings.Add("Enabled", this.command, "CanExecute"); Click += (sender, e) => this.command.Execute(); }
private void Form1_Load(object sender, System.EventArgs e) { showGuiButton.DataBindings.Add("Enabled", model.IsGuiButtonEnabled); progressBar1.DataBindings.Add("Visible", model.IsProgressBarVisible); serviceEnabledCheckbox.DataBindings.Add("Enabled", model.IsServiceCheckboxEnabled); serviceEnabledCheckbox.DataBindings.Add("Checked", model.IsServiceCheckboxChecked); DataBindings.Add("UseWaitCursor", model.IsProgressBarVisible); model.IsProgressBarVisible.PropertyChanged += UpdateTaskbarProgress; progressBar1.Minimum = 0; progressBar1.Maximum = FormViewModel.ExpectedStartupDurationMilliseconds; }
public Form1() { InitializeComponent(); myClass = new MyClass(); Binding binding = new Binding("MyText", myClass, "Dic"); binding.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged; binding.Parse += new ConvertEventHandler(binding_Parse); binding.Format += new ConvertEventHandler(binding_Format); DataBindings.Add(binding); myClass.AddStuff("uno", "UNO"); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Controller == null) { return; } DataBindings.Add("Text", Controller, "Caption"); SubscribeControlsEvents(); LoadFormData(Controller.EditedAppointmentCopy); RecalculateLayoutOfControlsAffectedByProgressPanel(); }
protected virtual void BindControllerToControls() { DataBindings.Add("Text", Controller, "Caption"); BindControllerToIcon(); BindProperties(this.tbSubject, "Text", "Subject"); BindProperties(this.tbLocation, "Text", "Location"); BindProperties(this.tbDescription, "Text", "Description"); BindProperties(this.edtStartDate, "EditValue", "DisplayStartDate"); BindProperties(this.edtStartDate, "Enabled", "IsDateTimeEditable"); BindProperties(this.edtStartTime, "EditValue", "DisplayStartTime"); BindProperties(this.edtStartTime, "Enabled", "IsTimeEnabled"); BindProperties(this.edtEndDate, "EditValue", "DisplayEndDate", DataSourceUpdateMode.Never); BindProperties(this.edtEndDate, "Enabled", "IsDateTimeEditable", DataSourceUpdateMode.Never); BindProperties(this.edtEndTime, "EditValue", "DisplayEndTime", DataSourceUpdateMode.Never); BindProperties(this.edtEndTime, "Enabled", "IsTimeEnabled", DataSourceUpdateMode.Never); BindProperties(this.chkAllDay, "Checked", "AllDay"); BindProperties(this.chkAllDay, "Enabled", "IsDateTimeEditable"); BindProperties(this.lblResource, "Enabled", "CanEditResource"); BindProperties(this.edtResources, "ResourceIds", "ResourceIds"); BindProperties(this.edtResources, "Visible", "ResourceSharing"); BindProperties(this.edtResources, "Enabled", "CanEditResource"); BindProperties(this.edtResource, "ResourceId", "ResourceId"); BindProperties(this.edtResource, "Enabled", "CanEditResource"); BindToBoolPropertyAndInvert(this.edtResource, "Visible", "ResourceSharing"); BindProperties(this.barLabel, "EditValue", "Label"); BindProperties(this.barStatus, "EditValue", "Status"); BindBoolToVisibility(this.barReminder, "Visibility", "ReminderVisible"); BindProperties(this.barReminder, "Editvalue", "ReminderTimeBeforeStart"); BindProperties(this.tbProgress, "Value", "PercentComplete"); BindProperties(this.lblPercentCompleteValue, "Text", "PercentComplete", ObjectToStringConverter); BindProperties(this.progressPanel, "Visible", "ShouldEditTaskProgress"); BindProperties(this.btnDelete, "Enabled", "CanDeleteAppointment"); BindBoolToVisibility(this.btnRecurrence, "Visibility", "ShouldShowRecurrenceButton"); BindProperties(this.btnRecurrence, "Down", "IsRecurrentAppointment"); BindToBoolPropertyAndInvert(this.ribbonControl1, "Enabled", "ReadOnly"); BindProperties(this.edtTimeZone, "Visible", "TimeZoneVisible"); BindProperties(this.edtTimeZone, "EditValue", "TimeZoneId"); BindProperties(this.edtTimeZone, "Enabled", "TimeZoneEnabled"); BindBoolToVisibility(this.btnTimeZones, "Visibility", "TimeZonesEnabled"); BindProperties(this.btnTimeZones, "Down", "TimeZoneVisible"); }
public virtual void Initialize(EntryEditorVM vm) { VM = vm ?? throw new ArgumentNullException(nameof(vm)); VM.ActivatingAction = () => this.InvokeIfRequired(() => base.Activate()); VM.ClosingAction = () => this.InvokeIfRequired(() => base.Close()); DataBindings.Add(nameof(Text), VM, nameof(VM.Title), false, DataSourceUpdateMode.OnPropertyChanged); VM.PropertyChanged += VM_PropertyChanged; EntryEditor.Initialize(VM); }
private void CreateController() { controller = new MainFormController(configuration, this); DataBindings.Add("Icon", controller.ProjectStateIconAdaptor, "Icon"); controller.PopulateImageList(iconList); controller.PopulateImageList(largeIconList); controller.BindToTrayIcon(trayIcon); controller.BindToListView(lvProjects); controller.IsProjectSelectedChanged += new EventHandler(Controller_IsProjectSelectedChanged); btnForceBuild.DataBindings.Add("Enabled", controller, "IsProjectSelected"); }
public MainForm(MainViewModel viewModel) { InitializeComponent(); ViewModel = viewModel; DataBindings.Add("Text", ViewModel, "Caption"); textBoxWorkTimeToday.DataBindings.Add("Text", ViewModel, "WorkingTimeToday"); textBoxPausingTimeToday.DataBindings.Add("Text", ViewModel, "PauseTimeToday"); textBoxWorkTimeWeek.DataBindings.Add("Text", ViewModel, "WorkingTimeThisWeek"); textBoxWorkTimeMonth.DataBindings.Add("Text", ViewModel, "WorkingTimeThisMonth"); radioButtonWorking.DataBindings.Add("Checked", ViewModel, "IsWorking", false, DataSourceUpdateMode.OnPropertyChanged); radioButtonPausing.DataBindings.Add("Checked", ViewModel, "IsPausing", false, DataSourceUpdateMode.OnPropertyChanged); }