Esempio n. 1
0
 public static ApiItemModel Import(MainWindowModel mainWindow, ApiCollectionModel parent, ApiItem item)
 {
     ApiItemModel result;
     switch (item.Type)
     {
         case ApiItemType.Api:
             result = ApiModel.Import(mainWindow, parent, (Api)item);
             break;
         case ApiItemType.Collection:
             result = ApiCollectionModel.Import(mainWindow, parent, (ApiCollection)item);
             break;
         default:
             throw new Exception();
     }
     return result;
 }
Esempio n. 2
0
        protected ApiItemModel(MainWindowModel mainWindow, ApiCollectionModel parent, ApiItem item)
        {
            MainWindow = mainWindow;
            Parent = parent;
            ItemModel = item;
            Items = new RxList<ApiItemModel>();

            this.ObservePropertyChange(x => x.IsSelected).Subscribe(x =>
            {
                if (x)
                {
                    var current = Parent;
                    while (current != null)
                    {
                        current.IsExpanded = true;
                        current = current.Parent;
                    }
                    MainWindow.SelectedItem = this;
                }
            });
        }