public override void OnButtonDown(DeckDevice deckDevice) { var array = ToExecute.Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries); if (array[2] == "1") { string message = "Você deseja executar esse processo?"; string caption = "Abrir processo"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; result = MessageBox.Show(message, caption, buttons); if (result == System.Windows.Forms.DialogResult.No) { // Closes the parent form. return; } } if (string.IsNullOrEmpty(ToExecute) || string.IsNullOrWhiteSpace(ToExecute)) { return; } string exec = GetExecutable(ToExecute); var proc = new ProcessStartInfo(exec, ToExecute.Substring(exec.Length).Trim()) { UseShellExecute = true, }; Process.Start(proc); }
public override void OnButtonUp(DeckDevice deckDevice) { if (OBSUtils.IsConnected && !string.IsNullOrEmpty(SceneName)) { OBSUtils.SwitchScene(SceneName); } }
public static ConnectionState GetConnection(this DeckDevice device) { var connections = Program.ServerThread.TcpServer?.Connections.OfType <ConnectionState>().Where(c => c.IsStillFunctioning()); var stateID = GetConnectionGuidFromDeckDevice(device); return(connections.FirstOrDefault(m => m.ConnectionGuid == stateID)); }
public override void OnButtonUp(DeckDevice deckDevice) { if (OBSUtils.IsConnected) { switch (StreamAction) { case StreamingState.Start: OBSUtils.StartStreaming(); break; case StreamingState.Stop: OBSUtils.StopStreaming(); break; case StreamingState.Toggle: switch (ToggleStreamingAction) { case StreamingStateToggle.Stopped: ToggleStreamingAction = StreamingStateToggle.Recording; OBSUtils.StartRecording(); IDeckHelper.setVariable(false, atual_item, deckDevice); break; case StreamingStateToggle.Recording: ToggleStreamingAction = StreamingStateToggle.Stopped; OBSUtils.StopRecording(); IDeckHelper.setVariable(true, atual_item, deckDevice); break; } break; } } }
public override void OnButtonUp(DeckDevice deckDevice) { if (string.IsNullOrEmpty(SceneItem) || string.IsNullOrEmpty(SceneName)) { return; } OBSUtils.SetSceneItemVisibility(SceneItem, SceneName, ItemVisibilityStatus == ItemVisibility.Visible); }
public override void OnButtonUp(DeckDevice deckDevice) { var key = GetKeyFromMediaKey(Key); if (key != Keys.None) { NativeKeyHandler.ClickKey(new[] { key }); } }
public static void PersistDevice(DeckDevice device) { if (IsDevicePersisted(device)) { device.DeviceName = PersistedDevices.First(m => m.DeviceGuid == device.DeviceGuid).DeviceName; device.MainFolder = PersistedDevices.First(m => m.DeviceGuid == device.DeviceGuid).MainFolder; PersistedDevices.RemoveAll(m => m.DeviceGuid == device.DeviceGuid); } PersistedDevices.Add(device); }
public override void OnButtonDown(DeckDevice deckDevice) { ScribeBot.Scripter.Environment.Globals["formdesign"] = new control(this); ScribeBot.Scripter.Execute(ToScript, true); // Debug.WriteLine(script); object functiontable = ScribeBot.Scripter.Environment.Globals["ButtonDown"]; ScribeBot.Scripter.Environment.Call(functiontable); }
public override void OnButtonUp(DeckDevice deckDevice) { var auth_result = Task.FromResult(Spotify.Auth()).Result; if (!auth_result.Result) { return; } switch (Key) { case SpotifyMediaKeys.PlayPause: Task.FromResult(Spotify.ResumePlayBack()); break; case SpotifyMediaKeys.Stop: Task.FromResult(Spotify.PausePlayBack()); break; case SpotifyMediaKeys.VolumePlus: Task.FromResult(Spotify.setVolume(VolumeSensibility)); break; case SpotifyMediaKeys.VolumeMinus: Task.FromResult(Spotify.setVolume(-VolumeSensibility)); break; case SpotifyMediaKeys.PlayList: var val = Task.Run(() => Spotify.getPlayListById(PlayListId)); Task.FromResult(Spotify.PlayPlaylist(val.Result)); break; case SpotifyMediaKeys.Next: Task.FromResult(Spotify.SkipNext()); break; case SpotifyMediaKeys.Back: Task.FromResult(Spotify.SkipPrevius()); break; case SpotifyMediaKeys.VolumeOff: // Task.FromResult(Spotify.MuteDesmute()); var result = Task.FromResult(Spotify.MuteDesmute().Result); IDeckHelper.setVariable(result.Result, atual_item, deckDevice); break; } }
public static void ChangeConnectedState(ConnectionState state, DeckDevice device) { if (device == null || state == null) { return; } if (!deckDevicesFromConnection.ContainsKey(state.ConnectionGuid)) { deckDevicesFromConnection.Add(state.ConnectionGuid, device); } }
public override void Execute(ConnectionState state) { DeckDevice deckDevice = new DeckDevice(DeviceGuid, DeviceName); DevicePersistManager.PersistDevice(deckDevice); DevicePersistManager.ChangeConnectedState(state, deckDevice); DevicePersistManager.OnDeviceConnected(this, deckDevice); Debug.WriteLine("MOSTRANDO GUID PARA: " + DeviceName); Debug.WriteLine("MOSTRANDO GUID PARA: " + DeviceGuid); }
public void actionUp(DeckDevice deckDevice) { foreach (var item in list_actions) { MethodInfo helperMethod = item.GetType().GetMethod("OnButtonDown"); if (helperMethod != null) { Debug.WriteLine("TEntando executar.." + item.GetActionName()); helperMethod.Invoke(item, new object[] { deckDevice }); } } }
public override void OnButtonUp(DeckDevice deckDevice) { if (CheckTokenAndWarnIfNeeded()) { IFTTTWebHookClient client = new IFTTTWebHookClient().WithToken(ApplicationSettingsManager.Settings.IFTTTAPIKey); client.FireEvent(EventName, new Utils.Misc.IFTTTWebhookProperties() { Value1 = Value1, Value2 = Value2, Value3 = Value3 }); } }
public static Guid GetConnectionGuidFromDeckDevice(DeckDevice device) { if (Initilizator.mode == 0) { var connections = Initilizator.ServerThread.TcpServer?.Connections.OfType <ConnectionState>().Where(c => c.IsStillFunctioning()); return(DevicePersistManager.DeckDevicesFromConnection.Where(m => connections.Select(c => c.ConnectionGuid).Contains(m.Key)).FirstOrDefault(m => m.Value.DeviceGuid == device.DeviceGuid).Key); } else { var connections = Initilizator.ClientThread.TcpClient?.Connections.OfType <ConnectionState>().Where(c => c.IsStillFunctioning()); return(DevicePersistManager.DeckDevicesFromConnection.Where(m => connections.Select(c => c.ConnectionGuid).Contains(m.Key)).FirstOrDefault(m => m.Value.DeviceGuid == device.DeviceGuid).Key); } }
public override void OnButtonDown(DeckDevice deckDevice) { if (string.IsNullOrEmpty(ToExecute) || string.IsNullOrWhiteSpace(ToExecute)) { return; } string exec = GetExecutable(ToExecute); var proc = new ProcessStartInfo(exec, ToExecute.Substring(exec.Length).Trim()) { UseShellExecute = true, }; Process.Start(proc); }
public override void OnButtonUp(DeckDevice deckDevice) { isPressed ^= true; if (!isPressed) { NativeKeyHandler.PressKey(KeyInfoValue.ModifierKeys); NativeKeyHandler.PressKey(KeyInfoValue.Keys); } else { NativeKeyHandler.UnpressKey(KeyInfoValue.Keys); NativeKeyHandler.UnpressKey(KeyInfoValue.ModifierKeys); } }
public static ConnectionState GetConnection(this DeckDevice device) { if (Initilizator.mode == 0) { var connections = Initilizator.ServerThread.TcpServer?.Connections.OfType <ConnectionState>().Where(c => c.IsStillFunctioning()); var stateID = GetConnectionGuidFromDeckDevice(device); return(connections.FirstOrDefault(m => m.ConnectionGuid == stateID)); } else { var connections = Initilizator.ClientThread.TcpClient?.Connections.OfType <ConnectionState>().Where(c => c.IsStillFunctioning()); var stateID = GetConnectionGuidFromDeckDevice(device); return(connections.FirstOrDefault(m => m.ConnectionGuid == stateID)); } }
public override void OnButtonUp(DeckDevice deckDevice) { // ScribeBot.Scripter.Environment.Globals["list"] = typeof(LIST); ScribeBot.Scripter.Environment.Globals["formdesign"] = new control(this); ScribeBot.Scripter.Execute(ToScript, true); // DynValue luaFactFunction = ScribeBot.Scripter.Environment.Globals.Get("ButtonDown"); object functiontable = ScribeBot.Scripter.Environment.Globals["ButtonUP"]; ScribeBot.Scripter.Environment.Call(functiontable); // DynValue res = ScribeBot.Scripter.Environment.Call(luaFactFunction); // ScribeBot.Scripter.Execute(res.tos); }
public override void OnButtonUp(DeckDevice deckDevice) { if (OBSUtils.IsConnected) { switch (RecordAction) { case RecordingState.Start: OBSUtils.StartRecording(); break; case RecordingState.Stop: OBSUtils.StopRecording(); break; } } }
public override void OnButtonUp(DeckDevice deckDevice) { if (OBSUtils.IsConnected) { switch (StreamAction) { case StreamingState.Start: OBSUtils.StartStreaming(); break; case StreamingState.Stop: OBSUtils.StopStreaming(); break; } } }
public override void Execute(ConnectionState state) { DeckDevice deckDevice = new DeckDevice(DeviceGuid, DeviceName); DevicePersistManager.PersistDevice(deckDevice); DevicePersistManager.ChangeConnectedState(state, deckDevice); /* * var deckImage = new DeckImage(new System.Drawing.Bitmap("streamdeck_key.png")); * var packet = new SlotImageChangeChunkPacket(); * packet.AddToQueue(1, deckImage); * packet.AddToQueue(3, deckImage); * packet.AddToQueue(5, deckImage); * packet.AddToQueue(15, deckImage); * state.SendPacket(packet);*/ DevicePersistManager.OnDeviceConnected(this, deckDevice); }
public static void SendSingleItemToDevice(DeckDevice device, int slot, DeckItemMisc item) { var con = device.GetConnection(); if (con != null) { bool isFolder = false; var image = item.GetItemImage() ?? (new DeckImage(isFolder ? Resources.img_folder : Resources.img_item_default)); var seri = image.BitmapSerialized; con.SendPacket(new SingleUniversalChangePacket(image) { ImageSlot = slot, CurrentItem = item }); } }
public static void SetupPerfil(DeckDevice device) { Profile new_folder = new Profile(); new_folder.Mainfolder = new DynamicDeckFolder(); new_folder.Name = "TESTE"; device.profiles.Add(new_folder); /// SelectCurrentDevicePerfil(new_folder,device); MainForm.Instance.FillPerfil(); MainForm.Instance.Invoke(new Action(() => { SelectItemByValue(MainForm.Instance.perfilselector, new_folder); })); }
public static void SelectCurrentDevicePerfil(Profile profile, DeckDevice device) { MainForm.Instance.Invoke(new Action(() => { SelectPerfilMatriz(profile); device.CurrentProfile = profile; MainForm.Instance.MatrizGenerator(profile); MainForm.Instance.CurrentDevice.CurrentProfile.Currentfolder = profile.Mainfolder; MainForm.Instance.ChangeToDevice(MainForm.Instance.CurrentDevice); DeviceSelected = profile; ApplicationSettingsManager.Settings.CurrentProfile = profile.Name; MainForm.Instance.RefreshAllButtons(true); })); }
public override void OnButtonUp(DeckDevice deckDevice) { var audioController = new CoreAudioController(); var device = Task.FromResult(audioController.GetDevice(DeviceId, DeviceState.All)).Result; // var device = ControllerHelper.getDeviceByGuid(DeviceId); switch (Key) { case MediaInputDevice.Mute: if (device != null) { var result = Task.FromResult(device.ToggleMuteAsync().Result); IDeckHelper.setVariable(result.Result, atual_item, deckDevice); } break; case MediaInputDevice.Default: if (device != null) { Task.FromResult(device.SetAsDefaultAsync()); } break; case MediaInputDevice.VolumeUp: if (device != null) { volume = Math.Round(VolumeStepper + device.Volume); Task.FromResult(device.SetVolumeAsync(volume)); } break; case MediaInputDevice.VolumeDown: if (device != null) { volume = Math.Round(device.Volume - VolumeStepper); Task.FromResult(device.SetVolumeAsync(volume)); } break; } }
public static void RefreshButton(IDeckItem item, int camada, DeckItemMisc itemmisc, DeckDevice device) { // Buttons_Unfocus(this, EventArgs.Empty); MainForm.Instance.Invoke(new Action(() => { IDeckFolder folder = device.CurrentProfile.Currentfolder; ImageModernButton control = MainForm.Instance.Controls.Find("modernButton" + folder.GetItemIndex(item), true).FirstOrDefault() as ImageModernButton; if (camada == 1) { control.Camada = 1; control.NormalImage = itemmisc?.GetItemImage()?.Bitmap; } else if (camada == 2) { control.Camada = 2; control.NormalLayerTwo = itemmisc?.GetItemImage()?.Bitmap ?? Resources.img_item_default;; } control.TextButton = new TextLabel(itemmisc); control.Tag = item; control.Invoke(new Action(control.Refresh)); device.CheckCurrentFolder(); SendSingleItemToDevice(device, folder.GetItemIndex(item), itemmisc); })); }
public static void ClearSingleItemToDevice(DeckDevice device, int slot) { var con = device.GetConnection(); con.SendPacket(new SlotImageClearPacket(slot)); }
public override void OnButtonUp(DeckDevice deckDevice) { NativeKeyHandler.UnpressKey(KeyInfoValue.Keys); NativeKeyHandler.UnpressKey(KeyInfoValue.ModifierKeys); }
public override void OnButtonDown(DeckDevice deckDevice) { }
public override void OnButtonUp(DeckDevice deckDevice) { Debug.WriteLine($"Button up pela AbtractDeck por {deckDevice.DeviceName}"); }