Esempio n. 1
0
 public ActionResult _TestIndex(TextBoxBinding viewModel, string garbage)
 {
     viewModel.ValueHolders.Add(new ValueHolder {
         ID = viewModel.ID, ValueProperty = viewModel.Name
     });
     return(PartialView("_TestIndex", viewModel));
 }
Esempio n. 2
0
 public StringSetting(string aName, string aCaption, string aDefaultValue)
 {
     Name            = aName;
     Caption         = aCaption;
     DefaultValue    = aDefaultValue;
     _controlBinding = new TextBoxBinding(this);
 }
Esempio n. 3
0
 private void textBoxBindingButton_Click(object sender, EventArgs e)
 {
     using (var textBoxBinding = new TextBoxBinding())
     {
         var result = textBoxBinding.ShowDialog();
     }
 }
        public void Complete()
        {
            TextBoxBinding.ForceSourceUpdate();

            var ctx = myProjectHost.Project.GetAssetsContext();

            ctx.SaveChanges();
        }
Esempio n. 5
0
        private void OnOk()
        {
            TextBoxBinding.ForceSourceUpdate();

            Notification.TrySetConfirmed(true);

            Notification.Content = Urls.ToList();

            FinishInteraction();
        }
        /// <summary>
        /// Builds a new binding.
        /// </summary>
        /// <typeparam name="TView">The type of the view the new binding binds to.</typeparam>
        /// <typeparam name="TControl">The type of the control the new binding binds to.</typeparam>
        /// <typeparam name="TViewModel">The type of the viewmodel the new binding binds to.</typeparam>
        /// <param name="view">The view to bind to.</param>
        /// <param name="control">The control to bind to.</param>
        /// <param name="viewProperty">The binding target property (the property on the control to bind to).</param>
        /// <param name="viewModel">The viewmodel to bind to.</param>
        /// <param name="viewModelProperty">The binding source property (the property on the viewmodel to bind to).</param>
        /// <returns>A new binding.</returns>
        internal static Binding <TView> Build <TView, TControl, TViewModel>(TView view,
                                                                            TControl control, Expression <Func <TControl, object> > viewProperty, TViewModel viewModel, Expression <Func <TViewModel, object> > viewModelProperty) where TViewModel : INotifyPropertyChanged
        {
            Binding <TView> result = null;

            // special cases are handled by type and property name
            if (typeof(TControl) == typeof(TextBox) && control.GetPropertyInfo(viewProperty).Name == "Text")
            {
                result = new TextBoxBinding <TView, TViewModel>(view, control as TextBox,
                                                                viewProperty as Expression <Func <TextBox, object> >, viewModel, viewModelProperty);
            }

            if (typeof(TControl) == typeof(CheckBox) && control.GetPropertyInfo(viewProperty).Name == "Checked")
            {
                result = new CheckBoxBinding <TView, TViewModel>(view, control as CheckBox,
                                                                 viewProperty as Expression <Func <CheckBox, object> >, viewModel, viewModelProperty);
            }

            if (typeof(TControl) == typeof(ComboBox) && control.GetPropertyInfo(viewProperty).Name == "SelectedIndex")
            {
                result = new ComboBoxBinding <TView, TViewModel>(view, control as ComboBox,
                                                                 viewProperty as Expression <Func <ComboBox, object> >, viewModel, viewModelProperty);
            }


            if (typeof(TControl) == typeof(DateTimePicker) && control.GetPropertyInfo(viewProperty).Name == "Value")
            {
                result = new DateTimePickerBinding <TView, TViewModel>(view, control as DateTimePicker,
                                                                       viewProperty as Expression <Func <DateTimePicker, object> >, viewModel, viewModelProperty);
            }


            if (typeof(TControl) == typeof(RadioButton) && control.GetPropertyInfo(viewProperty).Name == "Checked")
            {
                result = new RadioBinding <TView, TViewModel>(view, control as RadioButton,
                                                              viewProperty as Expression <Func <RadioButton, object> >, viewModel, viewModelProperty);
            }

            if (result != null)
            {
                result.HookEvents();
                return(result);
            }

            // generic one-way binding
            return(new SimpleBinding <TView, TControl, TViewModel>(view, control,
                                                                   viewProperty, viewModel, viewModelProperty));
        }
        public void Complete()
        {
            TextBoxBinding.ForceSourceUpdate();

            var ctx = myProjectHost.Project.GetAssetsContext();

            // validate currency consistancy
            foreach (FigureSeries series in myFigures.ToList())
            {
                // we need to remove those items which have no value because those might
                // have "wrong" default currency
                foreach (var figure in series.OfType <AbstractFigure>().Where(d => !d.Value.HasValue).ToList())
                {
                    series.Remove(figure);

                    if (figure.Id != 0)
                    {
                        // TODO: remove from stock/company relationship to remove it finally from DB
                        //Dynamics.Remove(
                    }
                }

                RecursiveValidator.Validate(series);

                series.EnableCurrencyCheck = true;
                series.VerifyCurrencyConsistency();
            }

            foreach (FigureSeries series in myFigures.ToList())
            {
                var figures = (IList)Dynamics.GetRelationship(Stock, series.FigureType);

                foreach (AbstractFigure figure in series)
                {
                    if (figure.Id == 0 && figure.Value.HasValue)
                    {
                        figures.Add(figure);
                    }
                }
            }

            ctx.SaveChanges();
        }
Esempio n. 8
0
 public ActionResult _TestIndex(TextBoxBinding viewModel)
 {
     return(PartialView("_TestIndex", viewModel));
 }
Esempio n. 9
0
        public ActionResult Index()
        {
            TextBoxBinding objTextboxBindings = new TextBoxBinding();

            return(View(objTextboxBindings)); // Returning model
        }
Esempio n. 10
0
        public void Complete()
        {
            TextBoxBinding.ForceSourceUpdate();

            myStorageService.Store(myStock, Document);
        }