void UploadDecisionViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case "IsValidAndInformationalAndWarning": if (IsValidAndInformationalAndWarning) { DecisionLevel = 2; } break; case "IsValidAndInformational": if (IsValidAndInformational) { DecisionLevel = 1; } break; case "IsValidOnly": if (IsValidOnly) { DecisionLevel = 0; } break; case "DecisionLevel": LoadCommand.UpdateCanExecuteCommand(); break; case "Last2Files": LoadCommand.UpdateCanExecuteCommand(); CancelCommand.UpdateCanExecuteCommand(); break; } }
private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e) { if (LoadCommand != null) { LoadCommand.Execute(null); } }
public void Init(NavObject navObject) { _path = navObject.Path; HtmlUrl = navObject.HtmlUrl; _name = navObject.Name; _gitUrl = navObject.GitUrl; _forceBinary = navObject.ForceBinary; Username = navObject.Username; Repository = navObject.Repository; Branch = navObject.Branch; TrueBranch = navObject.TrueBranch; //Create the filename var fileName = System.IO.Path.GetFileName(_path); if (fileName == null) { fileName = _path.Substring(_path.LastIndexOf('/') + 1); } //Create the temp file path Title = fileName; _editToken = Messenger.SubscribeOnMainThread <SourceEditMessage>(x => { if (x.OldSha == null || x.Update == null) { return; } _gitUrl = x.Update.Content.GitUrl; LoadCommand.Execute(true); }); }
private void OpenIsoSuccess(PaneViewModelBase pane, string path, LoadCommand cmdParam) { IsBusy = false; var isoContentViewModel = (IsoContentViewModel)pane; switch (cmdParam) { case LoadCommand.Load: EventAggregator.GetEvent <OpenNestedPaneEvent>().Publish(new OpenNestedPaneEventArgs(this, pane)); break; case LoadCommand.Extract: var targetPath = WindowManager.ShowFolderBrowserDialog(path, Resx.FolderBrowserDescriptionIsoExtract); if (string.IsNullOrWhiteSpace(targetPath)) { return; } SilentTargetPath = targetPath; isoContentViewModel.SelectAllCommand.Execute(null); EventAggregator.GetEvent <ExecuteFileOperationEvent>().Publish(new ExecuteFileOperationEventArgs(FileOperation.Copy, isoContentViewModel, this, null)); break; case LoadCommand.Convert: isoContentViewModel.ConvertToGod(Path.GetDirectoryName(path)); break; } }
public SourceViewModel(IApplicationService applicationService) { GoToSourceCommand = new ReactiveCommand(); Tags = new ReactiveList <Tag>(); Branches = new ReactiveList <Branch>(); LoadCommand.RegisterAsyncTask(_ => Load(applicationService)); this.WhenAnyValue(x => x.SelectedView).Skip(1).Subscribe(_ => LoadCommand.Execute(null)); GoToSourceCommand.OfType <Tag>().Subscribe(x => { var vm = CreateViewModel <FilesViewModel>(); vm.ProjectKey = ProjectKey; vm.RepositorySlug = RepositorySlug; vm.Branch = x.LatestChangeset; vm.Folder = x.DisplayId; ShowViewModel(vm); }); GoToSourceCommand.OfType <Branch>().Subscribe(x => { var vm = CreateViewModel <FilesViewModel>(); vm.ProjectKey = ProjectKey; vm.RepositorySlug = RepositorySlug; vm.Branch = x.LatestChangeset; vm.Folder = x.DisplayId; ShowViewModel(vm); }); }
public IssuesViewModel(ISessionService sessionService) : base(sessionService) { _sessionService = sessionService; Filter = new IssuesFilterModel(); Title = "Issues"; GoToNewIssueCommand = ReactiveCommand.Create(); GoToNewIssueCommand.Subscribe(_ => { var vm = this.CreateViewModel <IssueAddViewModel>(); vm.RepositoryOwner = RepositoryOwner; vm.RepositoryName = RepositoryName; vm.SaveCommand.Subscribe(x => LoadCommand.ExecuteIfCan()); NavigateTo(vm); }); this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(filter => { InternalItems.Clear(); LoadCommand.ExecuteIfCan(); //CustomFilterEnabled = !(filter == _closedFilter || filter == _openFilter); }); GoToFilterCommand = ReactiveCommand.Create(); GoToFilterCommand.Subscribe(_ => { var vm = this.CreateViewModel <RepositoryIssuesFilterViewModel>(); vm.Init(RepositoryOwner, RepositoryName, Filter); vm.SaveCommand.Subscribe(filter => { Filter = filter; FilterSelection = IssueFilterSelection.Custom; }); NavigateTo(vm); }); }
public PullRequestsViewModel(IApplicationService applicationService) { Title = "Pull Requests"; var pullRequests = new ReactiveList <PullRequestModel>(); PullRequests = pullRequests.CreateDerivedCollection( x => new PullRequestItemViewModel(x, () => { var vm = CreateViewModel <PullRequestViewModel>(); vm.RepositoryOwner = RepositoryOwner; vm.RepositoryName = RepositoryName; vm.Id = (int)x.Number; //vm.PullRequest = x.PullRequest; // vm.WhenAnyValue(x => x.PullRequest).Skip(1).Subscribe(x => // { // var index = PullRequests.IndexOf(pullRequest); // if (index < 0) return; // PullRequests[index] = x; // PullRequests.Reset(); // }); ShowViewModel(vm); }), filter: x => x.Title.ContainsKeyword(SearchKeyword), signalReset: this.WhenAnyValue(x => x.SearchKeyword)); LoadCommand = ReactiveCommand.CreateAsyncTask(t => { var state = SelectedFilter == 0 ? "open" : "closed"; var request = applicationService.Client.Users[RepositoryOwner].Repositories[RepositoryName].PullRequests.GetAll(state: state); return(pullRequests.SimpleCollectionLoad(request, t as bool?)); }); this.WhenAnyValue(x => x.SelectedFilter).Skip(1).Subscribe(_ => LoadCommand.ExecuteIfCan()); }
public void SparqlUpdateLoad() { if (!TestConfigManager.GetSettingAsBoolean(TestConfigManager.UseRemoteParsing)) { Assert.Inconclusive("Test Config marks Remote Parsing as unavailable, test cannot be run"); } TripleStore store = new TripleStore(); LoadCommand loadLondon = new LoadCommand(new Uri("http://dbpedia.org/resource/London")); LoadCommand loadSouthampton = new LoadCommand(new Uri("http://dbpedia.org/resource/Southampton"), new Uri("http://example.org")); store.ExecuteUpdate(loadLondon); store.ExecuteUpdate(loadSouthampton); Assert.AreEqual(2, store.Graphs.Count, "Should now be 2 Graphs in the Store"); Assert.AreNotEqual(0, store.Triples.Count(), "Should be some Triples in the Store"); foreach (IGraph g in store.Graphs) { foreach (Triple t in g.Triples) { Console.Write(t.ToString()); if (g.BaseUri != null) { Console.WriteLine(" from " + g.BaseUri.ToString()); } else { Console.WriteLine(); } } } }
public void SparqlUpdateLoad() { if (!TestConfigManager.GetSettingAsBoolean(TestConfigManager.UseRemoteParsing)) { throw new SkipTestException("Test Config marks Remote Parsing as unavailable, test cannot be run"); } TripleStore store = new TripleStore(); LoadCommand loadLondon = new LoadCommand(new Uri("http://dbpedia.org/resource/London")); LoadCommand loadSouthampton = new LoadCommand(new Uri("http://dbpedia.org/resource/Southampton"), new Uri("http://example.org")); store.ExecuteUpdate(loadLondon); store.ExecuteUpdate(loadSouthampton); Assert.Equal(2, store.Graphs.Count); Assert.NotEmpty(store.Triples); foreach (IGraph g in store.Graphs) { foreach (Triple t in g.Triples) { Console.Write(t.ToString()); if (g.BaseUri != null) { Console.WriteLine(" from " + g.BaseUri.ToString()); } else { Console.WriteLine(); } } } }
public override void OnNavigatedTo(NavigationParameters parameters) { base.OnNavigatedTo(parameters); if (parameters.GetNavigationMode() == NavigationMode.Back) { return; } if (parameters["place"] is GeofencePlace place) { Place.ID = place.ID; Place.Radius = place.Radius; Place.Latitude = place.Latitude; Place.Longitude = place.Longitude; Edit = true; } else { Place.Radius = 300; } Title = Edit ? $"Edit {Place.ID}" : $"Add"; LoadCommand.Execute(); }
public MyIssuesViewModel(ISessionService sessionService) : base(sessionService) { _sessionService = sessionService; Title = "My Issues"; Filter = MyIssuesFilterModel.CreateOpenFilter(); _selectedFilter = this.WhenAnyValue(x => x.Filter) .Select(x => { if (x == null || _openFilter.Equals(x)) { return(0); } return(_closedFilter.Equals(x) ? 1 : -1); }) .ToProperty(this, x => x.SelectedFilter); this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(filter => { IssuesBacking.Clear(); LoadCommand.ExecuteIfCan(); CustomFilterEnabled = !(filter == _closedFilter || filter == _openFilter); }); GoToFilterCommand = ReactiveCommand.Create(); GoToFilterCommand.Subscribe(_ => { var vm = this.CreateViewModel <MyIssuesFilterViewModel>(); vm.Init(Filter); vm.SaveCommand.Subscribe(filter => Filter = filter); NavigateTo(vm); }); }
public PullRequestsViewModel(ISessionService sessionService) { _sessionService = sessionService; Title = "Pull Requests"; Items = InternalItems.CreateDerivedCollection(x => { var vm = new PullRequestItemViewModel(x); vm.GoToCommand.Subscribe(_ => { var prViewModel = this.CreateViewModel <PullRequestViewModel>(); prViewModel.Init(RepositoryOwner, RepositoryName, x.Number, x); NavigateTo(prViewModel); prViewModel.WhenAnyValue(y => y.Issue.State) .DistinctUntilChanged() .Skip(1) .Subscribe(y => LoadCommand.ExecuteIfCan()); }); return(vm); }, filter: x => x.Title.ContainsKeyword(SearchKeyword), signalReset: this.WhenAnyValue(x => x.SearchKeyword)); LoadCommand = ReactiveCommand.CreateAsyncTask(async t => { InternalItems.Reset(await RetrievePullRequests()); }); this.WhenAnyValue(x => x.SelectedFilter).Skip(1).Subscribe(_ => { InternalItems.Clear(); LoadCommand.ExecuteIfCan(); }); }
public PullRequestDiffViewModel(IApplicationService applicationService) { LoadCommand.RegisterAsyncTask(async _ => { Diff = (await applicationService.StashClient.Projects[ProjectKey].Repositories[RepositorySlug].PullRequests[PullRequestId].GetDiff(Path).ExecuteAsync()).Data; }); }
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; } }
public NotificationsViewModel() { _notifications = new FilterableCollectionViewModel <NotificationModel, NotificationsFilterModel>("Notifications"); _notifications.GroupingFunction = (n) => n.GroupBy(x => x.Repository.FullName); _notifications.Bind(x => x.Filter, () => LoadCommand.Execute(false)); this.Bind(x => x.ShownIndex, x => { if (x == 0) { _notifications.Filter = NotificationsFilterModel.CreateUnreadFilter(); } else if (x == 1) { _notifications.Filter = NotificationsFilterModel.CreateParticipatingFilter(); } else { _notifications.Filter = NotificationsFilterModel.CreateAllFilter(); } ((IMvxCommand)ReadAllCommand).RaiseCanExecuteChanged(); }); this.Bind(x => x.IsLoading, ((IMvxCommand)ReadAllCommand).RaiseCanExecuteChanged); if (_notifications.Filter.Equals(NotificationsFilterModel.CreateUnreadFilter())) { _shownIndex = 0; } else if (_notifications.Filter.Equals(NotificationsFilterModel.CreateParticipatingFilter())) { _shownIndex = 1; } else { _shownIndex = 2; } }
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: case LoadCommand.Extract: case LoadCommand.Convert: WorkHandler.Run( () => { FileManager.Load((string)cmdParam.Payload); return(true); }, result => { IsLoaded = true; Initialize(); Drive = Drives.First(); if (success != null) { success.Invoke(this); } }, exception => { if (error != null) { error.Invoke(this, exception); } }); break; } }
public void OnAppearing() { if (LoadCommand.CanExecute(null)) { LoadCommand.Execute(null); } }
public MainWindowViewModel() { LoadDuck = new LoadCommand(this); PhysicsTest = new PhysicsTestCommand(this); MoveToCenterWorld = new MoveToCenterWorldCommand(this); ShowAxis = new ShowAxisCommand(this); ClearConsoleOutput = new ClearConsoleOutputCommand(this); primitiveDrawer = new PrimitiveDrawer(); VisualTreeviewer = new VisualTreeviewerViewModel(); SystemsView = new SystemViewPresenter(); ScriptsConsole = new ScriptsConsoleVM(primitiveDrawer); items = new ObservableCollection <LoadedItem>(); Items = CollectionViewSource.GetDefaultView(items); notificator = new EngineNotificator(); notificator.Subscribe(new ViewportSubscriber(this)); plugins = new PluginImporter(); ConsoleOutput = new ObservableCollection <string>(); System.Diagnostics.Trace.Listeners.Add(new TraceOutputListener(ConsoleOutput, App.Current.Dispatcher)); //new Debugger.Modules.Obj.ObjDetailsWindow().Show(); }
public override async void OnNavigatedTo(string parameter, NavigationMode mode, Dictionary <string, object> state) { LoadCommand.Execute(null); // register background tasks await BackgroundHelper.Register <MyUpdateTileTask>(new SystemTrigger(SystemTriggerType.TimeZoneChange, false)); }
protected BaseRepositoriesViewModel(IApplicationService applicationService, string filterKey = "RepositoryController") { ApplicationService = applicationService; ShowRepositoryOwner = true; Title = "Repositories"; var gotoRepository = new Action <RepositoryItemViewModel>(x => { var vm = CreateViewModel <RepositoryViewModel>(); vm.RepositoryOwner = x.Owner; vm.RepositoryName = x.Name; ShowViewModel(vm); }); Repositories = RepositoryCollection.CreateDerivedCollection( x => new RepositoryItemViewModel(x.Name, x.Owner.Login, x.Owner.AvatarUrl, ShowRepositoryDescription ? x.Description : string.Empty, x.StargazersCount, x.ForksCount, ShowRepositoryOwner, gotoRepository), filter: x => x.Name.ContainsKeyword(SearchKeyword), signalReset: this.WhenAnyValue(x => x.SearchKeyword)); //Filter = applicationService.Account.Filters.GetFilter<RepositoriesFilterModel>(filterKey); this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(_ => LoadCommand.ExecuteIfCan()); // _repositories.FilteringFunction = x => Repositories.Filter.Ascending ? x.OrderBy(y => y.Name) : x.OrderByDescending(y => y.Name); // _repositories.GroupingFunction = CreateGroupedItems; }
public MainWindowViewModel() { LoadCommand = new LoadCommand(); SaveCommand = new SaveCommand(); NotifyPropertyChanged("LoadCommand"); NotifyPropertyChanged("SaveCommand"); }
private static Event HandleLoadCommand(DronesInput input, LoadCommand loadCommand, Dictionary <Product, int> carriedProducts, Drone drone, ref Coordinate droneLocation, ref long currentTurn, ref long carriedWeight) { var distance = droneLocation.CalcEucledianDistance(loadCommand.Warehouse.Location); currentTurn += ((int)Math.Ceiling(distance)) + 1; droneLocation = loadCommand.Warehouse.Location; carriedWeight += loadCommand.Product.Weight * loadCommand.ProductCount; carriedProducts[loadCommand.Product] = carriedProducts.GetOrDefault(loadCommand.Product, 0) + loadCommand.ProductCount; if (carriedWeight > input.MaxWeight) { throw new Exception(string.Format("Drone {0} is carrying {1} weight in turn {2}, which is more than maximum ({3})", drone.Index, carriedWeight, currentTurn, input.MaxWeight)); } var ev = new Event { Turn = currentTurn, Warehouse = loadCommand.Warehouse, ProductTaken = loadCommand.Product, TakenCount = loadCommand.ProductCount, Drone = drone }; return(ev); }
public void SparqlUpdateLoad() { TripleStore store = new TripleStore(); LoadCommand loadLondon = new LoadCommand(new Uri("http://dbpedia.org/resource/London")); LoadCommand loadSouthampton = new LoadCommand(new Uri("http://dbpedia.org/resource/Southampton"), new Uri("http://example.org")); store.ExecuteUpdate(loadLondon); store.ExecuteUpdate(loadSouthampton); Assert.AreEqual(2, store.Graphs.Count, "Should now be 2 Graphs in the Store"); Assert.AreNotEqual(0, store.Triples.Count(), "Should be some Triples in the Store"); foreach (IGraph g in store.Graphs) { foreach (Triple t in g.Triples) { Console.Write(t.ToString()); if (g.BaseUri != null) { Console.WriteLine(" from " + g.BaseUri.ToString()); } else { Console.WriteLine(); } } } }
void scrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) { if (!IsLazyLoad) { return; } if (LoadCommand == null) { return; } var scrollViewer = sender as ScrollViewer; if (scrollViewer == null) { return; } if (IsLoadingUp != true && scrollViewer.ScrollableHeight != 0 && scrollViewer.ScrollableHeight == scrollViewer.VerticalOffset) { LoadCommand.Execute(null); //this.UpdateLayout(); //foreach (var VARIABLE in ItemsSource) //{ //} //this.ScrollIntoView(item); } if (IsLoadingUp && scrollViewer.VerticalOffset == 0) { LoadCommand.Execute(null); } }
public ProjectsViewModel(IApplicationService applicationService, IAccountsService accountsService) { Account = accountsService.ActiveAccount; GoToProjectCommand = new ReactiveCommand(); Projects = new ReactiveCollection <Project>(new [] { CreatePersonalProject(accountsService.ActiveAccount) }); LoadCommand.RegisterAsyncTask(async x => { var getAllProjects = applicationService.StashClient.Projects.GetAll(); using (Projects.SuppressChangeNotifications()) { Projects.Clear(); Projects.Add(CreatePersonalProject(accountsService.ActiveAccount)); Projects.AddRange(await getAllProjects.ExecuteAsyncAll()); } }); GoToProjectCommand.OfType <Project>().Subscribe(x => { var vm = this.CreateViewModel <RepositoriesViewModel>(); vm.ProjectKey = x.Key; vm.Name = x.Name; ShowViewModel(vm); }); }
public NotificationsViewModel(IApplicationService applicationService) { _applicationService = applicationService; Title = "Notifications"; ReadSelectedCommand = ReactiveCommand.Create().WithSubscription(_ => { if (GroupedNotifications.SelectMany(x => x.Notifications).All(x => !x.IsSelected)) { applicationService.Client.ExecuteAsync(applicationService.Client.Notifications.MarkAsRead()).ToBackground(); _notifications.Clear(); } else { var selected = GroupedNotifications.SelectMany(x => x.Notifications) .Where(x => x.IsSelected && x.Notification.Unread).ToList(); var tasks = selected .Select(t => _applicationService.GitHubClient.Notification.MarkAsRead(int.Parse(t.Id))); Task.WhenAll(tasks).ToBackground(); foreach (var s in selected) { _notifications.Remove(s.Notification); } } }); _notifications.Changed.Select(_ => Unit.Default) .Merge(_notifications.ItemChanged.Select(_ => Unit.Default)) .Subscribe(_ => { GroupedNotifications = _notifications.GroupBy(x => x.Repository.FullName).Select(x => { var items = x.Select(y => new NotificationItemViewModel(y, GoToNotification)); var notifications = new ReactiveList <NotificationItemViewModel>(items); return(new NotificationGroupViewModel(x.Key, notifications)); }).ToList(); }); LoadCommand = ReactiveCommand.CreateAsyncTask(async _ => { var all = ActiveFilter == AllFilter; var participating = ActiveFilter == ParticipatingFilter; var req = new Octokit.NotificationsRequest { All = all, Participating = participating, Since = DateTimeOffset.MinValue }; var notifictions = await applicationService.GitHubClient.Notification.GetAllForCurrent(req); _notifications.Reset(notifictions); }); this.WhenAnyValue(x => x.ActiveFilter).Subscribe(x => { _notifications.Clear(); LoadCommand.ExecuteIfCan(); }); }
/// <summary> /// Adds progress indicating feature to the ViewModel's dataloader. /// </summary> /// <param name="cmd"></param> /// <param name="parameter"></param> public virtual void LoadData(LoadCommand cmd, object parameter) { if (ViewModel == null) { return; } ViewModel.LoadDataAsync(cmd, parameter); }
public void RecieveInternetMessage(HasInternetMessageType empty) { HasInternet = true; if (isLoggedin == false) { LoadCommand.Execute(null); } }
/// <summary> /// Creates a new instance of a job view model /// </summary> public JobVM() { // Initialize job commands CreateProposalCommand = new CreateProposalCommand(this); LoadCommand = new LoadCommand(this); AddRoomCommand = new AddRoomCommand(this); ToggleDisplayCommand = new ToggleDisplayCommand(this); }
public void Init() { SelectedTime = Times[0]; SelectedLanguage = _defaultLanguage; GetLanguages().FireAndForget(); this.Bind(x => x.SelectedTime, () => LoadCommand.Execute(null)); this.Bind(x => x.SelectedLanguage, () => LoadCommand.Execute(null)); }
public override void LoadDataAsync(LoadCommand cmd, object cmdParam) { switch (cmd) { case LoadCommand.Load: _title = LoadInfo.Title; var p = (Tuple<byte[], BinMap>) cmdParam; Binary = p.Item1; Map = p.Item2; break; } }
public void ExecuteWithOkTest() { FakeOpenFileDialogService fakeOpenFileDialogService = new FakeOpenFileDialogService(); LoadCommand loadCommand = new LoadCommand(fakeOpenFileDialogService); MainWindowViewModel mainWindowViewModel = new MainWindowViewModel(); loadCommand.MainWindowViewModel = mainWindowViewModel; fakeOpenFileDialogService.ShowDialogResult = true; loadCommand.Execute(null); Assert.AreEqual(fakeOpenFileDialogService.FileName, loadCommand.MainWindowViewModel.Filename); Assert.AreEqual(fakeOpenFileDialogService.FileContent, loadCommand.MainWindowViewModel.LogText); Assert.AreEqual(fakeOpenFileDialogService.FileContent, loadCommand.MainWindowViewModel.LastSavedText); }
public void CanExecuteTest() { LoadCommand loadCommand = new LoadCommand(new FakeOpenFileDialogService()); Assert.IsTrue(loadCommand.CanExecute(null)); }
/// <summary> /// (Starts to) initialize the viewmodel with the specified parameters. /// </summary> //[HandleException] public abstract void LoadDataAsync(LoadCommand cmd, object cmdParam);
void CustomCommand( string command, bool pushCommand = false ) { char[] delimiter = new char[3]; delimiter[0] = ' '; delimiter[1] = '\t'; delimiter[2] = '%'; string[] parsedCommand = command.Split( delimiter, System.StringSplitOptions.RemoveEmptyEntries ); switch( parsedCommand[0].ToLower() ) { case "bgm": { if (parsedCommand.Length > 1) { Debug.Log("<color=green>[StringParser]</color> CREATED NEW BGM COMMAND + " + parsedCommand[1].ToLower()); MusicCommand BGM = new MusicCommand(); BGM.Set(parsedCommand[1].ToLower()); CommandManager.Instance.AddCommand(BGM); } } break; //NOTE(Hendry)::Add command here case "bg": BgCommand bgc = new BgCommand(); if( parsedCommand.Length == 2 ) { bgc.SetBg(parsedCommand[1].ToLower()); if (parsedCommand.Length == 3) { bgc.SetSpd(int.Parse(parsedCommand[2])); } if( pushCommand ) { CommandManager.Instance.AddPushCommand(bgc); } else { CommandManager.Instance.AddCommand( bgc ); } } break; case "show": ShowCharacterCommand character = new ShowCharacterCommand(); if( parsedCommand.Length >= 3 ) { character.SetCharacterName( parsedCommand[1].ToLower() ); character.SetSpawnLocation( parsedCommand[2].ToLower() ); if( pushCommand ) { CommandManager.Instance.AddPushCommand( character ); } else { CommandManager.Instance.AddCommand( character ); } if (parsedCommand.Length >= 4) { character.SetFacing( parsedCommand[3].ToLower() ); } } break; case "pose": ChangePoseCommand newPoseCommand = new ChangePoseCommand(); newPoseCommand.SetNewPose( parsedCommand[1].ToLower(), parsedCommand[2].ToLower() ); if( pushCommand ) { CommandManager.Instance.AddPushCommand( newPoseCommand ); } else { CommandManager.Instance.AddCommand( newPoseCommand ); } break; case "location": if( parsedCommand.Length == 3 ) { bool set = false; if( parsedCommand[2].ToLower() == "on" ) { set = true; } else if( parsedCommand[2].ToLower() == "off" ) { set = false; } else { Debug.Log( "[String Parser]<color=red>wrong command</color> !! the format is icon iconName on/off" ); //Debug.Break(); } locationManager.Instance.SetButton(parsedCommand[1], set); } else { Debug.Log( "[String Parser]<color=red>wrong command</color> !! the format is icon iconName on/off" ); //Debug.Break(); } break; case "eff": EffectCommand newEffect = new EffectCommand(); newEffect.SetEffect( parsedCommand[1] ); if( pushCommand ) { CommandManager.Instance.AddPushCommand( newEffect ); } else { CommandManager.Instance.AddCommand( newEffect ); } break; case "item": if(!GameManager.instance.IsDemoMode()) ItemManager.Instance.AddItem( parsedCommand[1].ToLower() ); break; case "icon": //Note(Hendry) : format is -> icon itemName position scale // position[] = middle/mid/m left/l right/r // scale float value // to destroy -> icon destroy IconCommand iconCommand; if( parsedCommand[1].ToLower() == "destroy" ) { iconCommand = new IconCommand( true ); } else { iconCommand = new IconCommand( parsedCommand[1], parsedCommand[2], float.Parse( parsedCommand[3] ) ); } CommandManager.Instance.AddCommand( iconCommand ); break; case "prompt": // note : prompt will call the menu then open evidence tab // format -> prompt itemName CommandManager.Instance.correctItem = parsedCommand[1]; OpenMenuCommand menuCommand = new OpenMenuCommand(); CommandManager.Instance.AddCommand( menuCommand ); break; case "advquest": if (!GameManager.instance.IsDemoMode()) SceneManager.Instance.AdvQuest(); break; case "load": LoadCommand dialogue = new LoadCommand(); if( parsedCommand.Length == 2 ) { dialogue.SetLoad( parsedCommand[1].ToLower() ); CommandManager.Instance.AddCommand( dialogue ); } break; case"fade": { if (parsedCommand.Length > 2) { FadeCommand foo = new FadeCommand(); if (parsedCommand[1].ToLower() == "in") foo.SetFade(-1, float.Parse(parsedCommand[2])); else foo.SetFade(1, float.Parse(parsedCommand[2])); CommandManager.Instance.AddCommand(foo); } else if(parsedCommand.Length > 1) { FadeCommand foo = new FadeCommand(); if (parsedCommand[1].ToLower() == "in") foo.SetFade(-1); else foo.SetFade(1); CommandManager.Instance.AddCommand(foo); } else { Debug.Log("STRING PARSER - FADE COMMAND NOT LONG ENOUGH"); } } break; } }
public override void LoadDataAsync(LoadCommand cmd, object cmdParam) { switch (cmd) { case LoadCommand.Load: _path = (string) cmdParam; LoadSubscribe(); WorkHandler.Run(LoadFile, LoadFileCallback); break; case LoadCommand.MergeWith: //_profile.MergeWith((StfsPackage)cmdParam); break; } }
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); }
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; } }