static void Main(string[] args) { var remote = new RemoteControl(); var light = new Light(); var lightOn = new LightOnCommand(light); var lightOff = new LightOffCommand(light); var stereo = new Stereo(); var stereoOn = new StereoOnWithCDCommand(stereo); var stereoOff = new StereoOffWithCDCommand(stereo); var ceilingFan = new CeilingFan("Living Room"); var ceilingFanHighOn = new CeilingFanHighCommand(ceilingFan); var macro = new MacroCommand(new ICommand[] {lightOn, stereoOn}); remote.SetCommand(0, lightOn, lightOff); remote.SetCommand(2, stereoOn, stereoOff); remote.SetCommand(3, ceilingFanHighOn, new NoComand()); remote.SetCommand(4, macro, new NoComand()); remote.OnButtonWasPushed(0); remote.OnButtonWasPushed(1); remote.OnButtonWasPushed(2); remote.OffButtonWasPushed(0); remote.OffButtonWasPushed(1); remote.OffButtonWasPushed(2); remote.UndoButtonWasPushed(); remote.OnButtonWasPushed(3); remote.UndoButtonWasPushed(); remote.OnButtonWasPushed(4); remote.UndoButtonWasPushed(); Console.ReadKey(); }
private void btn_Share_Click(object sender, RoutedEventArgs e) { Reset(); if (!IsSharingStarted) { IsSharingStarted = true; Main.StartSharing(); StartUiTimer(); Dispatcher.Invoke(() => { imageBox.Focus(); btn_Share.Content = "Stop"; txt_IP.Text = Main.MyIP; }); } else { Dispatcher.Invoke(() => { btn_Share.Content = "Share"; }); StopUiTimer(); IsSharingStarted = false; Main.StopSharing(); RemoteControl.StopReceiving(); } }
public static void RunRemoteControlWithMacroCommand() { var light = new Light(); var lightOn = new LightOnCommand(light); var lightOff = new LightOffCommand(light); var garageDoor = new GarageDoor(); var garageDoorOpen = new GarageDoorOpenCommand(garageDoor); var garageDoorClose = new GarageDoorCloseCommand(garageDoor); var stereo = new Stereo(); var stereoOnWithCD = new StereoOnWithCDCommand(stereo); var stereoOff = new StereoOffCommand(stereo); var macroOnCommand = new MacroCommand(new ICommand[] { lightOn, garageDoorOpen, stereoOnWithCD }); var macroOffCommand = new MacroCommand(new ICommand[] { lightOff, garageDoorClose, stereoOff }); var remote = new RemoteControl(); remote.SetCommand(0, macroOnCommand, macroOffCommand); System.Console.WriteLine(remote); System.Console.WriteLine("--- Pushing Macro on ---"); remote.OnButtonWasPressed(0); System.Console.WriteLine("--- Pushing Macro off ---"); remote.OffButtonWasPressed(0); }
public static void RunRemoteControl() { var remote = new RemoteControl(); var light = new Light(); var lightOn = new LightOnCommand(light); var lightOff = new LightOffCommand(light); var garageDoor = new GarageDoor(); var garageDoorOpen = new GarageDoorOpenCommand(garageDoor); var garageDoorClose = new GarageDoorCloseCommand(garageDoor); var stereo = new Stereo(); var stereoOnWithCD = new StereoOnWithCDCommand(stereo); var stereoOff = new StereoOffCommand(stereo); remote.SetCommand(0, lightOn, lightOff); remote.SetCommand(1, garageDoorOpen, garageDoorClose); remote.SetCommand(2, stereoOnWithCD, stereoOff); System.Console.WriteLine(remote); remote.OnButtonWasPressed(0); remote.OffButtonWasPressed(0); remote.OnButtonWasPressed(1); remote.OffButtonWasPressed(1); remote.OnButtonWasPressed(2); remote.OffButtonWasPressed(2); }
public void Input_And_Output() { string input = @"5 5 1 2 N LMLMLMLMM 3 3 E MMRMMRMRRM"; string[] inputLines = input.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); IList <Mower> mowers = new List <Mower>(); Lawn lawn = Lawn.Create(inputLines[0]); RemoteControl remoteControl = new RemoteControl(); for (int i = 1; i < inputLines.Length - 1; i += 2) { Mower mower = new Mower(lawn.Border); mower.Deploy(inputLines[i]); remoteControl.ConnectMower(mower); remoteControl.Send(inputLines[i + 1]); mowers.Add(mower); } Assert.That(mowers.Count, Is.EqualTo(2)); Assert.That(mowers[0].Status, Is.EqualTo("1 3 N")); Assert.That(mowers[1].Status, Is.EqualTo("5 1 E")); }
public void CommandTest() { RemoteControl remoteControl = new RemoteControl(); Light light = new Light("Living Room"); TV tv = new TV("Living Room"); Stereo stereo = new Stereo("Living Room"); Hottub hottub = new Hottub(); LightOnCommand lightOn = new LightOnCommand(light); StereoOnCommand stereoOn = new StereoOnCommand(stereo); TVOnCommand tvOn = new TVOnCommand(tv); HottubOnCommand hottubOn = new HottubOnCommand(hottub); LightOffCommand lightOff = new LightOffCommand(light); StereoOffCommand stereoOff = new StereoOffCommand(stereo); TVOffCommand tvOff = new TVOffCommand(tv); HottubOffCommand hottubOff = new HottubOffCommand(hottub); ICommand[] partyOn = { lightOn, stereoOn, tvOn, hottubOn }; ICommand[] partyOff = { lightOff, stereoOff, tvOff, hottubOff }; MacroCommand partyOnMacro = new MacroCommand(partyOn); MacroCommand partyOffMacro = new MacroCommand(partyOff); remoteControl.SetCommand(0, partyOnMacro, partyOffMacro); Console.WriteLine(remoteControl); Console.WriteLine("--- Pushing Macro On---"); remoteControl.OnButtonWasPushed(0); Console.WriteLine("--- Pushing Macro Off---"); remoteControl.OffButtonWasPushed(0); }
private void InitializeGentleAndTVE() { try { // read Gentle configuration from CommonAppData string gentleConfigFile = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Team MediaPortal", "MediaPortal TV Server", "Gentle.config" ); if (!File.Exists(gentleConfigFile)) { throw new FileNotFoundException("The Gentle configuration file couldn't be found. This occurs when TV Server is not installed.", gentleConfigFile); } Gentle.Common.Configurator.AddFileHandler(gentleConfigFile); // connect to tv server via TVE API RemoteControl.Clear(); RemoteControl.HostName = TvDatabase.Server.ListAll().First(server => server.IsMaster).HostName; _tvControl = RemoteControl.Instance; } catch (Exception ex) { Log.Error("Failed to connect to TVEngine", ex); } }
public async Task InitializeAsync() { IsBusy = true; Functions = new ObservableCollection <Function>(); try { DeviceInfo = await RemoteControl.GetDeviceInfoAsync(Target, CancellationToken.None); var functions = await Function.ListFunctionsAsync(new Ads.AmsNetId(Target), CancellationToken.None); foreach (var function in functions) { Functions.Add(function); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { IsBusy = false; } }
public Interfaces.Plugin.IToolResult Execute(ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd, ref SimPe.Interfaces.Files.IPackageFile package, Interfaces.IProviderRegistry prov) { this.package = package; lv.ListViewItemSorter = sorter; this.Cursor = Cursors.WaitCursor; SimPe.Plugin.Idno idno = SimPe.Plugin.Idno.FromPackage(package); if (idno != null) { this.lbUbi.Visible = (idno.Type != NeighborhoodType.Normal); } this.pfd = null; lv.Sorting = SortOrder.Ascending; sorter.CurrentColumn = 3; FillList(); this.Cursor = Cursors.Default; RemoteControl.ShowSubForm(this); this.package = null; if (this.pfd != null) { pfd = this.pfd; } return(new Plugin.ToolResult((this.pfd != null), false)); }
private void NetworkScanner_OnClientConnected() { if (Main.CommunicationType == Main.CommunicationTypes.Sender) { RemoteControl.IsControlsEnabled = IsControlsEnabled; if (!RemoteControl.IsSubscriberEnabled || Main.IsSubscriberTimedOut) { if (Main.IsSubscriberTimedOut) { if (RemoteControl.IsSubscriberEnabled) { RemoteControl.StopReceiving(); } } if (NetworkScanner.SubscriberDevices.Count > 0) { Main.IsSubscriberTimedOut = false; RemoteControl.StartReceiving(NetworkScanner.SubscriberDevices[0].IP); } Dispatcher.Invoke(() => { Led_CommandsReceived.Background = new SolidColorBrush(Color.FromRgb(255, 0, 0)); }); } else { Dispatcher.Invoke(() => { Led_CommandsReceived.Background = new SolidColorBrush(Color.FromRgb(0, 255, 0)); }); } } }
private void InitializeGentleAndTVE() { try { // Use the same Gentle.config as the TVEngine string gentleConfigFile = Path.Combine( Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Team MediaPortal", "MediaPortal TV Server", "Gentle.config" ); // but be quiet when it doesn't exists, as not everyone has the TV Engine installed if (!File.Exists(gentleConfigFile)) { Log.Info("Cannot find Gentle.config file, assuming TVEngine isn't installed..."); return; } Gentle.Common.Configurator.AddFileHandler(gentleConfigFile); // connect to tv server via TVE API RemoteControl.Clear(); RemoteControl.HostName = "127.0.0.1"; // Why do we have to even bother with this setting? _tvControl = RemoteControl.Instance; } catch (Exception ex) { Log.Error("Failed to connect to TVEngine", ex); } }
public static void Main(string[] args) { var remote = new RemoteControl(); string userInput; remote.SetCommandForButton(1, new StepForward(new Robot())); remote.SetCommandForButton(2, new StepBack(new Robot())); remote.SetCommandForButton(3, new StepLeft(new Robot())); remote.SetCommandForButton(4, new StepRight(new Robot())); do { Console.WriteLine("Chose the option below:"); Console.WriteLine(remote); Console.Write("\nYour choise: "); var input = Console.ReadLine(); int buttonId; int.TryParse(input, out buttonId); remote.PushButton(buttonId); Console.Write("\nDo you want to continue (y/n): "); userInput = Console.ReadLine(); } while (userInput == "y"); }
public void ChooseChannelOneOnTv_Should_WriteMessageOnOutput() { var sut = new RemoteControl(); sut.PointAt(new Tv()); sut.TurnOnOff(); sut.One(); }
private void buttonRestart_Click(object sender, EventArgs e) { try { buttonRestart.Enabled = false; timer1.Enabled = false; RemoteControl.Clear(); if (ServiceHelper.IsStopped) { if (ServiceHelper.Start()) { ServiceHelper.WaitInitialized(); } } else if (ServiceHelper.IsRunning) { if (ServiceHelper.Stop()) { } } RemoteControl.Clear(); timer1.Enabled = true; } finally { buttonRestart.Enabled = true; } }
public bool Connect(string hostname) { try { string connStr; string provider; if (!GetDatabaseConnectionString(out connStr, out provider)) { return(false); } RemoteControl.HostName = hostname; Gentle.Framework.ProviderFactory.SetDefaultProviderConnectionString(connStr); me = new User(); me.IsAdmin = true; groups = ChannelGroup.ListAll(); radioGroups = RadioChannelGroup.ListAll(); channels = Channel.ListAll(); mappings = GroupMap.ListAll(); cards = Card.ListAll(); } catch (Exception ex) { lastException = ex; RemoteControl.Clear(); return(false); } return(true); }
static void Main(string[] args) { var control = new RemoteControl(); var tv = new TV(); var kitchenLight = new Light("Kitchen"); var yardLight = new Light("Yard"); var livingRoomLight = new Light("Living Room"); var bathroomLight = new Light("Bathroom"); var bedroomLight = new Light("Bedroom"); var lightOnKitchen = new LightOnCommand(kitchenLight); var lightOnYard = new LightOnCommand(yardLight); var lightOnLivingR = new LightOnCommand(livingRoomLight); var lightOnBathR = new LightOnCommand(bathroomLight); var lightOnBedR = new LightOnCommand(bedroomLight); var lightOffKitchen = new LightOffCommand(kitchenLight); var lightOffYard = new LightOffCommand(yardLight); var lightOffLivingR = new LightOffCommand(livingRoomLight); var lightOffBathR = new LightOffCommand(bathroomLight); var lightOffBedR = new LightOffCommand(bedroomLight); control.SetCommand(Slot.Num0, new TVOnCommand(tv), new TVOffCommand(tv)); control.SetCommand(Slot.Num1, lightOnKitchen, lightOffKitchen); control.SetCommand(Slot.Num2, lightOnYard, lightOffYard); control.SetCommand(Slot.Num3, new MacroCommand(lightOnKitchen, lightOnYard, lightOnLivingR, lightOnBathR, lightOnBedR), new MacroCommand(lightOffKitchen, lightOffYard, lightOffLivingR, lightOffBathR, lightOffBedR)); Console.WriteLine(control.ToString() + '\n'); control.OnButtonPressed(Slot.Num0); control.OffButtonPressed(Slot.Num0); control.OnButtonPressed(Slot.Num1); control.OffButtonPressed(Slot.Num1); control.OnButtonPressed(Slot.Num2); control.OffButtonPressed(Slot.Num2); Console.WriteLine('\n'); control.UndoButtonPressed(); control.UndoButtonPressed(); control.UndoButtonPressed(); Console.WriteLine('\n'); control.OnButtonPressed(Slot.Num4); Console.WriteLine('\n'); control.OnButtonPressed(Slot.Num3); control.UndoButtonPressed(); Console.ReadKey(); }
public static void Main(string[] args) { Console.Clear(); Console.WriteLine(); Console.WriteLine("Chapter6 - Command"); Console.WriteLine(); SimpleRemoteControl remote = new SimpleRemoteControl(); Light light = new Light(); LightOnCommand lightOn = new LightOnCommand(light); remote.SetCommand(lightOn); remote.ButtonWasPressed(); RemoteControl rc = new RemoteControl(); Console.WriteLine(rc.ToString()); Light lightInBedroom = new Light(); LightOnCommand lightInBedroom_OnCommand = new LightOnCommand(lightInBedroom); LightOffCommand lightInBedroom_OffCommand = new LightOffCommand(lightInBedroom); Stereo myStereo = new Stereo(); StereoOnWithCDCommand myStereo_On = new StereoOnWithCDCommand(myStereo); StereoOffWithCDCommand myStereo_Off = new StereoOffWithCDCommand(myStereo); CeilingFan fan = new CeilingFan("Living room"); CeilingFanHighCommand ceilingFanHighCommand = new CeilingFanHighCommand(fan); CeilingFanOffCommand ceilingFanOffCommand = new CeilingFanOffCommand(fan); MacroCommand macroCommand_On = new MacroCommand(new ICommand[] { lightInBedroom_OnCommand, myStereo_On, ceilingFanHighCommand }); MacroCommand macroCommand_Off = new MacroCommand(new ICommand[] { lightInBedroom_OffCommand, myStereo_Off, ceilingFanOffCommand }); rc.SetCommand(0, lightInBedroom_OnCommand, lightInBedroom_OffCommand); rc.SetCommand(1, myStereo_On, myStereo_Off); rc.SetCommand(2, ceilingFanHighCommand, ceilingFanOffCommand); rc.SetCommand(6, macroCommand_On, macroCommand_Off); Console.WriteLine(rc.ToString()); rc.OnButtonWasPressed(0); rc.OnButtonWasPressed(1); rc.OffButtonWasPressed(0); rc.UndoButtonWasPressed(); rc.OnButtonWasPressed(2); rc.UndoButtonWasPressed(); Console.WriteLine(); Console.WriteLine("-----------------------------"); Console.WriteLine("Call macro command"); rc.OnButtonWasPressed(6); rc.OffButtonWasPressed(6); Console.WriteLine(); Console.WriteLine("-----------------------------"); Console.WriteLine("Macro command finished"); Console.WriteLine(); Console.WriteLine(rc.ToString()); Console.ReadKey(); }
internal Interfaces.Files.IPackedFileDescriptor Execute(Interfaces.Files.IPackageFile package) { this.package = package; this.pfd = null; RemoteControl.ShowSubForm(this); return(pfd); }
public void AlignAcrossGravity() { var align = RemoteControl.GetPosition().Cross(RemoteControl.GetNaturalGravity() * 100); //double altitude = _remoteControl.GetValue<float>("Altitude"); //LOG.Debug("Plantary Alignment Vector: "+ altitude); AlignTo(align); }
public Goto(MyGridProgram argPg, Grid argG, Mover m, Aligner a) { pg = argPg; g = argG; mover = m; aligner = a; rc = new RemoteControl(g); }
void ProcessStepMoveAwayFromDock() { SkipIfOrbitMode(); SkipIfNoGridNearby(); var _rb = ReferenceBlock; var thrusters = new List <IMyThrust>(); if (!IsObstructed(_rb.WorldMatrix.Forward)) { GridTerminalSystem.GetBlocksOfType(thrusters, thruster => thruster.WorldMatrix.Forward == _rb.WorldMatrix.Backward); } else if (!IsObstructed(_rb.WorldMatrix.Backward)) { GridTerminalSystem.GetBlocksOfType(thrusters, thruster => thruster.WorldMatrix.Forward == _rb.WorldMatrix.Forward); } else if (!IsObstructed(_rb.WorldMatrix.Left)) { GridTerminalSystem.GetBlocksOfType(thrusters, thruster => thruster.WorldMatrix.Forward == _rb.WorldMatrix.Right); } else if (!IsObstructed(_rb.WorldMatrix.Right)) { GridTerminalSystem.GetBlocksOfType(thrusters, thruster => thruster.WorldMatrix.Forward == _rb.WorldMatrix.Left); } else if (!IsObstructed(_rb.WorldMatrix.Up)) { GridTerminalSystem.GetBlocksOfType(thrusters, thruster => thruster.WorldMatrix.Forward == _rb.WorldMatrix.Down); } else if (!IsObstructed(_rb.WorldMatrix.Down)) { GridTerminalSystem.GetBlocksOfType(thrusters, thruster => thruster.WorldMatrix.Forward == _rb.WorldMatrix.Up); } else { ZeroThrustOverride(); EchoR("Ship is obstructed, waiting clearance"); throw new PutOffExecutionException(); } double currentSpeed = RemoteControl.GetShipSpeed(); double distanceFromDock = Vector3D.Distance(lastShipPosition, ReferenceBlock.GetPosition()); if (distanceFromDock < SafeDistanceFromDock && currentSpeed < 5) { thrusters.ForEach(thrust => { if (thrust.CurrentThrust > thrust.ThrustOverride) { thrust.ThrustOverride = thrust.CurrentThrust + 5000f; } thrust.ThrustOverride += 2000f; }); } else if (distanceFromDock > SafeDistanceFromDock) { processStep++; } }
void Awake() { remoteCtrl = new RemoteControl(); lastBtn.onClick.AddListener(OnLastBtnClicked); nextBtn.onClick.AddListener(OnNextBtnClicked); ctrlBtn.onClick.AddListener(remoteCtrl.OnCtrlBtnClicked); undoBtn.onClick.AddListener(remoteCtrl.OnUnDoBtnClicked); }
public Aligner( Grid g, double threshold = 0.9999 ) { grid = g; rc = new RemoteControl(g); THRESHOLD = threshold; ALIGN_UNIFORM = false; }
public GekoBrowser(string p_Url, JObject p_Param) { this.m_Url = p_Url; this.m_Param = p_Param; m_RemoteControl = new RemoteControl(); InitializeComponent(); this.Left = 100; this.Top = 100; }
private void OnWindowLoaded(object sender, RoutedEventArgs e) { var remote = new RemoteControl(DataContext as ViewModel) { Owner = this }; remote.Closed += HandleRemoteControlClosed; remote.Show(); }
/// <summary> /// Scripts that use UpdateManager shall be added here. /// </summary> private void RegisterScripts() { RegisterForBlock(typeof(MyObjectBuilder_Beacon), (IMyCubeBlock block) => { Beacon newBeacon = new Beacon(block); RegisterForUpdates(100, newBeacon.UpdateAfterSimulation100, block); }); RegisterForBlock(typeof(MyObjectBuilder_TextPanel), (IMyCubeBlock block) => { TextPanel newTextPanel = new TextPanel(block); RegisterForUpdates(100, newTextPanel.UpdateAfterSimulation100, block); }); RegisterForBlock(typeof(MyObjectBuilder_LaserAntenna), (IMyCubeBlock block) => { LaserAntenna newLA = new LaserAntenna(block); RegisterForUpdates(100, newLA.UpdateAfterSimulation100, block); }); RegisterForBlock(typeof(MyObjectBuilder_MyProgrammableBlock), (IMyCubeBlock block) => { ProgrammableBlock newPB = new ProgrammableBlock(block); RegisterForUpdates(100, newPB.UpdateAfterSimulation100, block); }); RegisterForBlock(typeof(MyObjectBuilder_RadioAntenna), (IMyCubeBlock block) => { RadioAntenna newRA = new RadioAntenna(block); RegisterForUpdates(100, newRA.UpdateAfterSimulation100, block); }); RegisterForBlock(typeof(MyObjectBuilder_RemoteControl), (IMyCubeBlock block) => { RemoteControl newRC = new RemoteControl(block); // Does not receive Updates }); RegisterForBlock(typeof(MyObjectBuilder_LargeGatlingTurret), (IMyCubeBlock block) => { TurretLargeGatling newTurret = new TurretLargeGatling(block); RegisterForUpdates(1, newTurret.UpdateAfterSimulation, block); }); RegisterForBlock(typeof(MyObjectBuilder_LargeMissileTurret), (IMyCubeBlock block) => { TurretLargeRocket newTurret = new TurretLargeRocket(block); RegisterForUpdates(1, newTurret.UpdateAfterSimulation, block); }); RegisterForBlock(typeof(MyObjectBuilder_InteriorTurret), (IMyCubeBlock block) => { TurretInterior newTurret = new TurretInterior(block); RegisterForUpdates(1, newTurret.UpdateAfterSimulation, block); }); //RegisterForBlock(typeof(MyObjectBuilder_OreDetector), (IMyCubeBlock block) => // { // OreDetector newOD = new OreDetector(block); // RegisterForUpdates(100, newOD.Update100, block); // }); }
static void Main() { ntrClient = new NTR(); scriptHelper = new ScriptHelper(); helper = new RemoteControl(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); gCmdWindow = new MainForm(); Application.Run(gCmdWindow); }
public void Execute(object sender, SimPe.Events.ResourceEventArgs e) { PackageRepairForm f = new PackageRepairForm(); if (e.Loaded) { string flname = e.LoadedPackage.Package.SaveFileName; e.LoadedPackage.Package.Close(true); f.Setup(flname); } RemoteControl.ShowSubForm(f); }
public static RemoteControl Register(GtkApplicationBase application) { BusG.Init (); var remoteControl = new RemoteControl (application); Bus.Session.Register (new ObjectPath (Path), remoteControl); if (Bus.Session.RequestName (Namespace) != RequestNameReply.PrimaryOwner) return null; return remoteControl; }
/// <summary> /// Starts the remoting interface /// </summary> private void StartRemoting() { try { // create the object reference and make the singleton instance available RemotingServices.Marshal(_controller, "TvControl", typeof(IController)); RemoteControl.Clear(); } catch (Exception ex) { Log.Write(ex); } }
private static void CommandTest() { Console.WriteLine("---------------------------"); Console.WriteLine("CommandTest"); var tv = new TV(); var command = new TVOnCommand(tv); var pult = new RemoteControl(); pult.SetCommand(command); pult.ClickExecute(); pult.ClickUndo(); Console.WriteLine("---------------------------"); }
public void ValidateDroneMovesResults_4() { var drone = _builder.GetDrone(new Point(1, 2), CardinalCompassPointEnum.North); var command = CommandInterpreter.GetCommandFromString("<*<*<*<**");//<*<**"); foreach (var c in command.DroneMoves) { RemoteControl.SendCommandToDrone(c, drone); } Assert.AreEqual(new Point(1, 3), drone.Position); Assert.AreEqual(CardinalCompassPointEnum.North, drone.Direction); }
public void ValidateDroneMovesResults_ReachLowerEdge_NoMoves() { var drone = _builder.GetDrone(new Point(0, 0), CardinalCompassPointEnum.East); var command = CommandInterpreter.GetCommandFromString("***>**"); foreach (var c in command.DroneMoves) { RemoteControl.SendCommandToDrone(c, drone); } Assert.AreEqual(new Point(3, 0), drone.Position); Assert.AreEqual(CardinalCompassPointEnum.South, drone.Direction); }
/// <summary> /// Build the SceneGraph /// </summary> /// <param name="prov"></param> /// <param name="simpe_pkg"></param> public void Execute(IProviderRegistry prov, SimPe.Interfaces.Files.IPackageFile simpe_pkg, ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd) { this.pfd = pfd; this.open_pkg = simpe_pkg; WaitingScreen.Wait(); try { llopen.Enabled = false; SimPe.Interfaces.Files.IPackageFile orgpkg = simpe_pkg; DateTime start = DateTime.Now; FileTable.FileIndex.Load(); SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fileindex = FileTable.FileIndex.Clone(); fileindex.AddIndexFromPackage(simpe_pkg); SimPe.Interfaces.Scenegraph.IScenegraphFileIndex oldfileindex = FileTable.FileIndex; FileTable.FileIndex = fileindex; //find txtr File /*WaitingScreen.UpdateMessage("Collecting Global Files"); * string[] modelnames = Scenegraph.FindModelNames(simpe_pkg); * try * { * ObjectCloner oc = new ObjectCloner(); * oc.RcolModelClone(modelnames, false, false); * simpe_pkg = oc.Package; * } * catch (ScenegraphException) {}*/ FileTable.FileIndex = oldfileindex; gb.BuildGraph(simpe_pkg, fileindex); gb.FindUnused(orgpkg); WaitingScreen.Stop(); TimeSpan runtime = DateTime.Now.Subtract(start); if (Helper.WindowsRegistry.HiddenMode) { Text = "Runtime: " + runtime.TotalSeconds + " sek. = " + runtime.TotalMinutes + " min."; } RemoteControl.ShowSubForm(this); pfd = this.pfd; } #if !DEBUG catch (Exception ex) { Helper.ExceptionMessage("", ex); } #endif finally { WaitingScreen.Stop(); } }
static void Main() { DisplayLogo(); var yourSettings = new YourSettings(); System.Console.WriteLine(yourSettings); var remote = new RemoteControl(new SamsungTvConnection(yourSettings, new SamsungBytesBuilder(yourSettings))); remote.Push("KEY_VOLDOWN"); System.Console.WriteLine("Command sent to TV."); System.Console.ReadLine(); }
public static void Main(string[] args) { // our application will need some reveiver object Television device = new Television(); // our application will need an invoker object, which // in turns relies on concrete command objects: ICommand on = new OnCommand(device); // command to switch device on ICommand off = new OffCommand(device); // command to switch device off ICommand up = new UpCommand(device); // command to turn volume up ICommand down = new DownCommand(device);// command to turn volume down // now we are ready to create our invoker object which // we should think of as some sort of application menu. RemoteControl menu = new RemoteControl(on, off, up, down); // client code is now able to access the invoker object menu.SwitchPowerOn(); menu.RaiseVolume(); menu.RaiseVolume(); menu.RaiseVolume(); menu.LowerVolume(); menu.SwitchPowerOff(); }
public void RemoteControlTest() { RemoteControl remoteControl = new RemoteControl(); Light kitchenLight = new Light("Kitchen light"); Light livingRoomLight = new Light("Living room light"); Stereo livingRoomStereo = new Stereo("Living room stereo"); LightOnCommand kitchenLightOnCommand = new LightOnCommand(kitchenLight); LightOffCommand kitchenLightOffCommand = new LightOffCommand(kitchenLight); LightOnCommand livingRoomLightOnCommand = new LightOnCommand(livingRoomLight); LightOffCommand livingRoomLightOffCommand = new LightOffCommand(livingRoomLight); StereoOnWithCDCommand stereoOnWithCdCommand = new StereoOnWithCDCommand(livingRoomStereo); StereoOffCommand stereoOffCommand = new StereoOffCommand(livingRoomStereo); remoteControl.SetCommand(0, kitchenLightOnCommand, kitchenLightOffCommand); remoteControl.SetCommand(1, livingRoomLightOnCommand, livingRoomLightOffCommand); remoteControl.SetCommand(2, stereoOnWithCdCommand, stereoOffCommand); Assert.AreEqual("Kitchen light is On", remoteControl.OnButtonWasPushed(0)); }
static void Main(string[] args) { var tv = new CommandTV("Телевизор в гостиной"); var tv2 = new CommandTV("Телевизор в спальне"); var tv3 = new CommandTV("Телевизор на кухне"); var light1 = new CommandLight("Свет в гостиной"); var remoteControl = new RemoteControl(); remoteControl.AddDevice(1, tv, "Включить/выключить телевизор в гостинной"); remoteControl.AddDevice(2, tv2, "Включить/выключить телевизор в спальне"); remoteControl.AddDevice(3, tv3, "Включить/выключить телевизор на кухне"); remoteControl.AddDevice(4, light1, "Переключить режима света в гостинной вперед"); remoteControl.AddDevice(5, light1, "Переключить режима света в гостинной назад"); remoteControl.PrintMenu(); var input = Console.ReadLine(); while (input != "0") { if (input != null) { var button = Int32.Parse(input); if (button == 5 ) { remoteControl.BackCommand(button); } else { remoteControl.ForwardCommand(button); } } input = Console.ReadLine(); } }
/// <summary> /// Creates the channel. /// </summary> /// <returns>The Client Instance<see cref="RemoteControl"/></returns> private ZustellServiceRC createChannel() { //Setup custom binding with HTTPS + Body Signing + Soap1.1 CustomBinding binding = new CustomBinding(); //WSHttpBinding binding = new WSHttpBinding(); //HTTPS Transport HttpsTransportBindingElement transport = new HttpsTransportBindingElement(); //Body signing // MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10 AsymmetricSecurityBindingElement asec = (AsymmetricSecurityBindingElement)SecurityBindingElement.CreateMutualCertificateBindingElement(MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10); asec.SetKeyDerivation(false); asec.AllowInsecureTransport = true; asec.IncludeTimestamp = UseTimestamp; asec.EnableUnsecuredResponse = true; asec.RequireSignatureConfirmation = false; asec.SetKeyDerivation(false); //Setup for SOAP 11 and UTF8 Encoding // MessageVersion.Soap11 TextMessageEncodingBindingElement textMessageEncoding = new TextMessageEncodingBindingElement(MessageVersion.CreateVersion(EnvelopeVersion.Soap11, AddressingVersion.None), Encoding.UTF8); //Bind in order (Security layer, message layer, transport layer) binding.Elements.Add(asec); //binding.Elements.Add(textMessageEncoding); binding.Elements.Add(new SoapMessageEncodingBindingElement(textMessageEncoding)); binding.Elements.Add(transport); EndpointAddress epAddr = new EndpointAddress(new Uri("https://labs1.austriapro.at:443/ZustellserviceWko/services/2015/remote-control"), EndpointIdentity.CreateDnsIdentity("labs2.austriapro.at")); channel = new ChannelFactory<RemoteControl>(binding, epAddr); string fingerprint = "c5 21 52 09 e4 3d 74 7d 7d af da 29 b5 07 7f 99 f1 06 ce 5b"; int disc; byte[] fprint = fingerprint.GetBytes(out disc); //channel.Credentials.ServiceCertificate.DefaultCertificate = new X509Certificate2(@"C:\GIT\eZustellung\POC\eZustellungPlugIn\eZustellungPlugIn\Cert\Labs1AustriaPro.cer"); channel.Credentials.ServiceCertificate.SetDefaultCertificate(StoreLocation.CurrentUser, StoreName.AddressBook, X509FindType.FindByThumbprint, fprint); channel.Credentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication() { RevocationMode = X509RevocationMode.NoCheck, CertificateValidationMode = X509CertificateValidationMode.None, }; channel.Credentials.ClientCertificate.Certificate = _certService.Certificate; //new X509Certificate2(fnCertificate, password.DecryptSecureString(seed)); channel.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None; System.ServiceModel.Description.MustUnderstandBehavior mub = new System.ServiceModel.Description.MustUnderstandBehavior(false); channel.Endpoint.EndpointBehaviors.Add(mub); client = channel.CreateChannel(); return ZustellServiceRC.OK; }
static void Connect(string ip, int port) { RemoteControl remote = new RemoteControl(ip, port); }
private void InitRemoteSettings(ref RemoteControl RCsettings) { RCsettings.DisableRemote = false; RCsettings.DisableRepeat = false; RCsettings.RepeatDelay = 0; }
static void Main(string[] args) { RemoteControl remoteControl = new RemoteControl(); Light kitchenLight = new Light("Kitchen light"); Light livingRoomLight = new Light("Living room light"); Stereo livingRoomStereo = new Stereo("Living room stereo"); CeilingFan ceilingFan = new CeilingFan(); LightOnCommand kitchenLightOnCommand = new LightOnCommand(kitchenLight); LightOffCommand kitchenLightOffCommand = new LightOffCommand(kitchenLight); LightOnCommand livingRoomLightOnCommand = new LightOnCommand(livingRoomLight); LightOffCommand livingRoomLightOffCommand = new LightOffCommand(livingRoomLight); StereoOnWithCDCommand stereoOnWithCdCommand = new StereoOnWithCDCommand(livingRoomStereo); StereoOffCommand stereoOffCommand = new StereoOffCommand(livingRoomStereo); CeilingFanHighCommand ceilingFanHighCommand = new CeilingFanHighCommand(ceilingFan); CeilingFanMediumCommand ceilingFanMediumCommand = new CeilingFanMediumCommand(ceilingFan); CeilingFanOffCommand ceilingFanOffCommand = new CeilingFanOffCommand(ceilingFan); remoteControl.SetCommand(0, kitchenLightOnCommand, kitchenLightOffCommand); remoteControl.SetCommand(1, livingRoomLightOnCommand, livingRoomLightOffCommand); remoteControl.SetCommand(2, stereoOnWithCdCommand, stereoOffCommand); Console.WriteLine(remoteControl.ToString()); Console.WriteLine(remoteControl.OnButtonWasPushed(0)); Console.WriteLine(remoteControl.OffButtonWasPushed(0)); Console.WriteLine(remoteControl.OnButtonWasPushed(1)); Console.WriteLine(remoteControl.OffButtonWasPushed(1)); Console.WriteLine(remoteControl.OnButtonWasPushed(2)); Console.WriteLine(remoteControl.OffButtonWasPushed(2)); RemoteControlWithUndo remoteControlWithUndo = new RemoteControlWithUndo(); remoteControlWithUndo.SetCommand(0, kitchenLightOnCommand, kitchenLightOffCommand); remoteControlWithUndo.SetCommand(1, ceilingFanHighCommand, ceilingFanOffCommand); remoteControlWithUndo.SetCommand(2, ceilingFanMediumCommand, ceilingFanOffCommand); Console.WriteLine(); Console.WriteLine(remoteControlWithUndo.ToString()); Console.WriteLine(remoteControlWithUndo.OnButtonWasPushed(0)); Console.WriteLine(remoteControlWithUndo.OffButtonWasPushed(0)); Console.WriteLine(remoteControlWithUndo.UndoButtonWasPushed()); Console.WriteLine(remoteControlWithUndo.OffButtonWasPushed(0)); Console.WriteLine(); Console.WriteLine(remoteControlWithUndo.ToString()); Console.WriteLine(remoteControlWithUndo.UndoButtonWasPushed()); Console.WriteLine("CEILING FAN"); Console.WriteLine(); Console.WriteLine(remoteControlWithUndo.OnButtonWasPushed(1)); Console.WriteLine(remoteControlWithUndo.OffButtonWasPushed(1)); Console.WriteLine(remoteControlWithUndo.ToString()); Console.WriteLine(remoteControlWithUndo.UndoButtonWasPushed()); Console.WriteLine(remoteControlWithUndo.OnButtonWasPushed(2)); Console.WriteLine(remoteControlWithUndo.ToString()); Console.WriteLine(remoteControlWithUndo.UndoButtonWasPushed()); Console.WriteLine("\r\n-----------PARTY------------\r\n"); RemoteControlWithUndo partyRemoteControl = new RemoteControlWithUndo(); Light partyLight = new Light("Party room"); Stereo partyStereo = new Stereo("Party room"); CeilingFan partyCeilingFan = new CeilingFan(); LightOnCommand lightOn = new LightOnCommand(partyLight); LightOffCommand lightOff = new LightOffCommand(partyLight); StereoOnWithCDCommand stereoOnWithCd = new StereoOnWithCDCommand(partyStereo); StereoOffCommand stereoOff = new StereoOffCommand(partyStereo); CeilingFanHighCommand ceilingFanHigh = new CeilingFanHighCommand(partyCeilingFan); CeilingFanOffCommand ceilingFanOff = new CeilingFanOffCommand(partyCeilingFan); ICommand[] partyOn = {lightOff, stereoOnWithCd, ceilingFanHigh}; ICommand[] partyOff = {lightOn, stereoOff, ceilingFanOff}; partyRemoteControl.SetCommand(0, new MacroCommand(partyOn), new MacroCommand(partyOff)); Console.WriteLine(partyRemoteControl.OnButtonWasPushed(0)); Console.WriteLine(); Console.WriteLine(partyRemoteControl.OffButtonWasPushed(0)); Console.WriteLine(); Console.WriteLine(partyRemoteControl.UndoButtonWasPushed()); Console.ReadLine(); }
// Use this for initialization void Start() { controller = GameObject.Find ("Player").GetComponent<RemoteControl>(); controller.AddSelector(gameObject); if(hasHalos){ closeHalo = (Behaviour)transform.GetChild (0).GetComponent ("Halo"); farHalo = (Behaviour)transform.GetChild (1).GetComponent ("Halo"); leftHalo = (Behaviour)transform.GetChild (2).GetComponent ("Halo"); rightHalo = (Behaviour)transform.GetChild (3).GetComponent ("Halo"); closeHalo.enabled = false; farHalo.enabled = false; leftHalo.enabled = false; rightHalo.enabled = false; } for(int i = 0; i < controlledRepulsors.Length; i++){ Selector sel = ((GameObject)controlledRepulsors[i]).GetComponent<Selector>(); if(sel != null){ sel.AddSwitch(gameObject); } } }