Esempio n. 1
0
        // AppData を TreeViewItem の形式に変換する
        private TreeViewItem _convert(Models.AppData appData)
        {
            var rootNode = new TreeViewItem(appData.Student, this);

            // 身体測定データの tree を作る
            var physicalClass = new TreeViewItem("身体測定", this, TreeNodeCategoryType.Physical);

            rootNode.Children.Add(physicalClass);

            foreach (var item in appData.Physicals)
            {
                var child = new TreeViewItem(item, this);
                physicalClass.Children.Add(child);
            }

            // 試験結果データの tree を作る
            var testPointClass = new TreeViewItem("試験結果", this, TreeNodeCategoryType.TestPoint);

            rootNode.Children.Add(testPointClass);

            foreach (var item in appData.TestPoints)
            {
                var child = new TreeViewItem(item, this);
                testPointClass.Children.Add(child);
            }

            return(rootNode);
        }
Esempio n. 2
0
        public NavigationTree(Models.AppData appData, IRegionManager regionManager)
        {
            // DI container からmodelsを受け取る
            this._appData       = appData;
            this._rootNode      = this._convert(this._appData); // TreeView に渡せる形式に変換する
            this._regionManager = regionManager;

            var col = new System.Collections.ObjectModel.ObservableCollection <TreeViewItem>
            {
                this._rootNode
            };

            this.TreeNodes = col.ToReadOnlyReactiveCollection().AddTo(this._disposables);

            // ReactiveCommandの設定

            // 選択したアイテムに応じて編集画面を切り替える
            this.SelectedItemChanged = new ReactiveCommand <RoutedPropertyChangedEventArgs <object> >()
                                       .WithSubscribe(e =>
            {
                string viewName = System.String.Empty;
                var current     = e.NewValue as TreeViewItem;

                switch (current.SourceData)
                {
                case Models.PersonalInformation p:
                    viewName = "PersonalEditor";
                    break;

                case Models.PhysicalInformation p:
                    viewName = "PhysicalEditor";
                    break;

                case Models.TestPointInformation t:
                    viewName = "TestPointEditor";
                    break;

                case string s:
                    viewName = "CategoryPanel";
                    break;
                }


                // 編集画面を表示する
                this._regionManager.RequestNavigate("EditorArea", viewName
                                                    , new NavigationParameters
                {
                    // 編集画面にわたすparameter
                    { "TargetData", current.SourceData }
                });
            })
                                       .AddTo(this._disposables);

            // 起動直後はroot nodeを選択した状態にする
            this.Loaded = new ReactiveCommand()
                          .WithSubscribe(() => this._rootNode.IsSelected.Value = true)
                          .AddTo(this._disposables);
        }
Esempio n. 3
0
        /// <summary>新規テストデータを作成します。</summary>
        /// <returns>新規テストデータを表すAppData。</returns>
        private static Models.AppData _createNewTestData()
        {
            var appData = new Models.AppData();

            appData.Student.Name.Value        = "新しい生徒";
            appData.Student.ClassNumber.Value = "所属クラス";
            appData.Student.Sex.Value         = "女";
            appData.Create <Models.PhysicalInformation>();
            appData.Create <Models.TestPointInformation>();

            return(appData);
        }
Esempio n. 4
0
 public PhysicalEditor(Models.AppData appData)
 // DI container からmodelsを受け取る
 => this._appData = appData;