public override void LoadDataAsync(LoadCommand cmd, LoadDataAsyncParameters cmdParam, Action<PaneViewModelBase> success = null, Action<PaneViewModelBase, Exception> error = null)
 {
     base.LoadDataAsync(cmd, cmdParam, success, error);
     switch (cmd)
     {
         case LoadCommand.Load:
             WorkHandler.Run(
                 () =>
                 {
                     _packageContent = (BinaryContent)cmdParam.Payload;
                     _stfs = ModelFactory.GetModel<StfsPackage>(_packageContent.Content);
                     return true;
                 },
                 result =>
                     {
                         IsLoaded = true;
                         Tabs.Add(new ProfileRebuilderTabItemViewModel(Resx.FileStructure, ParseStfs(_stfs)));
                         SelectedTab = Tabs.First();
                         if (success != null) success.Invoke(this);
                     },
                 exception =>
                 {
                     if (error != null) error.Invoke(this, exception);
                 });
             break;
     }
 }
Exemplo n.º 2
0
 public override void LoadDataAsync(LoadCommand cmd, LoadDataAsyncParameters cmdParam, Action<PaneViewModelBase> success = null, Action<PaneViewModelBase, Exception> error = null)
 {
     base.LoadDataAsync(cmd, cmdParam, success, error);
     switch (cmd)
     {
         case LoadCommand.Load:
             using (var db = _dbContext.Open())
             {
                 Items.AddRange(db.Get<FtpConnection>().Select(c => new FtpConnectionItemViewModel(c)));
             }
             var add = new NewConnectionPlaceholderViewModel();
             Items.Add(add);
             break;
         case LoadCommand.Restore:
             Save(cmdParam.Payload as FtpConnectionItemViewModel);
             ConnectedFtp = null;
             break;
     }
     if (success != null) success.Invoke(this);
 }