private void AddElement(RemoteElement element) { if (!RemoteControlService.AddElement(element)) { this.ShowMessageAsync("Cannot Add Control", string.Format("Only {0} {1} of this control is allowed at a time.", element.MaxControlTypeCount, element.MaxControlTypeCount == 1 ? "instance" : "instances")); } }
private void AddBoundToggleButton() { var pt = contextMenuOpenedHere; if (pt == null) { pt = new Point(0, 0); } AddElement(new RemoteBoundToggleButton { Id = RemoteControlService.CreateId(), LabelOff = "New Bound Toggle Button", LabelOn = "New Bound Toggle Button", IconOff = new IconHolder() { Name = "Builtin: ToggleOff", Source = BuiltinIconSource.Create(FontAwesomeIcon.ToggleOff, Colors.Black) }, IconOn = new IconHolder() { Name = "Builtin: ToggleOn", Source = BuiltinIconSource.Create(FontAwesomeIcon.ToggleOn, Colors.Black) }, X = pt.X, Y = pt.Y, ZIndex = RemoteControlService.Count + 1 }); }
protected void OnOpenActionActivated(object sender, System.EventArgs e) { // Sending remote command to open new image window string command = "StageEditor"; string[] arguments = new string[] {}; MainClass.RemoteControlService.SendCommand(RemoteControlService.PackCommand(command, arguments)); }
public OptionsWindow(RemoteControlService remoteControlService, PluginManager pluginManager, IconManager iconManager, WebServer webServer, Action shutdownCallback) { RemoteControlService = remoteControlService; PluginManager = pluginManager; _IconManager = iconManager; WebServer = webServer; IPWhitelist = new IPWhitelist(); Interfaces = new ObservableCollection <InterfaceModel>(); ToggleErrorDetails = new DelegateCommand(() => ErrorDetailsVisible = !ErrorDetailsVisible); AddButtonCommand = new DelegateCommand(AddButton); AddToggleButtonCommand = new DelegateCommand(AddToggleButton); AddBoundToggleButtonCommand = new DelegateCommand(AddBoundToggleButton); AddSliderCommand = new DelegateCommand(AddSlider); AddBooleanLabelCommand = new DelegateCommand(AddBooleanLabel); AddFloatLabelCommand = new DelegateCommand(AddFloatLabel); AddStringLabelCommand = new DelegateCommand(AddStringLabel); AddStaticLabelCommand = new DelegateCommand(AddStaticLabel); AddTouchPadCommand = new DelegateCommand(AddTouchPad); OpenPropertiesCommand = new DelegateCommand <RemoteElement>(ShowButtonProperties); RemoveButtonCommand = new DelegateCommand <RemoteElement>(RemoveElement); ShutdownCommand = new DelegateCommand(shutdownCallback); OpenUriCommand = new DelegateCommand <Uri>(OpenUri); OpenPluginsDirectoryCommand = new DelegateCommand(OpenPluginsDirectory); TogglePluginsFlyoutCommand = new DelegateCommand(() => PluginsOpen = !PluginsOpen); ToggleSettingsFlyoutCommand = new DelegateCommand(() => SettingsOpen = !SettingsOpen); ToggleConnectionsFlyoutCommand = new DelegateCommand(() => ConnectionsOpen = !ConnectionsOpen); InitializeComponent(); HashSet <IPAddress> addressSet = new HashSet <IPAddress>(); if (Settings.Default.ListenAddressesCustom != null) { for (int i = Settings.Default.ListenAddressesCustom.Count - 1; i >= 0; i--) { IPAddress addr; if (!IPAddress.TryParse(Settings.Default.ListenAddressesCustom[i], out addr) || !addressSet.Add(addr)) { Settings.Default.ListenAddressesCustom.RemoveAt(i); } } } foreach (var iface in NetworkInterface.GetAllNetworkInterfaces()) { string name = iface.Name; foreach (var ifaceAddressProp in iface.GetIPProperties().UnicastAddresses) { Interfaces.Add(new InterfaceModel(name, ifaceAddressProp.Address, addressSet.Contains(ifaceAddressProp.Address), false, UpdateListenAddresses)); addressSet.Remove(ifaceAddressProp.Address); } } foreach (IPAddress addr in addressSet) { Interfaces.Add(new InterfaceModel(R.UnknownInterface, addr, true, true, UpdateListenAddresses)); } SetValue(PasswordRequiredProperty, !string.IsNullOrEmpty(Settings.Default.RequiredPassword)); }
public async Task LoadStationsAsync() { var response = await RemoteControlService.SendCommandSafeAsync(new SocketCommand(SocketCommandType.GET_RADIO_STATIONS), false); if (response != null && !string.IsNullOrEmpty(response.Response)) { var stations = Json.FromJson <List <RadioStation> >(response.Response); Stations = new ObservableCollection <RadioStation>(stations); } }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected override void OnLaunched(LaunchActivatedEventArgs e) { //#if DEBUG // if (System.Diagnostics.Debugger.IsAttached) // { // this.DebugSettings.EnableFrameRateCounter = true; // } //#endif //Frame rootFrame = Window.Current.Content as Frame; MainFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (MainFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page MainFrame = new Frame(); MainFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = MainFrame; } if (e.PrelaunchActivated == false) { if (MainFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter MainFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); BackgroundAudioSettingsHelper.SetValue(BackgroundAudioSettingsConstants.APP_STATE, AppState.Active.ToString()); try { UDPServer.StartService("14288"); RemoteControlService.StartService(); } catch (Exception ex) { throw new Exception("启动UDP服务失败", ex); } } DispatcherHelper.Initialize(); }
public void InitializeContext() { int port = Settings.Default.ListenPort; List <IPEndPoint> endpoints = new List <IPEndPoint>(); switch (Settings.Default.ListenAddressesMode) { case ListenAddressMode.LOCAL_ONLY: endpoints.Add(new IPEndPoint(IPAddress.Loopback, port)); endpoints.Add(new IPEndPoint(IPAddress.IPv6Loopback, port)); break; case ListenAddressMode.CUSTOM: if (Settings.Default.ListenAddressesCustom != null && Settings.Default.ListenAddressesCustom.Count > 0) { for (int i = Settings.Default.ListenAddressesCustom.Count - 1; i >= 0; i--) { var addrStr = Settings.Default.ListenAddressesCustom[i]; IPAddress addr; if (IPAddress.TryParse(addrStr, out addr)) { endpoints.Add(new IPEndPoint(addr, port)); } else { Settings.Default.ListenAddressesCustom.RemoveAt(i); } } } else { Logger.Warn("Custom listen addresses was empty, falling back to localhost only..."); endpoints.Add(new IPEndPoint(IPAddress.Loopback, port)); endpoints.Add(new IPEndPoint(IPAddress.IPv6Loopback, port)); } break; case ListenAddressMode.ANY: foreach (NetworkInterface iface in NetworkInterface.GetAllNetworkInterfaces()) { foreach (var ifaceAddr in iface.GetIPProperties().UnicastAddresses) { endpoints.Add(new IPEndPoint(ifaceAddr.Address, port)); } } break; } _PluginManager = new PluginManager(Path.Combine(Assembly.GetEntryAssembly().GetAssemblyDir(), "plugins")); _ControlService = new RemoteControlService(_AppDataPath, _PluginManager); _WebServer = new WebServer(_ControlService, endpoints.ToArray()); _IconManager = new IconManager(Path.Combine(_AppDataPath, "icons")); }
public async Task LoadAlarmAsync() { var response = await RemoteControlService.SendCommandSafeAsync(new SocketCommand(SocketCommandType.GET_ALARM), false); if (response != null && !string.IsNullOrEmpty(response.Response)) { Alarm = Json.FromJson <Shared.Models.Alarm.Alarm>(response.Response); if (Alarm.Time.HasValue && Alarm.Time.Value != null) { Time = Alarm.Time.Value.ToLocalTime().TimeOfDay; } } }
private void AddSlider() { var pt = contextMenuOpenedHere; if (pt == null) { pt = new Point(0, 0); } AddElement(new RemoteSlider { Id = RemoteControlService.CreateId(), X = pt.X, Y = pt.Y, ZIndex = RemoteControlService.Count + 1 }); }
private async Task SaveAlarmAsync() { var dateTime = DateTime.Now.Date.AddHours(Time.Hours).AddMinutes(Time.Minutes); if (DateTime.Now.TimeOfDay >= Time) { dateTime = dateTime.AddDays(1); } Alarm.Time = dateTime.ToUniversalTime(); RaisePropertyChanged(nameof(Alarm)); try { Alarm.RadioStation = (RadioStation)((KeyValuePair <string, object>)SelectedStation).Value; } catch { } var command = new SocketCommand(SocketCommandType.SET_ALARM, new object[] { Alarm }); await RemoteControlService.SendCommandSafeAsync(command); }
private void AddBooleanLabel() { var pt = contextMenuOpenedHere; if (pt == null) { pt = new Point(0, 0); } AddElement(new RemoteBooleanLabel { Id = RemoteControlService.CreateId(), FalseText = "New Label", TrueText = "New Label", X = pt.X, Y = pt.Y, ZIndex = RemoteControlService.Count + 1 }); }
public async Task LoadStationsAsync() { var response = await RemoteControlService.SendCommandSafeAsync(new SocketCommand(SocketCommandType.GET_RADIO_STATIONS), false); if (response != null && !string.IsNullOrEmpty(response.Response)) { var stations = Json.FromJson <List <RadioStation> >(response.Response); Stations = new ObservableCollection <KeyValuePair <string, object> >(stations.Select(s => new KeyValuePair <string, object>(s.Title, s))); if (Alarm.RadioStation != null) { SelectedStation = Stations.FirstOrDefault(s => s.Key == Alarm.RadioStation.Title); } else { SelectedStation = null; } } }
private void AddButton() { var pt = contextMenuOpenedHere; if (pt == null) { pt = new Point(0, 0); } AddElement(new RemoteButton { Id = RemoteControlService.CreateId(), Label = "New Button", Icon = new IconHolder() { Name = "Builtin: PlusSquareOutline", Source = BuiltinIconSource.Create(FontAwesomeIcon.PlusSquareOutline, Colors.Black) }, X = pt.X, Y = pt.Y, ZIndex = RemoteControlService.Count + 1 }); }
private async void Play(RadioStation station) { var command = new SocketCommand(SocketCommandType.PLAY, new object[] { station }); await RemoteControlService.SendCommandSafeAsync(command); }
private async void Stop() { await RemoteControlService.SendCommandSafeAsync(new SocketCommand(SocketCommandType.STOP)); }
public static void Main(string[] args) { // Initializing remote control mRemoteControlService = new RemoteControlService("localhost", 21985); mRemoteControlService.RemoteCommandReceived += HandleRemoteControlServiceRemoteCommandReceived; // Parsing command line. Formulating command and it's arguments List <string> argslist = new List <string>(args); List <string> commands = new List <string>(); List <List <string> > commands_arguments = new List <List <string> >(); if (argslist.Contains("-q") || argslist.Contains("--queue")) { argslist.Remove("-q"); argslist.Remove("--queue"); // Queue launch mode // Searching for "--default" option int d_inx = -1; d_inx = argslist.IndexOf("-d") >= 0 ? argslist.IndexOf("-d") : d_inx; d_inx = argslist.IndexOf("--default") >= 0 ? argslist.IndexOf("--default") : d_inx; string d_cestage_name = ""; if (d_inx >= 0) { if (d_inx < argslist.Count - 1) { d_cestage_name = argslist[d_inx + 1]; // Removing readed "-d" argslist.RemoveRange(d_inx, 2); if (!ReceiptsManager.IsReceipt(d_cestage_name)) { Console.WriteLine("Incorrect argument: " + d_cestage_name + " is not a .cestage file."); d_cestage_name = ""; } } else if (d_inx == argslist.Count - 1) { Console.WriteLine("Incorrect argument: .cestage file name should be provided after --default or -d"); argslist.RemoveAt(d_inx); } } // Searching for "--target-type" int tt_inx = -1; tt_inx = argslist.IndexOf("-t") >= 0 ? argslist.IndexOf("-t") : tt_inx; tt_inx = argslist.IndexOf("--target-type") >= 0 ? argslist.IndexOf("--target-type") : tt_inx; string target_type = ""; if (tt_inx >= 0) { if (tt_inx < argslist.Count - 1) { target_type = argslist[tt_inx + 1]; // Removing readed "-t" argslist.RemoveRange(tt_inx, 2); if (target_type != "jpeg" && target_type != "png" && target_type != "bmp") { Console.WriteLine("Incorrect target type specified: " + target_type + ". It should be \"jpeg\", \"png\" or \"bmp\"."); target_type = ""; } } else if (tt_inx == argslist.Count - 1) { Console.WriteLine("Incorrect argument: target type should be provided after --target-type or -t"); argslist.RemoveAt(tt_inx); } } // Searching for "--prescale" int p_inx = -1; p_inx = argslist.IndexOf("-p") >= 0 ? argslist.IndexOf("-p") : p_inx; p_inx = argslist.IndexOf("--prescale") >= 0 ? argslist.IndexOf("--prescale") : p_inx; int prescale = 2; if (p_inx >= 0) { if (p_inx < argslist.Count - 1) { if (!int.TryParse(argslist[p_inx + 1], out prescale) || prescale < 1 || prescale > 8) { Console.WriteLine("Incorrect prescale value specified: " + argslist[p_inx + 1] + ". It should be an integer value from 1 to 8."); } // Removing readed "-t" argslist.RemoveRange(p_inx, 2); } else if (p_inx == argslist.Count - 1) { Console.WriteLine("Incorrect argument: prescale should be provided after --prescale or -p"); argslist.RemoveAt(p_inx); } } // Now when all the additional parameters are parsed and removed, // we're analysing, what's left. The options: if (argslist.Count == 2 && ((ReceiptsManager.IsReceipt(argslist[0]) && RawLoader.IsRaw(argslist[1])) || (ReceiptsManager.IsReceipt(argslist[1]) && RawLoader.IsRaw(argslist[0])))) { // Two file names: one cestage and one raw string cestage_filename; string raw_filename; if (ReceiptsManager.IsReceipt(argslist[0]) && RawLoader.IsRaw(argslist[1])) { cestage_filename = argslist[0]; raw_filename = argslist[1]; } else // if (IsCEStageFile(argslist[1]) && DCRawConnection.IsRaw(argslist[0])) { cestage_filename = argslist[1]; raw_filename = argslist[0]; } // Guessing target filename if (target_type == "") { target_type = "jpeg"; } string target_name = System.IO.Path.ChangeExtension(raw_filename, target_type); target_name = CheckIfFileExistsAndAddIndex(target_name); // Launching StageEditor with the cestage file and the raw file commands.Add("AddToQueue"); commands_arguments.Add(new List <string>(new string[] { cestage_filename, raw_filename, target_name, target_type, prescale.ToString() })); } else { // Searching for cestage for each raw and for raws for each cestage for (int i = 0; i < argslist.Count; i++) { if (RawLoader.IsRaw(argslist[i])) { // The current file is a raw // Guessing target filename if (target_type == "") { target_type = "jpeg"; } string target_name = System.IO.Path.ChangeExtension(argslist[i], target_type); target_name = CheckIfFileExistsAndAddIndex(target_name); string[] cestages = ReceiptsManager.FindReceiptsForRaw(argslist[i]); if (cestages.Length > 0) { // At least one found // Launching StageEditor with the cestage file and the raw file commands.Add("AddToQueue"); commands_arguments.Add(new List <string>(new string[] { cestages[0], argslist[i], target_name, target_type, prescale.ToString() })); } else if (d_cestage_name != "") { // Nothing found, but default name is present commands.Add("AddToQueue"); commands_arguments.Add(new List <string>(new string[] { d_cestage_name, argslist[i], target_name, target_type, prescale.ToString() })); } else { Console.WriteLine("Can't open " + argslist[i] + ": can't find it's .cestage file"); } } else if (ReceiptsManager.IsReceipt(argslist[i])) { // The current file is a cestage // Guessing target filename if (target_type == "") { target_type = "jpeg"; } string target_name = System.IO.Path.ChangeExtension(argslist[i], target_type); target_name = CheckIfFileExistsAndAddIndex(target_name); string[] raws = new string[] {}; try { raws = ReceiptsManager.FindRawsForReceipt(argslist[i]); } catch (System.IO.DirectoryNotFoundException dnfe) { Console.WriteLine("Error: " + dnfe.Message); } if (raws.Length > 0) { // At least one found commands.Add("AddToQueue"); commands_arguments.Add(new List <string>(new string[] { argslist[i], raws[0], target_name, target_type, prescale.ToString() })); } else { Console.WriteLine("Can't open " + argslist[i] + ": can't find it's raw file"); } } } } } else { // Not a queue launch mode // If we don't have 1 cestage and 1 raw, let's open as many windows as possible. // But, at first, trying to find "--default" option int d_inx = -1; d_inx = argslist.IndexOf("-d") >= 0 ? argslist.IndexOf("-d") : d_inx; d_inx = argslist.IndexOf("--default") >= 0 ? argslist.IndexOf("--default") : d_inx; string d_cestage_name = ""; if (d_inx >= 0) { if (d_inx < argslist.Count - 1) { d_cestage_name = argslist[d_inx + 1]; // Removing readed "-d" argslist.RemoveRange(d_inx, 2); if (!ReceiptsManager.IsReceipt(d_cestage_name)) { Console.WriteLine("Incorrect argument: " + d_cestage_name + " is not a .cestage file."); d_cestage_name = ""; } } else if (d_inx == argslist.Count - 1) { Console.WriteLine("Incorrect argument: .cestage file name should be provided after --default or -d"); argslist.RemoveAt(d_inx); } } // Searching for "--prescale" int p_inx = -1; p_inx = argslist.IndexOf("-p") >= 0 ? argslist.IndexOf("-p") : p_inx; p_inx = argslist.IndexOf("--prescale") >= 0 ? argslist.IndexOf("--prescale") : p_inx; int prescale = 2; if (p_inx >= 0) { if (p_inx < argslist.Count - 1) { if (!int.TryParse(argslist[p_inx + 1], out prescale) || prescale < 1 || prescale > 8) { Console.WriteLine("Incorrect prescale value specified: " + argslist[p_inx + 1] + ". It should be an integer value from 1 to 8."); } // Removing readed "-p" argslist.RemoveRange(p_inx, 2); } else if (p_inx == argslist.Count - 1) { Console.WriteLine("Incorrect argument: prescale should be provided after --prescale or -p"); argslist.RemoveAt(p_inx); } } if (argslist.Count == 2 && ReceiptsManager.IsReceipt(argslist[0]) && RawLoader.IsRaw(argslist[1])) { // Launching StageEditor with the cestage file and the raw file commands.Add("StageEditor_CEStage_RAW"); commands_arguments.Add(new List <string>(new string[] { argslist[0], argslist[1], prescale.ToString() })); } else if (argslist.Count == 2 && ReceiptsManager.IsReceipt(argslist[1]) && RawLoader.IsRaw(argslist[0])) { // Launching StageEditor with the cestage file and the raw file commands.Add("StageEditor_CEStage_RAW"); commands_arguments.Add(new List <string>(new string[] { argslist[1], argslist[0], prescale.ToString() })); } else { // Searching for cestage for each raw and for raws for each cestage for (int i = 0; i < argslist.Count; i++) { if (RawLoader.IsRaw(argslist[i])) { // The current file is a raw if (d_cestage_name != "") { // Nothing found, but default name is present commands.Add("StageEditor_CEStage_RAW"); commands_arguments.Add(new List <string>(new string[] { d_cestage_name, argslist[i], prescale.ToString() })); } else { commands.Add("StageEditor_RAW"); commands_arguments.Add(new List <string>(new string[] { argslist[i], prescale.ToString() })); } } else if (ReceiptsManager.IsReceipt(argslist[i])) { // The current file is a cestage string[] raws = ReceiptsManager.FindRawsForReceipt(argslist[i]); if (raws.Length > 0) { // At least one found // Launching StageEditor with the cestage file and the raw file commands.Add("StageEditor_CEStage_RAW"); commands_arguments.Add(new List <string>(new string[] { argslist[i], raws[0], prescale.ToString() })); } else if (raws.Length == 0) { Gtk.MessageDialog md = new Gtk.MessageDialog( null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, "Can't find raw file for {0}", argslist[i]); md.Title = MainClass.APP_NAME; md.Run(); md.Destroy(); } else // raws.Length > 1 { Gtk.MessageDialog md = new Gtk.MessageDialog( null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, false, "More than one raw file found for {0}", argslist[i]); md.Title = MainClass.APP_NAME; md.Run(); md.Destroy(); } } } } } bool ownServerStarted = mRemoteControlService.Start(); if (ownServerStarted) { string mylocation = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location); windowsGtkStyle = new WindowsGtkStyle(mylocation + Path.DirectorySeparatorChar + "res" + Path.DirectorySeparatorChar + "win-gtkrc"); Application.Init(); // Creating render queue and its window mRenderingQueue = new RenderingQueue(); mRenderingQueueWindow = new RenderingQueueWindow(mRenderingQueue); mRenderingQueue.StartThread(); } // No files asked if (commands.Count == 0) { // No command line arguments passed. // Sending the "StageEditor" command with no arguments commands.Add("StageEditor"); commands_arguments.Add(new List <string>()); } // Sending the commands List <string> packed_commands = new List <string>(); for (int i = 0; i < commands.Count; i++) { packed_commands.Add(RemoteControlService.PackCommand(commands[i], commands_arguments[i].ToArray())); } mRemoteControlService.SendCommands(packed_commands.ToArray()); if (ownServerStarted) { GLib.Idle.Add(delegate { // Checking if something is already started if (RenderingQueue.IsProcessingItem || StageEditorWindows.Count > 0) { mLoadedSomethingAlready = true; } // Removing all destroyed StageEditorWindows.RemoveAll(delegate(StageEditorWindow wnd) { return(wnd.IsDestroyed); }); // Checking is there any activity or no if (mLoadedSomethingAlready && StageEditorWindows.Count == 0 && !RenderingQueue.IsProcessingItem) { RenderingQueue.StopThread(); Application.Quit(); } return(true); }); Application.Run(); } mRemoteControlService.Stop(); }
private void RemoveElement(RemoteElement element) { RemoteControlService.RemoveElement(element.Id); }
public RemoteControlBrush(RemoteControlService remoteControlService) { _remoteControlService = remoteControlService; }
protected void OnRenderToActionActivated(object sender, System.EventArgs e) { Gtk.FileChooserDialog fcd = new Gtk.FileChooserDialog("Render image to", this, FileChooserAction.Save, "Cancel", ResponseType.Cancel, "Render", ResponseType.Accept); // Adding image filters FileFilter[] ffs = new FileFilter[3]; ffs[0] = new FileFilter(); ffs[0].Name = "JPEG image"; ffs[0].AddCustom(FileFilterFlags.Filename, delegate(Gtk.FileFilterInfo ffi) { return((System.IO.Path.GetExtension(ffi.Filename).ToLower() == ".jpg") || (System.IO.Path.GetExtension(ffi.Filename).ToLower() == ".jpeg")); }); ffs[1] = new FileFilter(); ffs[1].Name = "PNG image"; ffs[1].AddCustom(FileFilterFlags.Filename, delegate(Gtk.FileFilterInfo ffi) { return(System.IO.Path.GetExtension(ffi.Filename).ToLower() == ".png"); }); ffs[2] = new FileFilter(); ffs[2].Name = "Plain 24 bpp bitmap (BMP)"; ffs[2].AddCustom(FileFilterFlags.Filename, delegate(Gtk.FileFilterInfo ffi) { return(System.IO.Path.GetExtension(ffi.Filename).ToLower() == ".bmp"); }); fcd.AddFilter(ffs[0]); fcd.AddFilter(ffs[1]); fcd.AddFilter(ffs[2]); // Adding prescaling widget PreScaleSelectorWidget pssw = new PreScaleSelectorWidget(); pssw.Value = mStage.Prescale; fcd.ExtraWidget = pssw; int prescale = 2; string dest_type = "", fn = ""; bool accept = false; fcd.CurrentName = System.IO.Path.GetFileNameWithoutExtension(mStage.RawFileName); fcd.SetCurrentFolder(System.IO.Path.GetDirectoryName(mStage.RawFileName)); if (fcd.Run() == (int)Gtk.ResponseType.Accept) { fn = fcd.Filename; prescale = pssw.Value; if (fcd.Filter == ffs[0]) { if (System.IO.Path.GetExtension(fn).ToLower() != ".jpeg" && System.IO.Path.GetExtension(fn).ToLower() != ".jpg") { fn += ".jpeg"; } dest_type = "jpeg"; } if (fcd.Filter == ffs[1]) { if (System.IO.Path.GetExtension(fn).ToLower() != ".png") { fn += ".png"; } dest_type = "png"; } if (fcd.Filter == ffs[2]) { if (System.IO.Path.GetExtension(fn).ToLower() != ".bmp") { fn += ".bmp"; } dest_type = "bmp"; } accept = true; } fcd.Destroy(); if (accept) { // Sending remote command to add stage to queue string command = "AddToQueue_StageData"; string[] arguments = new string[] { mStage.SaveStageToString(), mStage.RawFileName, fn, dest_type, prescale.ToString() }; MainClass.RemoteControlService.SendCommand(RemoteControlService.PackCommand(command, arguments)); } }
public RemoteControlController(RemoteControlService remoteControlService) { _remoteControlService = remoteControlService; }
private async void VolumeUp() { await RemoteControlService.SendCommandSafeAsync(new SocketCommand(SocketCommandType.VOLUME_UP)); }