static void Main(string[] args) { var nodeSwitch1 = new Switch(); var node1 = new Node(); var nodeSwitch2 = new Switch(); var node2 = new Node(); var andGate1 = new AndGate(); var node3 = new Node(); Console.WriteLine(node3.State); node1.SubscribeTo(nodeSwitch1); node2.SubscribeTo(nodeSwitch2); andGate1.Input1.SubscribeTo(node1); andGate1.Input2.SubscribeTo(node2); node3.SubscribeTo(andGate1); Console.WriteLine(node3.State); nodeSwitch1.SwitchStates(); Console.WriteLine(node3.State); nodeSwitch2.SwitchStates(); Console.WriteLine(node3.State); nodeSwitch2.SwitchStates(); Console.WriteLine(node3.State); Console.ReadKey(); }
public IpacDriver(Switch[] state) { _keysnif = new KeySniffer(); _keysnif.KeyDown += new KeySniffer.KeyPress(_keysnif_KeyDown); _keysnif.KeyUp += new KeySniffer.KeyPress(_keysnif_KeyUp); _state = state; }
/// <summary> /// Initialisiert die Roboter-Konsole mit den dazugehörigen LED's und Schalter. /// </summary> public RobotConsole(RunMode runMode) { if (!Constants.IsWinCE) runMode = RunMode.Virtual; if (runMode == RunMode.Virtual) { digitalIn = new DigitalInSim(); digitalOut = new DigitalOutSim(); } else { // digitalIn = new DigitalInHW(Constants.IOConsoleSWITCH); digitalIn = new DigitalInHW(Constants.IOConsoleSWITCH); digitalOut = new DigitalOutHW(Constants.IOConsoleLED); } this.leds = new Led[4]; for (int i = 0; i < this.leds.Length; i++) { leds[i] = new Led(digitalOut,(Leds)i); } this.blinkingLeds = new BlinkingLed[4]; for (int i = 0; i < this.blinkingLeds.Length; i++) { blinkingLeds[i] = new BlinkingLed(digitalOut, (BlinkingLeds)i); } this.switches = new Switch[4]; for (int i = 0; i < this.switches.Length; i++) { switches[i] = new Switch(digitalIn, (Switches)i); } }
public App () { var stringSettingEntry = new Entry (); stringSettingEntry.SetBinding (Entry.TextProperty, nameof (SettingsViewModel.SomeStringSetting)); var boolSettingSwitch = new Switch (); boolSettingSwitch.SetBinding (Switch.IsToggledProperty, nameof (SettingsViewModel.SomeBoolSetting)); // The root page of your application MainPage = new ContentPage { Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Children = { new Label { Text = "Some String" }, stringSettingEntry, new Label { Text = "Some Bool" }, boolSettingSwitch, } } }; MainPage.BindingContext = new SettingsViewModel (); }
public SaveToDictionaryCS() { var labelStyle = new Style(typeof(Label)) { Setters = { new Setter { Property = Label.XAlignProperty, Value = TextAlignment.End }, new Setter { Property = Label.YAlignProperty, Value = TextAlignment.Center }, new Setter { Property = Label.WidthRequestProperty, Value = 150 } } }; var labelName = new Label { Text = "Name:", Style = labelStyle }; entryName = new Entry { Placeholder = "Input your name", HorizontalOptions = LayoutOptions.FillAndExpand }; var labelBirthday = new Label { Text = "Birthday:", Style = labelStyle }; pickerBirthday = new DatePicker { Date = new DateTime(1990, 1, 1) }; var labelLike = new Label { Text = "Like Xamarin?", Style = labelStyle }; switchLike = new Switch { }; var saveButton = new Button { Text = "Save", HorizontalOptions = LayoutOptions.FillAndExpand }; saveButton.Clicked += saveButton_Clicked; var loadButton = new Button { Text = "Load", HorizontalOptions = LayoutOptions.FillAndExpand }; loadButton.Clicked += loadButton_Clicked; var clearButton = new Button { Text = "Clear", HorizontalOptions = LayoutOptions.FillAndExpand }; clearButton.Clicked += clearButton_Clicked; resultLabel = new Label { Text = "", FontSize = 30 }; Title = "Save to dictionary (C#)"; Content = new StackLayout { Padding = 10, Spacing = 10, Children = { new Label { Text = "DataSave Sample", FontSize = 40, HorizontalOptions = LayoutOptions.Center }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { labelName, entryName } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { labelBirthday, pickerBirthday } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { labelLike, switchLike } }, new StackLayout { Orientation = StackOrientation.Horizontal, Children = { saveButton, loadButton, clearButton } }, resultLabel } }; }
// Use this for initialization void Start() { //Set state of object bIsUnlocked = false; switchKey = GameObject.FindWithTag("Switch").GetComponent<Switch>(); switchKey2 = GameObject.FindWithTag("Switch").GetComponent<Switch>(); }
protected override void ControlsToData() { if (_item == null) _item = new Switch(); base.ControlsToData(); if (((Switch)_item).Interface == null) ((Switch)_item).Interface = new Interface(); if (((Switch)_item).Interface.Ports == null) ((Switch)_item).Interface.Ports = new List<Port>(); ((Switch)_item).Interface.Ports.Clear(); foreach (ListViewItem lvi in lvInterface.Items) { var port = lvi.Tag as Port; if (port is PhysicalInterfacePortsPort) { var p = new Port { direction = port.direction, directionSpecified = port.directionSpecified, Extension = port.Extension, name = port.name, type = port.type, typeSpecified = port.typeSpecified }; port = p; } ((Switch)_item).Interface.Ports.Add(port); } List<SwitchRelaySetting> srsList = (from ListViewItem lvi in lvSwitchRelays.Items select lvi.Tag as SwitchRelaySetting).ToList(); ((Switch)_item).Connections = srsList; }
public HalloweenScene1(IEnumerable<string> args) { hours = new OperatingHours("Hours"); georgeStrobeLight = new StrobeDimmer("George Strobe"); spiderLight = new StrobeColorDimmer("Spider Light"); skullsLight = new Dimmer("Skulls"); cobWebLight = new Dimmer("Cob Web"); blinkyEyesLight = new Switch("Blinky Eyes"); rgbLightRight = new StrobeColorDimmer("Light Right"); georgeLight = new StrobeColorDimmer("George Light"); leftSkeletonLight = new StrobeColorDimmer("Skeleton Light"); georgeMotor = new MotorWithFeedback("George Motor"); candyLight = new StrobeColorDimmer("Candy Light"); spiderLift = new Switch("Slider Lift"); smokeMachine = new Switch("Smoke Machine"); spiderEyes = new Switch("Spider Eyes"); pressureMat = new DigitalInput("Pressure Mat"); testButton = new DigitalInput("Test"); pulsatingEffect1 = new Effect.Pulsating("Pulse FX 1", S(2), 0.1, 0.4); pulsatingEffect2 = new Effect.Pulsating("Pulse FX 2", S(2), 0.3, 0.5); candyPulse = new Effect.Pulsating("Candy Pulse", S(3), 0.01, 0.1); flickerEffect = new Effect.Flicker("Flicker", 0.4, 0.6); audioPlayer = new Physical.NetworkAudioPlayer( Properties.Settings.Default.NetworkAudioPlayerIP, Properties.Settings.Default.NetworkAudioPlayerPort); }
public SwitchDemoPage() { Label header = new Label { Text = "Switch", Font = Font.SystemFontOfSize(50, FontAttributes.Bold), HorizontalOptions = LayoutOptions.Center }; Switch switcher = new Switch { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; switcher.Toggled += switcher_Toggled; label = new Label { Text = "Switch is now False", Font = Font.SystemFontOfSize(NamedSize.Large), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; // Build the page. this.Content = new StackLayout { Children = { header, switcher, label } }; }
private void button1_Click(object sender, EventArgs e) { LocalAreaNetwork lan1 = new LocalAreaNetwork(); PersonalComputer pc1 = new PersonalComputer("pc1"); pc1.AddInterface(new EthernetController("192.168.100.1", "255.255.255.0")); PersonalComputer pc2 = new PersonalComputer("pc2"); pc2.AddInterface(new EthernetController("192.168.100.2", "255.255.255.0")); PersonalComputer pc3 = new PersonalComputer("pc3"); pc3.AddInterface(new EthernetController("192.168.100.3", "255.255.255.0")); Switch sw = new Switch(3, "sw"); lan1.AddDevice(pc1); lan1.AddDevice(pc2); lan1.AddDevice(pc3); lan1.AddDevice(sw); lan1.AddLink(new WiredLink(pc1.Interfaces[0] as EthernetController, sw.Interfaces[0] as EthernetController)); lan1.AddLink(new WiredLink(pc2.Interfaces[0] as EthernetController, sw.Interfaces[1] as EthernetController)); lan1.AddLink(new WiredLink(pc3.Interfaces[0] as EthernetController, sw.Interfaces[2] as EthernetController)); Packet p = new Packet("192.168.100.1", "192.168.100.3", "ping"); pc1.SendPacket(p); }
public static StackLayout GetAnimatedSwitch(FlexPie flexPie) { Label label = new Label(); label.Text = "Animated?"; label.VerticalOptions = LayoutOptions.FillAndExpand; label.HorizontalOptions = LayoutOptions.FillAndExpand; Switch toggleSwitch = new Switch(); toggleSwitch.IsToggled = true; toggleSwitch.Toggled += (e, sender) => { Switch sentSwitch = (Switch) e; flexPie.IsAnimated = sentSwitch.IsToggled; }; StackLayout stack = new StackLayout(); stack.Orientation = StackOrientation.Horizontal; stack.Children.Add(label); stack.Children.Add(toggleSwitch); return stack; }
private Switch GenerateSwitch(AgencyType type) { var Switch = new Switch { IsToggled = TrackingManager.IsAgencyBeingTracked(type), Margin = new Thickness(0, 0, 0, 10) }; Switch.Toggled += (sender, args) => { if (sender.GetType() != typeof(Switch)) return; if (((Switch)sender).IsToggled) { TrackingManager.AddTrackedAgency(type); } else { TrackingManager.RemoveTrackedAgency(type); } }; return Switch; }
private void LoadRoom(Vector2 position, GameData data) { //floor EntList.Add(new BldgFloor(position, new Vector2(houseWidth, houseHeight))); //solid walls EntList.Add(new BldgWall(position + new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0)); EntList.Add(new BldgWall(position - new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0)); EntList.Add(new BldgWall(position - new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(houseHeight, wallWidth), 3 * MathHelper.PiOver2)); EntList.Add(new BldgWall(position + new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(houseHeight, wallWidth), MathHelper.PiOver2)); //switch if (!data.SwitchFound) { Switch s = new Switch(position + new Vector2(halfWidth - 32, halfHeight - 32)); EntList.Add(s); PickupTriggers.Add(new TriggerPickup(s.Position, new Vector2(64, 64), s)); } Note n = new Note(Vector2.Zero); EntList.Add(n); ReadingTriggers.Add(new TriggerReading(n.Position, new Vector2(64, 64), Notes.HouseNote)); //stairs Stairs st = new Stairs(position - (new Vector2(halfWidth - stairsHalfWidth - 80, -halfHeight + stairsHalfHeight))); EntList.Add(st); EntList.Add(new Border(st.Position - new Vector2(0, st.Size.Y / 2 + 2), new Vector2(st.Size.X, 4))); EntList.Add(new Border(st.Position + new Vector2(st.Size.X / 2 + 2, 1), new Vector2(4, st.Size.Y + 2))); AreaChangeTriggers.Add(new TriggerChangeArea(st.Position, st.Size - new Vector2(10, 10), new AreaMars())); }
public CreateGroup() { String status; Button button = new Button { Text = "Criar" }; Entry GroupName = new Entry { Placeholder = "Digite o nome do grupo", }; Switch switcher = new Switch { HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }; switcher.Toggled += switcher_Toggled; Label bike = new Label { Text = "Bike", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand }; if (switcher.IsToggled) status = "Corrida"; else status = "Bike"; Label corrida = new Label { Text = "Corrida", FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand }; // Accomodate iPhone status bar. this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5); var veiculos = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { bike, switcher, corrida } }; // Build the page. this.Content = new StackLayout { Children = { GroupName, veiculos } }; }
public void Given_OffSwitch_When_SwitchOn_throws_exception_Then_Should_revert() { var s = new Switch(false); intercept<InvalidOperationException>(() => s.SwitchOn(() => { throw new InvalidOperationException(); })); Assert.True(s.IsOff); Assert.False(s.IsOn); }
/// <summary> /// Initialisiert die Roboter-Konsole mit den dazugehörigen LED's und Schalter. /// </summary> public RobotConsole(RunMode aRunMode) { if (aRunMode == RunMode.Virtual) { digitalIn = new DigitalInSim(); digitalOut = new DigitalOutSim(); } else { digitalIn = new DigitalInHW(Constants.IOConsoleSWITCH); digitalOut = new DigitalOutHW(Constants.IOConsoleLED); } this.leds = new Led[4]; for (int i = 0; i < this.leds.Length; i++) { leds[i] = new Led((Leds)i, digitalOut); if (i % 2 == 0) { leds[i].LedEnabled = false; } } this.switches = new Switch[4]; for (int i = 0; i < this.switches.Length; i++) { switches[i] = new Switch((Switches)i, digitalIn); switches[i].SwitchStateChanged += new EventHandler<SwitchEventArgs>(RobotConsole_SwitchStateChanged); } }
public void Given_OnSwitch_When_SwitchOff_throws_exception_Then_Should_revert() { var s = new Switch(true); XAssert.Throws<InvalidOperationException>(() => s.SwitchOff(() => { throw new InvalidOperationException(); })); Assert.True(s.IsOn); Assert.False(s.IsOff); }
public Circuit(Canvas canvas) { this._canvas = canvas; _nearDist = new Vector(0,10); _farDist = new Vector(0,30); _imLtOff = new BitmapImage(new Uri(@"Images/12-LightOff.bmp", UriKind.Relative)); _imLtOn = new BitmapImage(new Uri(@"Images/12-LightOn.bmp", UriKind.Relative)); _imLamp.Source = _imLtOff; _lightOn = false; canvas.Children.Add(_imLamp); Canvas.SetLeft(_imLamp, 70.0); Canvas.SetTop(_imLamp, 5.0); _switch1 = new Switch(canvas, 150, 100); _switch1.evToggle += new EventHandler(switch_evToggle); _switch1.evSwitchMoved += new EventHandler(switch_evSwitchMoved); _switch2 = new Switch(canvas, 25, 100); _switch2.evToggle += new EventHandler(switch_evToggle); _switch2.evSwitchMoved += new EventHandler(switch_evSwitchMoved); _yNear = _switch1.Con2.Y + _nearDist.Y; _yFar = _switch1.Con2.X + _farDist.X; RouteWires(canvas); }
public HalloweenScene2013(IEnumerable<string> args) { buttonTestHand = new DigitalInput("Hand"); buttonTestHead = new DigitalInput("Head"); buttonTestDrawer1 = new DigitalInput("Drawer 1"); buttonTestDrawer2 = new DigitalInput("Drawer 2"); buttonRunSequence = new DigitalInput("Run Seq!"); buttonTestSound = new DigitalInput("Test Sound"); buttonTestPopEyes = new DigitalInput("Pop Eyes"); buttonTestPopUp = new DigitalInput("Pop Up"); switchHand = new Switch("Hand"); switchHead = new Switch("Head"); switchDrawer1 = new Switch("Drawer 1"); switchDrawer2 = new Switch("Drawer 2"); switchPopEyes = new Switch("Pop Eyes"); switchPopUp = new Switch("Pop Up"); audioPlayer = new AudioPlayer("Audio Player"); raspberry.DigitalInputs[0].Connect(buttonTestHand); raspberry.DigitalInputs[1].Connect(buttonTestHead); raspberry.DigitalInputs[2].Connect(buttonTestDrawer1); raspberry.DigitalInputs[3].Connect(buttonTestDrawer2); raspberry.DigitalInputs[7].Connect(buttonRunSequence); raspberry.DigitalOutputs[7].Connect(switchHand); raspberry.DigitalOutputs[2].Connect(switchHead); raspberry.DigitalOutputs[5].Connect(switchDrawer1); raspberry.DigitalOutputs[6].Connect(switchDrawer2); raspberry.DigitalOutputs[3].Connect(switchPopEyes); raspberry.DigitalOutputs[4].Connect(switchPopUp); raspberry.Connect(audioPlayer); }
//public static BindableProperty nameProperty = BindableProperty.Create<CustomSwitchCell, Thickness>(d => d.Padding, default(Thickness)); //public static BindableProperty toggleProperty = BindableProperty.Create<CustomSwitchCell, Thickness>(d => d.Padding, default(Thickness)); public CustomSwitchCell() { var stack = new StackLayout() { Orientation = StackOrientation.Horizontal, Padding = new Thickness(30, 0, 30, 5), Spacing = 0 }; var NameLabel = new Label(); NameLabel.HorizontalOptions = LayoutOptions.FillAndExpand; NameLabel.VerticalOptions = LayoutOptions.CenterAndExpand; NameLabel.FontSize = Device.GetNamedSize(NamedSize.Default, typeof(Label)); NameLabel.LineBreakMode = LineBreakMode.NoWrap; NameLabel.TextColor = Color.Black; NameLabel.SetBinding(Label.TextProperty, "Name"); stack.Children.Add(NameLabel); var ToggleSwitch = new Switch(); ToggleSwitch.HorizontalOptions = LayoutOptions.End; ToggleSwitch.VerticalOptions = LayoutOptions.CenterAndExpand; ToggleSwitch.SetBinding(Switch.IsToggledProperty, "IsSelected"); stack.Children.Add(ToggleSwitch); View = stack; }
public NightFever() { for (int i = 0; i < MaxPlayers; i++) { Players[i] = new Player(); } /* Lamp Definitions */ Lamps[0] = new Lamp("Player 1 Lamp", FEZ_Pin.Digital.LED); Lamps[1] = new Lamp("Player 2 Lamp", FEZ_Pin.Digital.Di50); /* Relay Definitions */ Relays[0] = new Relay("Knocker",0); Relays[1] = new Relay("Locked Ball Eject",1); Relays[2] = new Relay("Ball Return",2); Relays[3] = new Relay("Left Bank Reset",3); Relays[4] = new Relay("Right Bank Reset", 4); /* Switch Definitions */ Switches[0] = new Switch("Ball Detect", FEZ_Pin.Interrupt.LDR, "","", Port.InterruptMode.InterruptEdgeBoth); Switches[1] = new Switch("Outer Left Drain", FEZ_Pin.Interrupt.Di43, "", "", Port.InterruptMode.InterruptEdgeLow); Switches[2] = new Switch("Left Coin Insert", FEZ_Pin.Interrupt.Di7, "ADDCREDIT 1:PLAYSOUND CreditSound.wav", "", Port.InterruptMode.InterruptEdgeLow); Switches[3] = new Switch("Right Coin Insert", FEZ_Pin.Interrupt.Di38, "ADDCREDIT 2:PLAYSOUND CreditSound.wav", "", Port.InterruptMode.InterruptEdgeLow); Switches[4] = new Switch("Credit Button", FEZ_Pin.Interrupt.Di35, "ADDCREDIT 1:PLAYSOUND CreditSound.wav", "", Port.InterruptMode.InterruptEdgeLow); Switches[5] = new Switch("Start Button", FEZ_Pin.Interrupt.Di30, "", "", Port.InterruptMode.InterruptEdgeLow); }
/// <summary> /// Creates the bonuses, obstacles and power ups contained in a level. /// </summary> /// <param name="interactiveEntityDescriptions">A list of interactive entity descriptions.</param> /// <param name="physicsWorld">The physics world to create the entities in.</param> /// <param name="interactiveEntities">An empty list to store the interactive entities in.</param> /// <param name="mineCart">The mine cart entity.</param> /// <param name="cartSwitch">The switch entity.</param> /// <param name="spriteBatch">The sprite batch to use for rendering.</param> /// <param name="contentManager">The game's content manager.</param> public static void CreateInteractiveEntities(List<InteractiveEntityDescription> interactiveEntityDescriptions, ref World physicsWorld, ref List<InteractiveEntity> interactiveEntities, ref MineCart mineCart, ref Switch cartSwitch, SpriteBatch spriteBatch, ContentManager contentManager) { if (interactiveEntities.Count == 0) { foreach (InteractiveEntityDescription description in interactiveEntityDescriptions) { if (EntityConstants.PowerUpNames.Contains(description.Name)) { interactiveEntities.Add(new PowerUp(ref physicsWorld, spriteBatch, contentManager, description, EntitySettingsLoader.GetPowerUpSettings(description.Name))); } else if (EntityConstants.BonusNames.Contains(description.Name) || EntityConstants.ObstacleNames.Contains(description.Name)) { interactiveEntities.Add(new BonusOrObstacle(ref physicsWorld, spriteBatch, contentManager, description, EntitySettingsLoader.GetObstacleOrBonusSetting(description.Name))); } else if (description.Name == EntityConstants.CartBody) { mineCart = new MineCart(spriteBatch, contentManager, ref physicsWorld, description.Position, 100.0f, 240.0f, 350.0f, 80.0f, -80.0f); } else if (description.Name == EntityConstants.Switch) { cartSwitch = new Switch(spriteBatch, contentManager, ref physicsWorld, description.Position, mineCart); } } } }
public PuzzelDoor(Vector2 position, Switch newDoorSwitch, Point newRoom ) : base(Assets.switchDoor,position) { doorSwitch = newDoorSwitch; room = newRoom; hitTest = new Rectangle((int)position.X,(int)position.Y, 16, 16); isVisible = true; }
private void btnOK_Click(object sender, EventArgs e) { Switch s = new Switch(); s.Name = txtName.Text; Editor.Instance.curGame.MySwitch.Add(s); Editor.Instance.viewSwitch.RefreshDatabase(); }
protected virtual void OnTriggerEnter( Collider other ) { base.OnTriggerEnter( other ); if (other.gameObject.name == "Switch" ) { activeSwitch = other.GetComponent<Switch>(); GameState.Instance.ShowPrompt( "Press E to pull lever" ); } }
public static List<VALIDACION_CAMPO> obtenerReglaValidacion(int grupoValidacion, int campo) { using (Switch contexto = new Switch()) { contexto.VALIDACION_CAMPO.MergeOption = MergeOption.NoTracking; return contexto.VALIDACION_CAMPO.Include("CAMPO").Include("CAMPO.MENSAJE").Include("CAMPO.MENSAJE.GRUPO_MENSAJE").Include("GRUPO_VALIDACION").Where(o => o.GRUPO_VALIDACION.GRV_CODIGO == grupoValidacion && o.CAMPO.CAM_CODIGO == campo).Distinct().ToList<VALIDACION_CAMPO>(); } }
public Board() { Switches = new Switch[5]; Warehouses = new Warehouse[3]; OccupiedTracks = new List<BaseTrack>(); RandomGenerator = new Random(); Ship = new Ship(); }
private void InitializeComponent() { this.LoadFromXaml(typeof(EmployeeXaml)); PersonName = this.FindByName<Label>("PersonName"); PersonImage = this.FindByName<Image>("PersonImage"); favoriteLabel = this.FindByName<Label>("favoriteLabel"); favoriteSwitch = this.FindByName<Switch>("favoriteSwitch"); listView = this.FindByName<ListView>("listView"); }
static void Main(string[] args) { Switch _switch = new Switch(); _switch.GetValue(); _switch.WatchMovie(); Console.ReadLine(); }
public TodoItemPage () { //this.SetBinding (ContentPage.TitleProperty, "Name"); this.Title = "Add Todo item"; NavigationPage.SetHasNavigationBar (this, true); var nameLabel = new Label { Text = "Name" }; var nameEntry = new Entry (); nameEntry.SetBinding (Entry.TextProperty, "Name"); var notesLabel = new Label { Text = "Notes" }; var notesEntry = new Entry (); notesEntry.SetBinding (Entry.TextProperty, "Notes"); var doneLabel = new Label { Text = "Done" }; var doneEntry = new Switch (); doneEntry.SetBinding (Switch.IsToggledProperty, "Done"); var saveButton = new Button { Text = "Save" }; saveButton.Clicked += (sender, e) => { var todoItem = (TodoItem)BindingContext; App.Database.SaveItem(todoItem); this.Navigation.PopAsync(); }; var deleteButton = new Button { Text = "Delete" }; deleteButton.Clicked += (sender, e) => { var todoItem = (TodoItem)BindingContext; App.Database.DeleteItem(todoItem.ID); this.Navigation.PopAsync(); }; var cancelButton = new Button { Text = "Cancel" }; cancelButton.Clicked += (sender, e) => { var todoItem = (TodoItem)BindingContext; this.Navigation.PopAsync(); }; var speakButton = new Button { Text = "Speak" }; speakButton.Clicked += (sender, e) => { var todoItem = (TodoItem)BindingContext; DependencyService.Get<ITextToSpeech>().Speak(todoItem.Name + " " + todoItem.Notes); }; Content = new StackLayout { VerticalOptions = LayoutOptions.StartAndExpand, Padding = new Thickness(20), Children = { nameLabel, nameEntry, notesLabel, notesEntry, doneLabel, doneEntry, saveButton, deleteButton, cancelButton, speakButton } }; }
public override void Apply(Switch sw) { ((Analysis)sw).CaseTLparen(this); }
private async void OnToggleSensorSection(object sender, CompoundButton.CheckedChangeEventArgs e) { if (!Model.Instance.Connected) { return; } EnsureSensorsCreated(); Switch sw = (Switch)sender; TableLayout table = mSensorMap[sw]; if (e.IsChecked) { table.Visibility = ViewStates.Visible; if (table == mTableAccelerometer) { mRadioGroupAccelerometer.Enabled = false; SetChildrenEnabled(mRadioGroupAccelerometer, false); } else if (table == mTableGyro) { mRadioGroupGyro.Enabled = false; SetChildrenEnabled(mRadioGroupGyro, false); } // Turn on the appropriate sensor try { if (sw == mSwitchAccelerometer) { SampleRate rate; if (mRadioAcc16.Checked) { rate = SampleRate.Ms16; } else if (mRadioAcc32.Checked) { rate = SampleRate.Ms32; } else { rate = SampleRate.Ms128; } mTextAccX.Text = ""; mTextAccY.Text = ""; mTextAccZ.Text = ""; accelerometerSensor.StartReadings(rate); } else if (sw == mSwitchGyro) { SampleRate rate; if (mRadioGyro16.Checked) { rate = SampleRate.Ms16; } else if (mRadioGyro32.Checked) { rate = SampleRate.Ms32; } else { rate = SampleRate.Ms128; } mTextGyroAccX.Text = ""; mTextGyroAccY.Text = ""; mTextGyroAccZ.Text = ""; mTextGyroAngX.Text = ""; mTextGyroAngY.Text = ""; mTextGyroAngZ.Text = ""; gyroscopeSensor.StartReadings(rate); } else if (sw == mSwitchDistance) { mTextTotalDistance.Text = ""; mTextSpeed.Text = ""; mTextPace.Text = ""; mTextPedometerMode.Text = ""; distanceSensor.StartReadings(); } else if (sw == mSwitchHeartRate) { var sensorMngr = Model.Instance.Client.SensorManager; if (await sensorMngr.RequestHeartRateConsentTaskAsync(Activity)) { mTextHeartRate.Text = ""; mTextHeartRateQuality.Text = ""; heartRateSensor.StartReadings(); } else { Util.ShowExceptionAlert(Activity, "Start heart rate sensor", new Exception("User declined permission.")); mSwitchHeartRate.Checked = false; } } else if (sw == mSwitchContact) { mTextContact.Text = ""; contactSensor.StartReadings(); } else if (sw == mSwitchSkinTemperature) { mTextSkinTemperature.Text = ""; skinTemperatureSensor.StartReadings(); } else if (sw == mSwitchUltraviolet) { mTextUltraviolet.Text = ""; uvSensor.StartReadings(); } else if (sw == mSwitchPedometer) { mTextTotalSteps.Text = ""; pedometerSensor.StartReadings(); } else if (sw == mSwitchAltimeter) { mTextFlightsAscended.Text = ""; mTextFlightsDescended.Text = ""; mTextRate.Text = ""; mTextSteppingGain.Text = ""; mTextSteppingLoss.Text = ""; mTextStepsAscended.Text = ""; mTextStepsDescended.Text = ""; mTextTotalGain.Text = ""; mTextTotalLoss.Text = ""; altimeterSensor.StartReadings(); } else if (sw == mSwitchAmbientLight) { mTextBrightness.Text = ""; ambientLightSensor.StartReadings(); } else if (sw == mSwitchBarometer) { mTextAirPressure.Text = ""; mTextTemperature.Text = ""; barometerSensor.StartReadings(); } else if (sw == mSwitchCalories) { mTextCalories.Text = ""; caloriesSensor.StartReadings(); } else if (sw == mSwitchGsr) { mTextResistance.Text = ""; gsrSensor.StartReadings(); } else if (sw == mSwitchRRInterval) { var sensorMngr = Model.Instance.Client.SensorManager; if (await sensorMngr.RequestHeartRateConsentTaskAsync(Activity)) { mTextInterval.Text = ""; rrIntervalSensor.StartReadings(); } else { Util.ShowExceptionAlert(Activity, "Start rr interval sensor", new Exception("User declined permission.")); mSwitchRRInterval.Checked = false; } } } catch (BandException ex) { Util.ShowExceptionAlert(Activity, "Register sensor listener", ex); } } else { table.Visibility = ViewStates.Gone; if (table == mTableAccelerometer) { mRadioGroupAccelerometer.Enabled = true; SetChildrenEnabled(mRadioGroupAccelerometer, true); } else if (table == mTableGyro) { mRadioGroupGyro.Enabled = true; SetChildrenEnabled(mRadioGroupGyro, true); } // Turn off the appropriate sensor try { if (sw == mSwitchAccelerometer) { accelerometerSensor.StopReadings(); } else if (sw == mSwitchGyro) { gyroscopeSensor.StopReadings(); } else if (sw == mSwitchDistance) { distanceSensor.StopReadings(); } else if (sw == mSwitchHeartRate) { heartRateSensor.StopReadings(); } else if (sw == mSwitchContact) { contactSensor.StopReadings(); } else if (sw == mSwitchSkinTemperature) { skinTemperatureSensor.StopReadings(); } else if (sw == mSwitchUltraviolet) { uvSensor.StopReadings(); } else if (sw == mSwitchPedometer) { pedometerSensor.StopReadings(); } else if (sw == mSwitchAltimeter) { altimeterSensor.StopReadings(); } else if (sw == mSwitchAmbientLight) { ambientLightSensor.StopReadings(); } else if (sw == mSwitchBarometer) { barometerSensor.StopReadings(); } else if (sw == mSwitchCalories) { caloriesSensor.StopReadings(); } else if (sw == mSwitchGsr) { gsrSensor.StopReadings(); } else if (sw == mSwitchRRInterval) { rrIntervalSensor.StopReadings(); } } catch (BandException ex) { Util.ShowExceptionAlert(Activity, "Unregister sensor listener", ex); } } }
public override void Apply(Switch sw) { ((Analysis)sw).CaseTSubtract(this); }
public override void Apply(Switch sw) { ((Analysis)sw).CaseTString(this); }
public override void Apply(Switch sw) { ((Analysis)sw).CaseTLessequals(this); }
public AccountLoginPage() { Title = AppResources.Login_title; emailEntry = new Entry { Placeholder = AppResources.CreateAcc_emailTemp, Keyboard = Keyboard.Email }; if (App.user != null && string.IsNullOrWhiteSpace(App.user.Email)) { emailEntry.Text = App.user.Email; } passwordEntry = new Entry { Placeholder = AppResources.CreateAcc_passwordTemp, IsPassword = true }; Button readPrivacyPolicy = new Button { Text = AppResources.CreateAcc_btn_privacy }; readPrivacyPolicy.Clicked += ReadPrivacyPolicy_Clicked; Button readTerms = new Button { Text = AppResources.CreateAcc_btn_terms }; readTerms.Clicked += ReadTerms_Clicked;; StackLayout agreeLayout = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, }; agreeSwitch = new Switch { IsToggled = false, VerticalOptions = LayoutOptions.Start, HorizontalOptions = LayoutOptions.End }; agreeLayout.Children.Add(new Label { Text = AppResources.CreateAcc_termsPrivacyCheck, FontSize = 15, HorizontalOptions = LayoutOptions.StartAndExpand }); agreeLayout.Children.Add(agreeSwitch); Button submit = new Button { Text = AppResources.Login_btn_login }; submit.Clicked += Submit_Clicked; Content = new StackLayout { Children = { new Label { Text = AppResources.CreateAcc_email }, emailEntry, new Label { Text = AppResources.CreateAcc_password }, passwordEntry, readPrivacyPolicy, readTerms, agreeLayout, submit }, Spacing = 15, Padding = new Thickness(20, 20) }; }
public void Include(Switch switchControl) { switchControl.CheckedChange += (sender, args) => switchControl.Checked = !switchControl.Checked; }
private void CreateLayout() { // Create a new vertical layout for the app LinearLayout layout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Heading TextView headingLabel = new TextView(this) { Text = "Heading:" }; _headingSlider = new SeekBar(this) { Max = 360 }; layout.AddView(headingLabel); layout.AddView(_headingSlider); // Pitch TextView pitchLabel = new TextView(this) { Text = "Pitch:" }; _pitchSlider = new SeekBar(this) { Max = 180, Progress = 60 }; layout.AddView(pitchLabel); layout.AddView(_pitchSlider); // Horizontal Angle TextView horizontalAngleLabel = new TextView(this) { Text = "Horizontal Angle:" }; _horizontalAngleSlider = new SeekBar(this) { Max = 120, Progress = 75 }; layout.AddView(horizontalAngleLabel); layout.AddView(_horizontalAngleSlider); // Vertical Angle TextView verticalAngleLabel = new TextView(this) { Text = "Vertical Angle:" }; _verticalAngleSlider = new SeekBar(this) { Max = 120, Progress = 90 }; layout.AddView(verticalAngleLabel); layout.AddView(_verticalAngleSlider); // Minimum Distance TextView minimumDistanceLabel = new TextView(this) { Text = "Minimum Distance:" }; _minimumDistanceSlider = new SeekBar(this) { Max = 8994 }; layout.AddView(minimumDistanceLabel); layout.AddView(_minimumDistanceSlider); layout.SetHorizontalGravity(GravityFlags.FillHorizontal); // Maximum Distance TextView maximumDistanceLabel = new TextView(this) { Text = "Maximum Distance:" }; _maximumDistanceSlider = new SeekBar(this) { Max = 9999, Progress = 1500 }; layout.AddView(maximumDistanceLabel); layout.AddView(_maximumDistanceSlider); // Analysis Visibility TextView analysisVisibilityLabel = new TextView(this) { Text = "Analysis Visibility:" }; _analysisVisibilitySwitch = new Switch(this) { Checked = true }; layout.AddView(analysisVisibilityLabel); layout.AddView(_analysisVisibilitySwitch); // Frustum Visibility TextView frustumVisibilityLabel = new TextView(this) { Text = "Frustum Visibility:" }; _frustumVisibilitySwitch = new Switch(this) { Checked = false }; layout.AddView(frustumVisibilityLabel); layout.AddView(_frustumVisibilitySwitch); // Add the scene view to the layout _mySceneView = new SceneView(this); layout.AddView(_mySceneView); // Show the layout in the app SetContentView(layout); // Subscribe to events _headingSlider.ProgressChanged += HandleSettingsChange; _pitchSlider.ProgressChanged += HandleSettingsChange; _horizontalAngleSlider.ProgressChanged += HandleSettingsChange; _verticalAngleSlider.ProgressChanged += HandleSettingsChange; _minimumDistanceSlider.ProgressChanged += HandleSettingsChange; _maximumDistanceSlider.ProgressChanged += HandleSettingsChange; _analysisVisibilitySwitch.Click += HandleSettingsChange; _frustumVisibilitySwitch.Click += HandleSettingsChange; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.RideInformatioin); //pickup location m_txtPickupLocation = (TextView)FindViewById(Resource.Id.txtPickupLocation); m_txtPickupLocation.Touch += PopupPickupLocation; m_txtPickupLocation.SetBinding( () => Facade.Instance.CurrentRide.PickUpLocation, () => m_txtPickupLocation.Text, BindingMode.TwoWay) .UpdateSourceTrigger("DropOffLocationChanges"); //dropoff location m_txtDropoffLocation = (TextView)FindViewById(Resource.Id.txtDropoffLocation); m_txtDropoffLocation.Touch += PopupDropoffLocation; m_txtDropoffLocation.SetBinding( () => Facade.Instance.CurrentRide.DropOffLocation, () => m_txtDropoffLocation.Text, BindingMode.TwoWay) .UpdateSourceTrigger("DropOffLocationChanges"); //passengers or hours m_switchPH = (Switch)FindViewById(Resource.Id.switchPorH); m_switchPH.CheckedChange += delegate(object sender, CompoundButton.CheckedChangeEventArgs e) { Facade.Instance.CurrentRide.ReservationType = e.IsChecked; m_spinnerHours.Enabled = e.IsChecked; GetFares(); }; //number of passengers/hours m_spinnerPassengers = (Spinner)FindViewById(Resource.Id.spPassengers); m_spinnerHours = (Spinner)FindViewById(Resource.Id.spHours); var adapter = new ArrayAdapter(this, global::Android.Resource.Layout.SimpleSpinnerItem); m_spinnerPassengers.Adapter = adapter; m_spinnerHours.Adapter = adapter; for (var i = 1; i <= 100; i++) { adapter.Add(i); } m_spinnerPassengers.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnPassengerChanged); m_spinnerHours.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(OnHourChanged); //upto of vehicle m_rgUpto = (RadioGroup)FindViewById(Resource.Id.rgUpto); m_rgUpto.CheckedChange += (s, e) => { var indexView = m_rgUpto.FindViewById(e.CheckedId); var selectedIndex = m_rgUpto.IndexOfChild(indexView); m_selectedRideTypeValue = selectedIndex; SetFare(); }; //type of vehicle m_rgVehicle = (RadioGroup)FindViewById(Resource.Id.rgVehicle); m_rgVehicle.CheckedChange += (s, e) => { var indexView = m_rgVehicle.FindViewById(e.CheckedId); var selectedIndex = m_rgVehicle.IndexOfChild(indexView); SetRideType(selectedIndex); }; m_txtComment = (TextView)FindViewById(Resource.Id.txtComment); m_txtComment.Text = "Complete all fields above"; var btnGotoLocation = (Button)FindViewById(Resource.Id.btn_GoToLocation); btnGotoLocation.SetCommand("Click", Facade.Instance.CurrentRide.GoToTheFlightInformation); var btnBack = (ImageButton)FindViewById(Resource.Id.btn_back); btnBack.Click += delegate(object sender, EventArgs e) { OnBack(); }; if (IsFirstTime) { IsFirstTime = false; SetBindingsOnce(); } GetFares(); }
void SetContent(FlowDirection direction) { var hOptions = LayoutOptions.Start; var imageCell = new DataTemplate(typeof(ImageCell)); imageCell.SetBinding(ImageCell.ImageSourceProperty, "."); imageCell.SetBinding(ImageCell.TextProperty, "."); var textCell = new DataTemplate(typeof(TextCell)); textCell.SetBinding(TextCell.DetailProperty, "."); var entryCell = new DataTemplate(typeof(EntryCell)); entryCell.SetBinding(EntryCell.TextProperty, "."); var switchCell = new DataTemplate(typeof(SwitchCell)); switchCell.SetBinding(SwitchCell.OnProperty, "."); switchCell.SetValue(SwitchCell.TextProperty, "Switch Cell!"); var vc = new ViewCell { View = new StackLayout { Children = { new Label { HorizontalOptions = hOptions, Text = "View Cell! I have context actions." } } } }; var a1 = new MenuItem { Text = "First" }; vc.ContextActions.Add(a1); var a2 = new MenuItem { Text = "Second" }; vc.ContextActions.Add(a2); var viewCell = new DataTemplate(() => vc); var relayout = new Switch { IsToggled = true, HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center }; var flipButton = new Button { Text = direction == FlowDirection.RightToLeft ? "Switch to Left To Right" : "Switch to Right To Left", HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Center }; flipButton.Clicked += (s, e) => { FlowDirection newDirection; if (direction == FlowDirection.LeftToRight || direction == FlowDirection.MatchParent) { newDirection = FlowDirection.RightToLeft; } else { newDirection = FlowDirection.LeftToRight; } if (relayout.IsToggled) { ParentPage.FlowDirection = newDirection; direction = newDirection; flipButton.Text = direction == FlowDirection.RightToLeft ? "Switch to Left To Right" : "Switch to Right To Left"; return; } if (ParentPage == this) { FlowDirectionGalleryLandingPage.PushContentPage(newDirection); return; } string parentType = ParentPage.GetType().ToString(); switch (parentType) { case "Microsoft.Maui.Controls.Compatibility.ControlGallery.FlowDirectionGalleryMDP": FlowDirectionGalleryLandingPage.PushFlyoutPage(newDirection); break; case "Microsoft.Maui.Controls.Compatibility.ControlGallery.FlowDirectionGalleryCarP": FlowDirectionGalleryLandingPage.PushCarouselPage(newDirection); break; case "Microsoft.Maui.Controls.Compatibility.ControlGallery.FlowDirectionGalleryNP": FlowDirectionGalleryLandingPage.PushNavigationPage(newDirection); break; case "Microsoft.Maui.Controls.Compatibility.ControlGallery.FlowDirectionGalleryTP": FlowDirectionGalleryLandingPage.PushTabbedPage(newDirection); break; } }; var horStack = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { flipButton, new Label { Text = "Relayout", HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center }, relayout } }; var grid = new Grid { ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, }, RowDefinitions = { new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }, new RowDefinition { Height = new GridLength(100, GridUnitType.Absolute) }, } }; int col = 0; int row = 0; var ai = AddView <ActivityIndicator>(grid, ref col, ref row); ai.IsRunning = true; var box = AddView <BoxView>(grid, ref col, ref row); box.WidthRequest = box.HeightRequest = 20; box.BackgroundColor = Color.Purple; var btn = AddView <Button>(grid, ref col, ref row); btn.Text = "Some text"; var date = AddView <DatePicker>(grid, ref col, ref row, 2); var edit = AddView <Editor>(grid, ref col, ref row); edit.WidthRequest = 100; edit.HeightRequest = 100; edit.Text = "Some longer text for wrapping"; var entry = AddView <Entry>(grid, ref col, ref row); entry.WidthRequest = 100; entry.Text = "Some text"; var image = AddView <Image>(grid, ref col, ref row); image.Source = "oasis.jpg"; var lbl1 = AddView <Label>(grid, ref col, ref row); lbl1.WidthRequest = 100; lbl1.HorizontalTextAlignment = TextAlignment.Start; lbl1.Text = "Start text"; var lblLong = AddView <Label>(grid, ref col, ref row); lblLong.WidthRequest = 100; lblLong.HorizontalTextAlignment = TextAlignment.Start; lblLong.Text = "Start text that should wrap and wrap and wrap"; var lbl2 = AddView <Label>(grid, ref col, ref row); lbl2.WidthRequest = 100; lbl2.HorizontalTextAlignment = TextAlignment.End; lbl2.Text = "End text"; var lbl3 = AddView <Label>(grid, ref col, ref row); lbl3.WidthRequest = 100; lbl3.HorizontalTextAlignment = TextAlignment.Center; lbl3.Text = "Center text"; //var ogv = AddView<OpenGLView>(grid, ref col, ref row, hOptions, vOptions, margin); var pkr = AddView <Picker>(grid, ref col, ref row); pkr.ItemsSource = Enumerable.Range(0, 10).ToList(); var sld = AddView <Slider>(grid, ref col, ref row); sld.WidthRequest = 100; sld.Maximum = 10; Device.StartTimer(TimeSpan.FromSeconds(1), () => { sld.Value += 1; if (sld.Value == 10d) { sld.Value = 0; } return(true); }); var stp = AddView <Stepper>(grid, ref col, ref row); var swt = AddView <Switch>(grid, ref col, ref row); var time = AddView <TimePicker>(grid, ref col, ref row, 2); var prog = AddView <ProgressBar>(grid, ref col, ref row, 2); prog.WidthRequest = 200; prog.BackgroundColor = Color.DarkGray; Device.StartTimer(TimeSpan.FromSeconds(1), () => { prog.Progress += .1; if (prog.Progress == 1d) { prog.Progress = 0; } return(true); }); var srch = AddView <SearchBar>(grid, ref col, ref row, 2); srch.WidthRequest = 200; srch.Text = "Some text"; TableView tbl = new TableView { Intent = TableIntent.Menu, Root = new TableRoot { new TableSection("TableView") { new TextCell { Text = "A", }, new TextCell { Text = "B", }, new TextCell { Text = "C", }, new TextCell { Text = "D", }, } } }; var stack = new StackLayout { Children = { new Button { Text = "Go back to Gallery home", Command = new Command(() =>{ ((App)Application.Current).SetMainPage(((App)Application.Current).CreateDefaultMainPage()); }) }, new Label { Text = $"Device Direction: {DeviceDirection}" }, horStack, grid, new Label { Text = "TableView", FontSize = 10, TextColor = Color.DarkGray }, tbl, new Label { Text = "ListView w/ TextCell", FontSize = 10, TextColor = Color.DarkGray }, new ListView { HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "Text Cell!"), ItemTemplate = textCell }, new Label { Text = "ListView w/ SwitchCell", FontSize = 10, TextColor = Color.DarkGray }, new ListView { HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => true), ItemTemplate = switchCell }, new Label { Text = "ListView w/ EntryCell", FontSize = 10, TextColor = Color.DarkGray }, new ListView { HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "Entry Cell!"), ItemTemplate = entryCell }, new Label { Text = "ListView w/ ImageCell", FontSize = 10, TextColor = Color.DarkGray }, new ListView { HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3).Select(c => "coffee.png"), ItemTemplate = imageCell }, new Label { Text = "ListView w/ ViewCell", FontSize = 10, TextColor = Color.DarkGray }, new ListView { HorizontalOptions = hOptions, ItemsSource = Enumerable.Range(0, 3), ItemTemplate = viewCell }, }, HorizontalOptions = hOptions }; Content = new ScrollView { Content = stack }; }
private void CreateLayout() { // View for the input/output wkid labels. LinearLayout wkidLabelsStackView = new LinearLayout(this) { Orientation = Orientation.Horizontal }; wkidLabelsStackView.SetPadding(10, 10, 0, 10); // Create a label for the input spatial reference. _inWkidLabel = new TextView(this) { Text = "In WKID = ", TextAlignment = TextAlignment.ViewStart }; // Create a label for the output spatial reference. _outWkidLabel = new TextView(this) { Text = "Out WKID = ", TextAlignment = TextAlignment.ViewStart }; // Create some horizontal space between the labels. Space space = new Space(this); space.SetMinimumWidth(30); // Add the Wkid labels to the stack view. wkidLabelsStackView.AddView(_inWkidLabel); wkidLabelsStackView.AddView(space); wkidLabelsStackView.AddView(_outWkidLabel); // Create the 'use extent' switch. _useExtentSwitch = new Switch(this) { Checked = false, Text = "Use extent" }; // Handle the checked change event for the switch. _useExtentSwitch.CheckedChange += UseExtentSwitch_CheckedChange; // Create a picker (Spinner) for datum transformations. _transformationsPicker = new Spinner(this); _transformationsPicker.SetPadding(5, 10, 0, 10); // Handle the selection event to work with the selected transformation. _transformationsPicker.ItemSelected += TransformationsPicker_ItemSelected; // Create a text view to show messages. _messagesTextView = new TextView(this); // Create a new vertical layout for the app UI. LinearLayout mainLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // Create a layout for the app tools. LinearLayout toolsLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; toolsLayout.SetPadding(10, 0, 0, 0); toolsLayout.SetMinimumHeight(320); // Add the transformation UI controls to the tools layout. toolsLayout.AddView(wkidLabelsStackView); toolsLayout.AddView(_useExtentSwitch); toolsLayout.AddView(_transformationsPicker); toolsLayout.AddView(_messagesTextView); // Add the tools layout and map view to the main layout. mainLayout.AddView(toolsLayout); mainLayout.AddView(_myMapView); // Show the layout in the app. SetContentView(mainLayout); }
public abstract void Apply(Switch s);
protected override void Init() { var layout = new StackLayout(); var button = new Button { Text = "Click" }; var tablesection = new TableSection { Title = "Switches" }; var tableview = new TableView { Intent = TableIntent.Form, Root = new TableRoot { tablesection } }; var viewcell1 = new ViewCell { View = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Switch 1", HorizontalOptions = LayoutOptions.StartAndExpand }, new Switch { AutomationId = "switch1", HorizontalOptions = LayoutOptions.End, IsToggled = true } } } }; var viewcell2 = new ViewCell { View = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Children = { new Label { Text = "Switch 2", HorizontalOptions = LayoutOptions.StartAndExpand }, new Switch { AutomationId = "switch2", HorizontalOptions = LayoutOptions.End, IsToggled = true } } } }; Label label = new Label { Text = "Switch 3", HorizontalOptions = LayoutOptions.StartAndExpand }; Switch switchie = new Switch { AutomationId = "switch3", HorizontalOptions = LayoutOptions.End, IsToggled = true, IsEnabled = false }; switchie.Toggled += (sender, e) => { label.Text = "FAIL"; }; var viewcell3 = new ViewCell { View = new StackLayout { HorizontalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Horizontal, Children = { label, switchie, } } }; tablesection.Add(viewcell1); tablesection.Add(viewcell2); tablesection.Add(viewcell3); button.Clicked += (sender, e) => { if (_removed) { tablesection.Insert(1, viewcell2); } else { tablesection.Remove(viewcell2); } _removed = !_removed; }; layout.Children.Add(button); layout.Children.Add(tableview); Content = layout; }
public void SwitchInitialises() { string s = "abc"; Assert.IsNotNull(Switch <string> .On(s)); }
public override void Apply(Switch sw) { ((Analysis)sw).CaseEOF(this); }
public void Include(Switch @switch) { @switch.CheckedChange += (sender, args) => @switch.Checked = [email protected]; }
public override void Apply(Switch sw) { ((Analysis)sw).CaseTComment(this); }
public override void Apply(Switch sw) { ((Analysis)sw).CaseTNegative(this); }
public void TurnHandSwitchListener(Collider collider) { Switch sw = collider.transform.parent.gameObject.GetComponent <Switch> (); sw.SetSwitchDirection(Switch.SwitchDir.Change); }
public MacOSTestGallery() { mainDemoStack.Children.Add(MakeNewStackLayout()); var items = new List <MyItem1>(); for (int i = 0; i < 5000; i++) { items.Add(new MyItem1 { Reference = "Hello this is a big text " + i.ToString(), ShowButton = i % 2 == 0, Image = "bank.png" }); } var header = new Label { Text = "HELLO HEADER ", FontSize = 40, BackgroundColor = Color.Pink }; var lst4 = new ListView { Header = header, ItemTemplate = new DataTemplate(typeof(DemoViewCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; var lst = new ListView { ItemTemplate = new DataTemplate(typeof(DemoEntryCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; var lst1 = new ListView { ItemTemplate = new DataTemplate(typeof(DemoTextCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; var lst2 = new ListView { ItemTemplate = new DataTemplate(typeof(DemoSwitchCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; var lst3 = new ListView { ItemTemplate = new DataTemplate(typeof(DemoImageCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; var bigbUtton = new Button { WidthRequest = 200, HeightRequest = 300, Image = "bank.png" }; var picker = new DatePicker(); var timePicker = new TimePicker { Format = "T", Time = TimeSpan.FromHours(2) }; var editor = new Editor { Text = "Edit this text on editor", HeightRequest = 100, TextColor = Color.Yellow, BackgroundColor = Color.Gray }; var entry = new Entry { Placeholder = "Edit this text on entry", PlaceholderColor = Color.Pink, TextColor = Color.Yellow, BackgroundColor = Color.Green }; var frame = new Frame { HasShadow = true, BackgroundColor = Color.Maroon, OutlineColor = Color.Lime, MinimumHeightRequest = 100 }; var image = new Image { HeightRequest = 100, Source = "crimson.jpg" }; var picker1 = new Picker { Title = "Select a team player", TextColor = Color.Pink, BackgroundColor = Color.Silver }; picker1.Items.Add("Rui"); picker1.Items.Add("Jason"); picker1.Items.Add("Ez"); picker1.Items.Add("Stephane"); picker1.Items.Add("Samantha"); picker1.Items.Add("Paul"); picker1.SelectedIndex = 1; var progress = new ProgressBar { BackgroundColor = Color.Purple, Progress = 0.5, HeightRequest = 50 }; picker1.SelectedIndexChanged += (sender, e) => { entry.Text = $"Selected {picker1.Items[picker1.SelectedIndex]}"; progress.Progress += 0.1; }; var searchBar = new SearchBar { BackgroundColor = Color.Olive, TextColor = Color.Maroon, CancelButtonColor = Color.Pink }; searchBar.Placeholder = "Please search"; searchBar.PlaceholderColor = Color.Orange; searchBar.SearchButtonPressed += (sender, e) => { searchBar.Text = "Search was pressed"; }; var slider = new Slider { BackgroundColor = Color.Lime, Value = 0.5 }; slider.ValueChanged += (sender, e) => { editor.Text = $"Slider value changed {slider.Value}"; }; var stepper = new Stepper { BackgroundColor = Color.Yellow, Maximum = 100, Minimum = 0, Value = 10, Increment = 0.5 }; stepper.ValueChanged += (sender, e) => { editor.Text = $"Stepper value changed {stepper.Value}"; }; var labal = new Label { Text = "This is a Switch" }; var switchR = new Switch { BackgroundColor = Color.Fuchsia, IsToggled = true }; switchR.Toggled += (sender, e) => { entry.Text = $"switchR is toogle {switchR.IsToggled}"; }; var layoutSwitch = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Green }; layoutSwitch.Children.Add(labal); layoutSwitch.Children.Add(switchR); var webView = new WebView { HeightRequest = 200, Source = "http://google.pt" }; var mainStck = new StackLayout { Spacing = 10, BackgroundColor = Color.Blue, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Children = { lst4, lst, lst1, lst2, lst3, webView, layoutSwitch, stepper, slider, searchBar, progress, picker1, image, frame, entry, editor, picker, timePicker, bigbUtton, new Button { Text = "Click Me", BackgroundColor = Color.Gray }, new Button { Image = "bank.png", BackgroundColor = Color.Gray }, CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Left, 10)), CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Top, 10)), CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Bottom, 10)), CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Right, 10)), mainDemoStack } }; var lbl = new Label { Text = "Second label", TextColor = Color.White, VerticalTextAlignment = TextAlignment.Start, HorizontalTextAlignment = TextAlignment.Center }; mainStck.Children.Add(new Label { Text = "HELLO XAMARIN FORMS MAC", TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center }); mainStck.Children.Add(lbl); mainStck.Children.Add(new BoxView { Color = Color.Pink, HeightRequest = 200 }); var scroller = new ScrollView { BackgroundColor = Color.Yellow, HorizontalOptions = LayoutOptions.Center }; scroller.Scrolled += (sender, e) => { lbl.Text = $"Current postion {scroller.ScrollY}"; }; scroller.Content = mainStck; var actv = new ActivityIndicator { BackgroundColor = Color.White, Color = Color.Fuchsia, IsRunning = true }; mainStck.Children.Add(actv); bigbUtton.Clicked += async(sender, e) => { await scroller.ScrollToAsync(actv, ScrollToPosition.Center, true); actv.Color = Color.Default; }; Content = scroller; }
public void BuildMainPage() { //Main Page Overall Layout defining MainPageOverallLayout = FindViewById <LinearLayout>(Resource.Id.MainPageLayout1); MainPageOverallLayout.Orientation = Orientation.Vertical; MainPageOverallLayout.SetGravity(Android.Views.GravityFlags.CenterHorizontal); BuildCalendar(); //Tile layout MainPageTitleLayout = new LinearLayout(this); MainPageTitleLayout.LayoutParameters = WrapContParams; MainPageTitleLayout.Orientation = Orientation.Vertical; MainPageTitleLayout.SetGravity(Android.Views.GravityFlags.Center); //Title TV MainPageTitleTV = new TextView(this); MainPageTitleTV.LayoutParameters = WrapContParams; MainPageTitleTV.Text = $"Welcome, {admin1.name}"; MainPageTitleTV.TextSize = 55; MainPageTitleTV.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); MainPageTitleTV.SetTextColor(Android.Graphics.Color.DarkRed); //Profile Picture Layout MainPageProfilePictureLayout = new LinearLayout(this); MainPageProfilePictureLayout.LayoutParameters = WrapContParams; MainPageProfilePictureLayout.Orientation = Orientation.Horizontal; MainPageProfilePictureLayout.SetGravity(Android.Views.GravityFlags.Center); //Profile Pic Profile = new ImageView(this); Profile.SetImageBitmap(MyStuff.ConvertStringToBitMap(admin1.ProfilePic)); Profile.SetMaxWidth(250); Profile.SetMinimumHeight(400); Profile.Click += this.Profile_Click; MainPageProfilePictureLayout.AddView(Profile); // Swi = new Switch(this); Swi.SetHeight(15); Swi.SetWidth(70); Swi.Checked = false; Swi.TextOff = "Off"; Swi.TextOn = "On"; Swi.CheckedChange += this.Swi_CheckedChange; MainPageProfilePictureLayout.AddView(Swi); // //Title TV 2 MainPageTitleTV2 = new TextView(this); MainPageTitleTV2.LayoutParameters = WrapContParams; int year = int.Parse(DateTime.Today.Year.ToString()); int month = int.Parse(DateTime.Today.Month.ToString()) + 1; int day = int.Parse(DateTime.Today.Day.ToString()); MainPageTitleTV2.Text = $"You have {abc} trainings on the {MyStuff.MakeDateString(year, month, day)}"; MainPageTitleTV2.TextSize = 25; MainPageTitleTV2.Typeface = Typeface.CreateFromAsset(Assets, "Katanf.ttf"); MainPageTitleTV2.SetTextColor(Color.SaddleBrown); //adding to layouts MainPageTitleLayout.AddView(MainPageTitleTV); MainPageOverallLayout.AddView(MainPageProfilePictureLayout); MainPageTitleLayout.AddView(MainPageTitleTV2); MainPageOverallLayout.AddView(MainPageTitleLayout); //Calendar MainPageOverallLayout.AddView(calendar); OnSelectedDayChange(calendar, int.Parse(DateTime.Today.Year.ToString()), int.Parse(DateTime.Today.Month.ToString()) - 1, int.Parse(DateTime.Today.Day.ToString())); //Button MainPageShowGroupsbtn = new Button(this); MainPageShowGroupsbtn.LayoutParameters = new LinearLayout.LayoutParams(500, 250); MainPageShowGroupsbtn.Text = "Show Groups"; MainPageOverallLayout.AddView(MainPageShowGroupsbtn); MainPageShowGroupsbtn.Click += this.MainPageShowGroupsbtn_Click; }
public static long IpcCall( Switch Device, KProcess Process, MemoryManager Memory, KSession Session, IpcMessage Request, long CmdPtr) { IpcMessage Response = new IpcMessage(); using (MemoryStream Raw = new MemoryStream(Request.RawData)) { BinaryReader ReqReader = new BinaryReader(Raw); if (Request.Type == IpcMessageType.Request || Request.Type == IpcMessageType.RequestWithContext) { Response.Type = IpcMessageType.Response; using (MemoryStream ResMS = new MemoryStream()) { BinaryWriter ResWriter = new BinaryWriter(ResMS); ServiceCtx Context = new ServiceCtx( Device, Process, Memory, Session, Request, Response, ReqReader, ResWriter); Session.Service.CallMethod(Context); Response.RawData = ResMS.ToArray(); } } else if (Request.Type == IpcMessageType.Control || Request.Type == IpcMessageType.ControlWithContext) { long Magic = ReqReader.ReadInt64(); long CmdId = ReqReader.ReadInt64(); switch (CmdId) { case 0: { Request = FillResponse(Response, 0, Session.Service.ConvertToDomain()); break; } case 3: { Request = FillResponse(Response, 0, 0x500); break; } //TODO: Whats the difference between IpcDuplicateSession/Ex? case 2: case 4: { int Unknown = ReqReader.ReadInt32(); if (Process.HandleTable.GenerateHandle(Session, out int Handle) != KernelResult.Success) { throw new InvalidOperationException("Out of handles!"); } Response.HandleDesc = IpcHandleDesc.MakeMove(Handle); Request = FillResponse(Response, 0); break; } default: throw new NotImplementedException(CmdId.ToString()); } } else if (Request.Type == IpcMessageType.CloseSession) { //TODO } else { throw new NotImplementedException(Request.Type.ToString()); } Memory.WriteBytes(CmdPtr, Response.GetBytes(CmdPtr)); } return(0); }
public override void Apply(Switch sw) { ((Analysis)sw).CaseTFunction(this); }
public Issue9694() { Title = "Issue 9694"; var layout = new StackLayout(); var instructions = new Label { BackgroundColor = Colors.Black, TextColor = Colors.White, Text = "If there is no exception, the test has passed." }; var defaultSwitch = new Switch(); var onColorSwitch = new Switch { OnColor = Colors.Orange }; var switchLayout = new StackLayout { Orientation = StackOrientation.Horizontal }; var customSwitch = new Switch { OnColor = _customColor, VerticalOptions = LayoutOptions.Center, Margin = new Thickness(0, 0, 6, 0) }; var updateButton = new Button { VerticalOptions = LayoutOptions.Center, Text = "Update Color" }; var resetButton = new Button { VerticalOptions = LayoutOptions.Center, Text = "Reset Color" }; switchLayout.Children.Add(customSwitch); switchLayout.Children.Add(updateButton); switchLayout.Children.Add(resetButton); layout.Children.Add(instructions); layout.Children.Add(defaultSwitch); layout.Children.Add(onColorSwitch); layout.Children.Add(switchLayout); Content = layout; updateButton.Clicked += (sender, args) => { customSwitch.OnColor = _newCustomColor; }; resetButton.Clicked += (sender, args) => { customSwitch.OnColor = _customColor; }; }
public override void Apply(Switch sw) { ((Analysis)sw).CaseTRbrace(this); }
public PropagateCodeGallery(IItemsLayout itemsLayout, int itemsCount = 2) { Title = $"Propagate FlowDirection=RTL"; var layout = new Grid { RowDefinitions = new RowDefinitionCollection { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Star } }, FlowDirection = FlowDirection.RightToLeft, Visual = VisualMarker.Material }; var itemTemplate = ExampleTemplates.PropagationTemplate(); var emptyView = ExampleTemplates.PropagationTemplate().CreateContent() as View; var collectionView = new CollectionView { ItemsLayout = itemsLayout, ItemTemplate = itemTemplate, EmptyView = emptyView }; var generator = new ItemsSourceGenerator(collectionView, initialItems: itemsCount); layout.Children.Add(generator); var instructions = new Label(); UpdateInstructions(layout, instructions, itemsCount == 0); Grid.SetRow(instructions, 2); layout.Children.Add(instructions); var switchLabel = new Label { Text = "Toggle FlowDirection" }; var switchLayout = new StackLayout { Orientation = StackOrientation.Horizontal }; var updateSwitch = new Switch { }; updateSwitch.Toggled += (sender, args) => { layout.FlowDirection = layout.FlowDirection == FlowDirection.RightToLeft ? FlowDirection.LeftToRight : FlowDirection.RightToLeft; UpdateInstructions(layout, instructions, itemsCount == 0); }; switchLayout.Children.Add(switchLabel); switchLayout.Children.Add(updateSwitch); Grid.SetRow(switchLayout, 1); layout.Children.Add(switchLayout); layout.Children.Add(collectionView); Grid.SetRow(collectionView, 3); Content = layout; generator.GenerateItems(); }
public FlightRequestPage() { Grid grid = new Grid(); InitializeComponent(); search = new Entry(); start = new DatePicker(); end = new DatePicker(); startTime = new TimePicker(); endTime = new TimePicker(); purpose = new Editor(); purpose.HeightRequest = 100; requestor = new Entry(); numPax = new Picker(); rentalCar = new Switch(); specials = new Editor(); specials.HeightRequest = 100; //when a user selects a start date change the return date to match. start.DateSelected += (sender, e) => { end.Date = start.Date; }; for (int i = 1; i <= 8; i++) { numPax.Items.Add(i.ToString()); } RowDefinition row1 = new RowDefinition(); RowDefinition row2 = new RowDefinition(); RowDefinition row3 = new RowDefinition(); RowDefinition row4 = new RowDefinition(); RowDefinition row5 = new RowDefinition(); RowDefinition row6 = new RowDefinition(); RowDefinition row7 = new RowDefinition(); RowDefinition row8 = new RowDefinition(); RowDefinition row9 = new RowDefinition(); RowDefinition row10 = new RowDefinition(); row1.Height = 40; row2.Height = 40; row3.Height = 40; row4.Height = 40; row5.Height = 40; row6.Height = 40; row7.Height = 40; row9.Height = 40; grid.RowDefinitions.Add(row1); grid.RowDefinitions.Add(row2); grid.RowDefinitions.Add(row3); grid.RowDefinitions.Add(row4); grid.RowDefinitions.Add(row5); grid.RowDefinitions.Add(row6); grid.RowDefinitions.Add(row7); grid.RowDefinitions.Add(row8); grid.RowDefinitions.Add(row9); grid.RowDefinitions.Add(row10); start.Format = "ddd MMM dd"; end.Format = "ddd MMM dd"; search.Placeholder = "Search for address..."; search.Focused += Search_Focused; search.HeightRequest = 30; start.HeightRequest = 20; end.HeightRequest = 20; //start.SetValue(); grid.Children.Add(search, 0, 0); grid.Children.Add(new Label { Text = "Departs:", VerticalOptions = LayoutOptions.Center }, 0, 1); grid.Children.Add(start, 1, 1); grid.Children.Add(startTime, 2, 1); grid.Children.Add(new Label { Text = "Returns:", VerticalOptions = LayoutOptions.Center }, 0, 2); grid.Children.Add(end, 1, 2); grid.Children.Add(endTime, 2, 2); grid.Children.Add(new Label { Text = "Requestor:", VerticalOptions = LayoutOptions.Center }, 0, 3); grid.Children.Add(requestor, 1, 3); grid.Children.Add(new Label { Text = "# of Passengers:", VerticalOptions = LayoutOptions.Center }, 0, 4); grid.Children.Add(numPax, 2, 4); grid.Children.Add(new Label { Text = "Rental Car:", VerticalOptions = LayoutOptions.Center }, 0, 5); grid.Children.Add(rentalCar, 2, 5); //Special Requests grid.Children.Add(new Label { Text = "Special Requests (Catering, etc...):", VerticalOptions = LayoutOptions.Center }, 0, 6); StackLayout s1 = new StackLayout(); s1.BackgroundColor = Color.Silver; s1.Padding = 1; s1.Children.Add(specials); grid.Children.Add(s1, 0, 7); //Purpose of trip grid.Children.Add(new Label { Text = "Purpose of Trip:", VerticalOptions = LayoutOptions.Center }, 0, 8); StackLayout s2 = new StackLayout(); s2.BackgroundColor = Color.Silver; s2.Padding = 1; s2.Children.Add(purpose); grid.Children.Add(s2, 0, 9); //set column spans on fields requiring more than 1 Grid.SetColumnSpan(search, 3); Grid.SetColumnSpan(requestor, 2); Grid.SetColumnSpan(s2, 3); Grid.SetColumnSpan(s1, 3); Grid.SetColumnSpan(grid.Children[9], 2); Grid.SetColumnSpan(grid.Children[13], 3); Grid.SetColumnSpan(grid.Children[15], 3); //layout.Children.Add(grid); ScrollView sv = new ScrollView { Orientation = ScrollOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; sv.Content = grid; layout.Children.Add(sv); //Button bar ****************************************************** Button submitFlightRequest = new Button(); Button closePage = new Button { Image = "closePage.png" }; closePage.BackgroundColor = Color.Transparent; submitFlightRequest.BackgroundColor = Color.Transparent; if (Device.OS == TargetPlatform.Android) { submitFlightRequest.Image = "newflight35.png"; submitFlightRequest.HeightRequest = 35; submitFlightRequest.WidthRequest = 35; closePage.HeightRequest = 35; closePage.WidthRequest = 35; closePage.BorderColor = Color.Transparent; submitFlightRequest.BorderColor = Color.Transparent; } else if (Device.OS == TargetPlatform.iOS) { submitFlightRequest.Image = "submit.png"; } submitFlightRequest.Clicked += ProcessRequest; closePage.Clicked += ClosePage_Clicked; buttonbar.Children.Add(closePage, 0, 0); buttonbar.Children.Add(submitFlightRequest, 1, 0); }
private ITag LoadTag(XNode xmlNode, IList <Include> includes) { ITag tag = null; var prepend = xmlNode?.GetAttribute("Prepend")?.Trim(); var property = xmlNode?.GetAttribute("Property")?.Trim(); var compareValue = xmlNode?.GetAttribute("CompareValue")?.Trim(); #region Init Tag switch (xmlNode.GetName()) { case "#text": case "#cdata-section": { var bodyText = " " + xmlNode.GetValue().Replace("\n", "").Trim(); return(new SqlText { LineInfo = XmlLineInfo.Create(xmlNode), BodyText = bodyText }); } case "If": { tag = new IfTag { Test = xmlNode.GetAttribute("Test") }; break; } case "Include": { var refId = xmlNode?.GetAttribute("RefId"); var include_tag = new Include { RefId = refId, Prepend = prepend }; includes.Add(include_tag); tag = include_tag; break; } case "IsEmpty": { tag = new IsEmpty { Prepend = prepend, Property = property, ChildTags = new List <ITag>() }; break; } case "IsEqual": { tag = new IsEqual { Prepend = prepend, Property = property, CompareValue = compareValue, ChildTags = new List <ITag>() }; break; } case "Bind": { tag = new BindTag { Name = xmlNode.GetAttribute("Name"), Value = xmlNode.GetAttribute("Value"), }; break; } case "Trim": { tag = new TrimTag { Prefix = xmlNode.GetAttribute("Prefix"), PrefixOverrides = xmlNode.GetAttribute("PrefixOverrides"), Suffix = xmlNode.GetAttribute("Suffix"), ChildTags = new List <ITag>(), }; break; } case "IsGreaterEqual": { tag = new IsGreaterEqual { Prepend = prepend, Property = property, CompareValue = compareValue, ChildTags = new List <ITag>() }; break; } case "IsGreaterThan": { tag = new IsGreaterThan { Prepend = prepend, Property = property, CompareValue = compareValue, ChildTags = new List <ITag>() }; break; } case "IsLessEqual": { tag = new IsLessEqual { Prepend = prepend, Property = property, CompareValue = compareValue, ChildTags = new List <ITag>() }; break; } case "IsLessThan": { tag = new IsLessThan { Prepend = prepend, Property = property, CompareValue = compareValue, ChildTags = new List <ITag>() }; break; } case "IsNotEmpty": { tag = new IsNotEmpty { Prepend = prepend, Property = property, ChildTags = new List <ITag>() }; break; } case "IsNotEqual": { tag = new IsNotEqual { Prepend = prepend, Property = property, CompareValue = compareValue, ChildTags = new List <ITag>() }; break; } case "IsNotNull": { tag = new IsNotNull { Prepend = prepend, Property = property, ChildTags = new List <ITag>() }; break; } case "IsNull": { tag = new IsNull { Prepend = prepend, Property = property, ChildTags = new List <ITag>() }; break; } case "IsTrue": { tag = new IsTrue { Prepend = prepend, Property = property, ChildTags = new List <ITag>() }; break; } case "IsFalse": { tag = new IsFalse { Prepend = prepend, Property = property, ChildTags = new List <ITag>() }; break; } case "IsProperty": { tag = new IsProperty { Prepend = prepend, Property = property, ChildTags = new List <ITag>() }; break; } case "Placeholder": { tag = new Placeholder { Prepend = prepend, Property = property, ChildTags = new List <ITag>() }; break; } case "Switch": { tag = new Switch { Property = property, Prepend = prepend, ChildTags = new List <ITag>() }; break; } case "Case": { var switchNode = xmlNode.Parent; var switchProperty = xmlNode?.GetAttribute("Property")?.Trim(); var switchPrepend = xmlNode?.GetAttribute("Prepend")?.Trim(); tag = new Switch.Case { CompareValue = compareValue, Property = switchProperty, Prepend = switchPrepend, Test = xmlNode?.GetAttribute("Test")?.Trim(), ChildTags = new List <ITag>() }; break; } case "Default": { var switchNode = xmlNode.Parent; var switchProperty = xmlNode?.GetAttribute("Property")?.Trim(); var switchPrepend = xmlNode?.GetAttribute("Prepend")?.Trim(); tag = new Switch.Defalut { Property = switchProperty, Prepend = switchPrepend, ChildTags = new List <ITag>() }; break; } case "Dynamic": { tag = new Dynamic { Prepend = prepend, ChildTags = new List <ITag>() }; break; } case "Where": { tag = new Where { ChildTags = new List <ITag>() }; break; } case "Set": { tag = new Set { ChildTags = new List <ITag>() }; break; } case "For": { var open = xmlNode?.GetAttribute("Open")?.Trim(); var separator = xmlNode?.GetAttribute("Separator")?.Trim(); var close = xmlNode?.GetAttribute("Close")?.Trim(); var key = xmlNode?.GetAttribute("Key")?.Trim(); var index = xmlNode?.GetAttribute("Index")?.Trim(); tag = new For { Prepend = prepend, Property = property, Open = open, Close = close, Index = index, Separator = separator, Key = key, ChildTags = new List <ITag>() }; break; } case "Env": { var dbProvider = xmlNode?.GetAttribute("DbProvider")?.Trim(); tag = new Env { Prepend = prepend, DbProvider = dbProvider, ChildTags = new List <ITag>() }; break; } case "#comment": { break; } default: { throw new SmartSqlException($"Statement.LoadTag unkonw tagName:{xmlNode.GetName()}."); }; } #endregion if (tag != null) { tag.LineInfo = XmlLineInfo.Create(xmlNode); } if (xmlNode is XElement ell) { foreach (XNode childNode in ell.Nodes()) { ITag childTag = LoadTag(childNode, includes); if (childTag != null && tag != null) { childTag.Parent = tag; (tag as Tag).ChildTags.Add(childTag); } } } return(tag); }
public override View GetPropertyWindowLayout(Android.Content.Context context) { int width = context.Resources.DisplayMetrics.WidthPixels / 2; propertylayout = new LinearLayout(context); propertylayout.Orientation = droid.Vertical; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( width * 2, 5); layoutParams.SetMargins(0, 5, 0, 0); TextView textView1 = new TextView(context); textView1.Text = " " + "TICK PLACEMENT"; textView1.TextSize = 15; textView1.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView1.SetTextColor(Color.White); textView1.Gravity = GravityFlags.Left; TextView textview2 = new TextView(context); textview2.SetHeight(14); propertylayout.AddView(textview2); tickSpinner = new Spinner(context); tickSpinner.SetPadding(0, 0, 0, 0); propertylayout.AddView(textView1); SeparatorView separate = new SeparatorView(context, width * 2); separate.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); propertylayout.AddView(separate, layoutParams); TextView textview8 = new TextView(context); textview8.SetHeight(20); propertylayout.AddView(textview8); propertylayout.AddView(tickSpinner); TextView textview3 = new TextView(context); propertylayout.AddView(textview3); List <String> list = new List <String> (); list.Add("BottomRight"); list.Add("TopLeft"); list.Add("Outside"); list.Add("Inline"); list.Add("None"); dataAdapter = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, list); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); tickSpinner.Adapter = dataAdapter; tickSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter.GetItem(e.Position); if (selectedItem.Equals("BottomRight")) { tickplacement = TickPlacement.BottomRight; } else if (selectedItem.Equals("TopLeft")) { tickplacement = TickPlacement.TopLeft; } else if (selectedItem.Equals("Inline")) { tickplacement = TickPlacement.Inline; } else if (selectedItem.Equals("Outside")) { tickplacement = TickPlacement.Outside; } else if (selectedItem.Equals("None")) { tickplacement = TickPlacement.None; } }; TextView textView3 = new TextView(context); textView3.Text = " " + "LABEL PLACEMENT"; textView3.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView3.Gravity = GravityFlags.Left; textView3.TextSize = 15; textView3.SetTextColor(Color.White); List <String> labelList = new List <String> (); labelList.Add("BottomRight"); labelList.Add("TopLeft"); labelSpinner = new Spinner(context); labelSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = dataAdapter.GetItem(e.Position); if (selectedItem.Equals("TopLeft")) { valueplacement = ValuePlacement.TopLeft; } else if (selectedItem.Equals("BottomRight")) { valueplacement = ValuePlacement.BottomRight; } }; labelAdapter = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, labelList); labelAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); labelSpinner.Adapter = labelAdapter; labelSpinner.SetPadding(0, 0, 0, 0); LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(width * 2, 7); layoutParams2.SetMargins(0, 5, 0, 0); propertylayout.AddView(textView3); SeparatorView separate2 = new SeparatorView(context, width * 2); separate2.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 7); propertylayout.AddView(separate2, layoutParams2); TextView textview9 = new TextView(context); textview9.SetHeight(20); propertylayout.AddView(textview9); propertylayout.AddView(labelSpinner); propertylayout.SetPadding(15, 0, 15, 0); TextView textview7 = new TextView(context); textview7.SetHeight(20); propertylayout.AddView(textview7); TextView textView6 = new TextView(context); textView6.Text = " " + "Show Label"; textView6.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView6.Gravity = GravityFlags.Center; textView6.TextSize = 16; Switch checkBox = new Switch(context); checkBox.Checked = true; checkBox.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => { if (e.IsChecked) { showlabel = true; } else { showlabel = false; } }; LinearLayout.LayoutParams layoutParams3 = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams3.SetMargins(0, 10, 0, 0); LinearLayout.LayoutParams layoutParams4 = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, 55); layoutParams4.SetMargins(0, 10, 0, 0); stackView3 = new LinearLayout(context); stackView3.AddView(textView6, layoutParams4); stackView3.AddView(checkBox, layoutParams3); stackView3.Orientation = droid.Horizontal; propertylayout.AddView(stackView3); SeparatorView separate3 = new SeparatorView(context, width * 2); separate3.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); LinearLayout.LayoutParams layoutParams7 = new LinearLayout.LayoutParams( width * 2, 5); layoutParams7.SetMargins(0, 30, 0, 0); propertylayout.AddView(separate3, layoutParams7); TextView textView7 = new TextView(context); textView7.Text = " " + "SnapsToTicks"; textView7.Typeface = Typeface.Create("Roboto", TypefaceStyle.Normal); textView7.Gravity = GravityFlags.Center; textView7.TextSize = 16; Switch checkBox2 = new Switch(context); checkBox2.Checked = false; checkBox2.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => { if (e.IsChecked) { snapsto = SnapsTo.Ticks; } else { snapsto = SnapsTo.None; } }; LinearLayout.LayoutParams layoutParams5 = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); layoutParams5.SetMargins(0, 20, 0, 0); LinearLayout.LayoutParams layoutParams6 = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, 55); layoutParams6.SetMargins(0, 20, 0, 0); stackView4 = new LinearLayout(context); stackView4.AddView(textView7, layoutParams6); stackView4.AddView(checkBox2, layoutParams5); stackView4.Orientation = droid.Horizontal; propertylayout.AddView(stackView4); SeparatorView separate4 = new SeparatorView(context, width * 2); separate4.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); LinearLayout.LayoutParams layoutParams8 = new LinearLayout.LayoutParams( width * 2, 5); layoutParams8.SetMargins(0, 30, 0, 0); propertylayout.AddView(separate4, layoutParams8); return(propertylayout); }
public ColorPicker() { var grid = new Grid { Padding = 0, RowSpacing = 3, ColumnSpacing = 3, ColumnDefinitions = { new ColumnDefinition { Width = 20 }, new ColumnDefinition { Width = GridLength.Star }, new ColumnDefinition { Width = 60 }, }, }; _titleLabel = new Label { Text = (string)TitleProperty.DefaultValue }; grid.AddChild(_titleLabel, 0, 0, 2); _useDefault = new Switch { IsToggled = true, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }; _useDefault.Toggled += OnUseDefaultToggled; grid.AddChild(_useDefault, 2, 0); _sliders = new Slider[_components.Length]; for (var i = 0; i < _components.Length; i++) { _sliders[i] = new Slider { VerticalOptions = LayoutOptions.Center, Minimum = 0, Maximum = 255, Value = 255 }; _sliders[i].ValueChanged += OnColorSliderChanged; var label = new Label { Text = _components[i], HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }; grid.AddChild(label, 0, i + 1); grid.AddChild(_sliders[i], 1, i + 1); } _box = new Frame { BackgroundColor = Color, HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.Fill, BorderColor = Color.Black, }; grid.AddChild(_box, 2, 1, 1, 3); _hexLabel = new Label { Text = ColorToHex(Color), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, FontSize = 10, }; grid.AddChild(_hexLabel, 2, 4); Content = grid; }