protected override void HandleSettingCommand(SettingCommand command) { try { Logger.InfoFormat("received settingCommand content = {0}", command.Content); CommandManager.Default.BroadcastSettingCommand(command.Content); } catch (Exception ex) { Logger.Error(ex); } }
public MainViewModel() { SettingCheck = false; UserCheck = false; navigateToPageCommandProperty = new navigateToPageCommand(); bookMarkCommandProperty = new BookMarkCommand(); settingCommandProperty = new SettingCommand(); settingPopUpPage = new SettingPopUp(this); userCommandProprety = new UserCommand(); userPopUpPage = new UserPopUp(this); mainCloseCommandProperty = new MainCloseCommand(); toMaxOrNormalCommandProperty = new ToMaxOrNormalCommand(); toMiniCommandProperty = new ToMiniCommand(); titleBarCommandProperty = new MainTitleBarCommand(); searchCommandProperty = new searchCommand(); }
public string Execute(SettingCommand command, string data) {
public ModViewModel() { SettingCommand = new SettingCommand(this); OpenModFolderCommand = new OpenModFolderCommand(this); }
public static List <ChannelCommand> GetChannelCommandsFromRawData(byte[] rawData, int address = 0) { var commands = new List <ChannelCommand>(); var index = address; var time = 0; var currentDuration = 0; while (index < rawData.Length) { if (rawData[index] == (byte)NSPC.Track.Command._00_Return) { // stop/return commands.Add(new ReturnCommand() { Command = rawData[index], StartTime = time }); break; } else if (rawData[index] >= (byte)NSPC.Track.Command._80_C1 && rawData[index] <= (byte)NSPC.Track.Command._C9_Rest) { // note commands.Add(new NoteCommand() { Command = rawData[index], StartTime = time, Duration = currentDuration }); time += currentDuration; } else if (rawData[index] >= (byte)NSPC.Track.Command._CA_Percussion0 && rawData[index] <= (byte)NSPC.Track.Command._DF_Percussion21) { // percussion commands.Add(new ChannelCommand() { Command = rawData[index], StartTime = time, Duration = currentDuration }); time += currentDuration; //? // in theory we should never hit this Debugger.Break(); } else if (rawData[index] == (byte)NSPC.Track.Command._EF_CallLoop) { // command ChannelCommand command = new CallLoopCommand(); command.Command = rawData[index]; command.StartTime = time; for (int i = 0; i < NSPC.Track.CommandParameterCount[(NSPC.Track.Command)rawData[index]]; i++) { command.Parameters.Add(rawData[index + i + 1]); } index += NSPC.Track.CommandParameterCount[(NSPC.Track.Command)rawData[index]]; commands.Add(command); } else if (rawData[index] >= (byte)NSPC.Track.Command._E0_SetInstrument) { // command ChannelCommand command = new SettingCommand(); command.Command = rawData[index]; command.StartTime = time; for (int i = 0; i < NSPC.Track.CommandParameterCount[(NSPC.Track.Command)rawData[index]]; i++) { command.Parameters.Add(rawData[index + i + 1]); } index += NSPC.Track.CommandParameterCount[(NSPC.Track.Command)rawData[index]]; commands.Add(command); } else { // note "parameter" - duration commands.Add(new DurationCommand() { Command = rawData[index], StartTime = time }); currentDuration = rawData[index]; if (index + 1 < rawData.Length) { if (rawData[index + 1] >= 0x01 && rawData[index + 1] < 0x80) { // second "parameter" - staccato/velocity index++; commands.Add(new VelocityCommand() { Command = rawData[index], StartTime = time }); } } } index++; } return(commands); }
public MainPageViewModel(INavigationService navigationService) : base(navigationService) { Title = "HOME"; ImageMarkerInfo.Subscribe(imageInfo => { ImageMarkerPath.Value = null; ImageMarkerPath.Value = imageInfo.ImagePath; }).AddTo(this.Disposable); ImageNodeInfo.Subscribe(imageInfo => { ImageNodePath.Value = null; ImageNodePath.Value = imageInfo.ImagePath; }).AddTo(this.Disposable); ChangeImageCommand = IsBusy.Inverse().ToAsyncReactiveCommand <string>(); ChangeImageCommand.Subscribe(async(param) => { IsBusy.Value = true; var imagePath = await Common.GetImagePath(); var imageInfo = new ImageInfo(); if (param.Equals(MarkerStr)) { imageInfo.ImagePath = File.Exists(imagePath) ? imagePath : ImageMarkerFileName; imageInfo.IsAsset = !File.Exists(imagePath); ImageMarkerInfo.Value = imageInfo; } else if (param.Equals(NodeStr)) { imageInfo.ImagePath = File.Exists(imagePath) ? imagePath : ImageNodeFileName; imageInfo.IsAsset = !File.Exists(imagePath); ImageNodeInfo.Value = imageInfo; } IsBusy.Value = false; }).AddTo(this.Disposable); TakePhotoCommand = IsBusy.Inverse().ToAsyncReactiveCommand <string>(); TakePhotoCommand.Subscribe(async(param) => { IsBusy.Value = true; var imagePath = await Common.TakePhoto(); var imageInfo = new ImageInfo(); if (param.Equals(MarkerStr)) { imageInfo.ImagePath = File.Exists(imagePath) ? imagePath : ImageMarkerFileName; imageInfo.IsAsset = !File.Exists(imagePath); ImageMarkerInfo.Value = imageInfo; } else if (param.Equals(NodeStr)) { imageInfo.ImagePath = File.Exists(imagePath) ? imagePath : ImageNodeFileName; imageInfo.IsAsset = !File.Exists(imagePath); ImageNodeInfo.Value = imageInfo; } IsBusy.Value = false; }).AddTo(this.Disposable); ExecuteARCommand = IsBusy.Inverse().ToAsyncReactiveCommand <string>(); ExecuteARCommand.Subscribe(async(param) => { if (string.IsNullOrEmpty(ApiKey.KudanARApiKey)) { await UserDialogs.Instance.AlertAsync("KudanARのAPIキー取得に失敗しました", $"{AppInfo.Name}", "OK"); await Xamarin.Forms.DependencyService.Get <IKudanARService>().Init(); return; } if (param.Equals("MarkerAR")) { IsBusy.Value = true; await Xamarin.Forms.DependencyService.Get <IKudanARService>().StartMarkerARActivityAsync(); } else if (param.Equals("MarkerlessAR_Floor")) { IsBusy.Value = true; await Xamarin.Forms.DependencyService.Get <IKudanARService>().StartMarkerlessARActivityAsync(); } else if (param.Equals("MarkerlessAR_Wall")) { IsBusy.Value = true; await Xamarin.Forms.DependencyService.Get <IKudanARService>().StartMarkerlessWallActivityAsync(); } // Activity側でビジーフラグ変更 //IsBusy.Value = false; }).AddTo(this.Disposable); SettingCommand = IsBusy.Inverse().ToAsyncReactiveCommand(); SettingCommand.Subscribe(async() => { await this.NavigationService.NavigateAsync("SettingPage"); }).AddTo(this.Disposable); }
protected override void HandleSettingCommand(SettingCommand command) { _settingCommandUpdater.Add(command); }