Beispiel #1
0
 /// <summary>
 /// Add onUnchecked listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyCheckBox</returns>
 public IMyCheckBox addOnUnchecked(IMyController _controller, string _methodName)
 {
     myCheckBox_chk.Unchecked += delegate(object sender, System.Windows.RoutedEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
 /// <summary>
 /// Add onChecked listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyRadioButton</returns>
 public IMyRadioButton addOnChecked(IMyController _controller, string _methodName)
 {
     myRadioButton_rdo.Checked += delegate(object sender, System.Windows.RoutedEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #3
0
 /// <summary>
 /// Add onDropDownClosed listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyComboBox</returns>
 public IMyComboBox addOnDropDownClosed(IMyController _controller, string _methodName)
 {
     myComboBox_cbo.DropDownClosed += delegate(object sender, EventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #4
0
 /// <summary>
 /// Add onMouseHover listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyButton</returns>
 public IMyButton addOnMouseHover(IMyController _controller, string _methodName)
 {
     myButton_btn.MouseEnter += delegate(object sender, MouseEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #5
0
 //private void validationHandler(object sender, TextCompositionEventArgs e) {
 //    e.Handled = myRegex.IsMatch(e.Text);
 //}
 /// <summary>
 /// Add onTextChanged listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyTextBox</returns>
 public IMyTextBox addOnTextChanged(IMyController _controller, string _methodName)
 {
     myTextBox_txt.TextChanged += delegate(object sender, TextChangedEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #6
0
 /// <summary>
 /// Add onSelectionChanged listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyListView</returns>
 public IMyListView addOnSelectionChanged(IMyController _controller, string _methodName)
 {
     myListView_lv.SelectionChanged += delegate(object sender, SelectionChangedEventArgs e) {
         _controller.callMethod(_methodName, myListView_lv.SelectedItem);
     };
     return(this);
 }
Beispiel #7
0
 /// <summary>
 /// Add onGotFocus listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyProgressBar</returns>
 public IMyProgressBar addOnGotFocus(IMyController _controller, string _methodName)
 {
     myProgressBar_pb.GotFocus += delegate(object sender, RoutedEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
 /// <summary>
 /// Add onPreviewMouseDown listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyTextBlock</returns>
 public IMyTextBlock addOnPreviewMouseDown(IMyController _controller, string _methodName)
 {
     myTextBlock_tb.PreviewMouseDown += delegate(object sender, MouseButtonEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #9
0
 /// <summary>
 /// Add onValueChanged listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyProgressBar</returns>
 public IMyProgressBar addOnValueChanged(IMyController _controller, string _methodName)
 {
     myProgressBar_pb.ValueChanged += delegate(object sender, RoutedPropertyChangedEventArgs <double> e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #10
0
 /// <summary>
 /// Add onGotFocus listener
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyTextBox</returns>
 public IMyTextBox addOnGotFocus(IMyController _controller, string _methodName)
 {
     myTextBox_txt.GotFocus += delegate(object sender, System.Windows.RoutedEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #11
0
 /// <summary>
 /// Add onSelectionChanged listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyComboBox</returns>
 public IMyComboBox addOnSelectionChanged(IMyController _controller, string _methodName)
 {
     myComboBox_cbo.SelectionChanged += delegate(object sender, SelectionChangedEventArgs e) {
         _controller.callMethod(_methodName, ((sender as System.Windows.Controls.ComboBox).SelectedItem as ComboBoxItem));
     };
     return(this);
 }
Beispiel #12
0
 /// <summary>
 /// Add dateValidationError listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyDatePicker</returns>
 public IMyDatePicker addDateValidationError(IMyController _controller, string _methodName)
 {
     myDatePicker_dat.DateValidationError += delegate(object sender, DatePickerDateValidationErrorEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #13
0
 /// <summary>
 /// Add selectedDateChanged listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyDatePicker</returns>
 public IMyDatePicker addSelectedDateChanged(IMyController _controller, string _methodName)
 {
     myDatePicker_dat.SelectedDateChanged += delegate(object sender, SelectionChangedEventArgs e) {
         _controller.callMethod(_methodName, myDatePicker_dat.SelectedDate);
     };
     return(this);
 }
 /// <summary>
 /// Add onPreviewMouseDown listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns></returns>
 public IMyPasswordBox addOnPreviewMouseDown(IMyController _controller, string _methodName)
 {
     myPasswordBox_pwd.PreviewMouseDown += delegate(object sender, MouseButtonEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
 /// <summary>
 /// Add onGotFocus listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns></returns>
 public IMyPasswordBox addOnGotFocus(IMyController _controller, string _methodName)
 {
     myPasswordBox_pwd.GotFocus += delegate(object sender, RoutedEventArgs e) {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #16
0
 /// <summary>
 /// Add onClick listener.
 /// </summary>
 /// <param name="_controller"></param>
 /// <param name="_methodName"></param>
 /// <returns>IMyButton</returns>
 public IMyButton addOnClick(IMyController _controller, string _methodName)
 {
     myButton_btn.Click += delegate(object sender, RoutedEventArgs e)
     {
         _controller.callMethod(_methodName);
     };
     return(this);
 }
Beispiel #17
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            _controller =  MyController.GetController(_gestioneGiardino);

            IGiardino giardino = new Giardino();
            _gestioneGiardino.Giardino = giardino;

            AggiornaViews();

            _dateStatusBar.Text = DateTime.Now.ToShortDateString();

            CaricaProvince();

            #region TEST

            Dictionary<Type, Type> type = new Dictionary<Type, Type>();
            type.Add(typeof(ProviderPrecipitazioniDefaultHttp), typeof(StandardInformationVisitor));
            IFactoryGestoreInformazioni fac = FactoryGestoreInformazioni.GetFactory();

            _gestioneGiardino.Luogo = "Bologna";
            ICisterna cisterna = new Cisterna(20, 30);
            _gestioneGiardino.Giardino.Cisterna = cisterna;
            ISettore settore = new Settore("Settore nord", 200);
            ISettore settore2 = new Settore("Settore sud", 100);
            ValvolaDiSettore valv = new ValvolaDiSettore();
            valv.Name = "mario";
            ValvolaDiSettore valv2 = new ValvolaDiSettore();
            valv.Name = "ugo";
            settore.ValvolaSettore = valv;
            settore2.ValvolaSettore = valv2;
            IPianta pianta1 = new Pianta("Solanum lycopersicum", "Pomodoro", 0.50);
            FabbisognoGiornalieroPeriodo fabb1 = new FabbisognoGiornalieroPeriodo(DateTime.Now, DateTime.Now.AddYears(1), 50);
            pianta1.AddFabisogno(fabb1);
            pianta1.GestoreInformazioni = fac.GetGestore(type);
            IPianta pianta2 = new Pianta("Lactuca sativa", "Lattuga", 0.30);
            FabbisognoGiornalieroPeriodo fabb23 = new FabbisognoGiornalieroPeriodo(DateTime.Now, DateTime.Now.AddYears(1), 100);
            pianta2.AddFabisogno(fabb23);
            pianta2.GestoreInformazioni = fac.GetGestore(type);
            IPianta pianta3 = new Pianta("Ocimum basilicum", "Basilico", 0.40);
            pianta3.AddFabisogno(fabb23);
            pianta3.GestoreInformazioni = fac.GetGestore(type);
            settore.AddPianta(pianta1);
            settore.AddPianta(pianta2);
            settore2.AddPianta(pianta3);
            _gestioneGiardino.Giardino.AddSettore(settore);
            _gestioneGiardino.Giardino.AddSettore(settore2);
            #endregion

            bool loginOk = _controller.CreaLoginForm();
            if (!loginOk)
                this.Close();
        }
Beispiel #18
0
 public void setController(IMyController _controller)
 {
     this.controller = _controller;
 }