Exemplo n.º 1
0
        /// <summary>
        /// Initializes the commands and tasks for the current board.
        /// </summary>
        public BoardViewModel(
            PresentationBoard board,
            IAdaptiveClient <IServiceManifest> dataProvider,
            IAppNotificationService appNotificationService,
            IToastService toastService)
        {
            Board                   = board;
            DataProvider            = dataProvider;
            _appNotificationService = appNotificationService;
            _toastService           = toastService;

            CurrentTask         = new PresentationTask(new TaskDTO());
            NewTaskCommand      = new RelayCommand <ColumnTag>(NewTask, () => true);
            EditTaskCommand     = new RelayCommand <int>(EditTask, () => true);
            SaveTaskCommand     = new RelayCommand(SaveTask, () => true);
            DeleteTaskCommand   = new RelayCommand <int>(DeleteTask, () => PaneTitle.Equals("Edit Task") || PaneTitle.Equals(""));
            DeleteTagCommand    = new RelayCommand <string>(DeleteTag, () => true);
            CancelEditCommand   = new RelayCommand(CancelEdit, () => true);
            UpdateColumnCommand = new RelayCommand <string>(UpdateColumn, () => true);

            Columns = new ObservableCollection <PresentationColumn>();

            ColorKeys = new ObservableCollection <string>
            {
                "Low", "Medium", "High"
            };

            ReminderTimes = new ObservableCollection <string>
            {
                "None",
                "At Time of Due Date",
                "5 Minutes Before",
                "10 Minutes Before",
                "15 Minutes Before",
                "1 Hour Before",
                "2 Hours Before",
                "1 Day Before",
                "2 Days Before"
            };

            PaneTitle = "New Task";

            //ConfigureBoardColumns();
        }
Exemplo n.º 2
0
        private void ScenarioDetailPane_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (DataContext == null || !(DataContext is Scenario))
            {
                return;
            }

            var myScenario = DataContext as Scenario;

            //update bindings

            #region binding definitions

            var titleBinding = new Binding()
            {
                Source = myScenario,
                Path   = new PropertyPath("Title"),
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            var authorBinding = new Binding()
            {
                Source = myScenario,
                Path   = new PropertyPath("Author"),
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            var creationDateBinding = new Binding()
            {
                Source = myScenario,
                Path   = new PropertyPath("CrationDate"),
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            var ratingBinding = new Binding()
            {
                Source = myScenario,
                Path   = new PropertyPath("Rating"),
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            var descriptionBinding = new Binding()
            {
                Source = myScenario,
                Path   = new PropertyPath("Description"),
                Mode   = BindingMode.TwoWay,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            };

            #endregion

            #region set bindings

            //task pane title
            PaneTitle.SetBinding(TextBlock.TextProperty, titleBinding);

            //general

            #region general

            //title

            TitleTextBox.SetBinding(TextBox.TextProperty, titleBinding);

            //author
            AuthorTextbox.SetBinding(TextBox.TextProperty, authorBinding);

            //creation date
            CreateDatePicker.SetBinding(DatePicker.SelectedDateProperty, creationDateBinding);

            //rating
            RatingTextBox.SetBinding(TextBox.TextProperty, ratingBinding);

            #endregion

            //description
            DescriptionTextBox.SetBinding(TextBox.TextProperty, descriptionBinding);

            // input, intermediate and result cells data
            ScenarioDataCollection = new CompositeCollection();

            #region collection container

            var inputDataCContainer = new CollectionContainer()
            {
                Collection = (DataContext as Scenario).Inputs
            };
            ScenarioDataCollection.Add(inputDataCContainer);

            var intermediateCContainer = new CollectionContainer()
            {
                Collection = (DataContext as Scenario).Intermediates
            };
            ScenarioDataCollection.Add(intermediateCContainer);

            var resultDataCContainer = new CollectionContainer()
            {
                Collection = (DataContext as Scenario).Results
            };
            ScenarioDataCollection.Add(resultDataCContainer);

            #endregion

            ScenarioDataListBox.ItemsSource = ScenarioDataCollection;

            #endregion
        }