Exemplo n.º 1
0
	// Use this for initialization
	void Start () {
		if (toggleSwitch == null){
			toggleSwitch = GetComponent<ToggleSwitch>();
		}
		toggleSwitch.OnSwitchOn += HandleSwitchOn;
		toggleSwitch.OnSwitchOff += HandleSwitchOff;
	}
Exemplo n.º 2
0
	// Use this for initialization
	void Start () {
		if (toggleSwitch == null){
			toggleSwitch = GetComponent<ToggleSwitch>();
		}
		spriteRenderer = GetComponent<Renderer>();
		toggleSwitch.OnSwitchOn += HandleSwitchOn;
		toggleSwitch.OnSwitchOff += HandleSwitchOff;
	}
Exemplo n.º 3
0
        private void PropertyControl_OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
        {
            if (args.NewValue == _currentPattern)
            {
                return;
            }

            _currentPattern = DataContext as Pattern;

            RootPanel.Children.Clear();

            if (_currentPattern != null)
            {
                var propertyDesc = _currentPattern.PropertyDescriptor;

                if (propertyDesc == null)
                {
                    return;
                }

                foreach (var option in propertyDesc.Options)
                {
                    // Label
                    var label = new TextBlock
                    {
                        Text       = option.Label + ":",
                        Foreground = new SolidColorBrush(Colors.Black)
                    };
                    RootPanel.Children.Add(label);

                    // Control
                    Control            controlToAdd;
                    DependencyProperty dependencyProperty;
                    IValueConverter    converter = null;

                    IDictionary <string, object> propertyDict = propertyDesc.Expando;

                    switch (option.Kind)
                    {
                    case PropertyKind.Slider:
                    case PropertyKind.DoubleSlider:
                        var slider       = new Slider();
                        var sliderOption = option as SliderPropertyOptions;
                        if (sliderOption != null)
                        {
                            slider.Minimum       = sliderOption.MinValue;
                            slider.Maximum       = sliderOption.MaxValue;
                            slider.StepFrequency = sliderOption.Step;
                        }

                        if (option.Kind == PropertyKind.DoubleSlider)
                        {
                            slider.StepFrequency = 0.01;
                        }

                        if ((propertyDict[option.Name] as ValueHolder).Value is double value)
                        {
                            slider.Value = value;
                        }

                        controlToAdd       = slider;
                        dependencyProperty = RangeBase.ValueProperty;

                        break;

                    case PropertyKind.Enum:
                        var enumType = option.DefaultValue.GetType();
                        var comboBox = new ComboBox
                        {
                            ItemsSource  = Enum.GetNames(enumType),
                            SelectedItem = (propertyDict[option.Name] as ValueHolder).Value.ToString()
                        };

                        converter          = new EnumConverter(enumType);
                        controlToAdd       = comboBox;
                        dependencyProperty = Selector.SelectedItemProperty;
                        break;

                    case PropertyKind.Bool:
                        var checkBox = new ToggleSwitch();

                        if ((propertyDict[option.Name] as ValueHolder).Value is bool isOn)
                        {
                            checkBox.IsOn = isOn;
                        }

                        controlToAdd       = checkBox;
                        dependencyProperty = ToggleSwitch.IsOnProperty;
                        break;

                    case PropertyKind.Brush:
                        var colorComboBox = new ComboBox();
                        var dataSource    = typeof(Colors).GetTypeInfo().DeclaredProperties.Select(p => p.Name).ToList();
                        colorComboBox.ItemsSource = dataSource;

                        if ((propertyDict[option.Name] as ValueHolder).Value is SolidColorBrush brush &&
                            _colorNames.TryGetValue(brush.Color, out var color))
                        {
                            colorComboBox.SelectedIndex = dataSource.IndexOf(color);
                        }
                        else
                        {
                            colorComboBox.SelectedIndex = dataSource.IndexOf(option.DefaultValue.ToString());
                        }

                        converter = new SolidColorBrushConverter();

                        controlToAdd       = colorComboBox;
                        dependencyProperty = Selector.SelectedItemProperty;
                        break;
Exemplo n.º 4
0
 private void OnToggleSwitchChanged(ToggleSwitch sender)
 {
     sender.Content = true == sender.IsChecked
                         ? Strings.ToggleSwitchOn
                         : Strings.ToggleSwitchOff;
 }
Exemplo n.º 5
0
        public async Task InitCategories()
        {
            ServiceRepository serviceRepository = new ServiceRepository();

            List <CategoryEntity> categories = await serviceRepository.getCategories();

            page.FiltersListBox.Items.Add(
                new TextBlock()
            {
                Text       = "Kategorije",
                Foreground = new SolidColorBrush(Windows.UI.Colors.White),
                FontSize   = 20
            }
                );

            foreach (var category in categories)
            {
                categoryToggled[category.Name] = true;
                ToggleSwitch s = new ToggleSwitch()
                {
                    Name   = category.Name,
                    Header = category.Name,
                    IsOn   = true,
                    Width  = 300
                };
                s.Toggled += new RoutedEventHandler(delegate(object o, RoutedEventArgs a)
                {
                    categoryToggled[category.Name] = !categoryToggled[category.Name];
                });
                page.FiltersListBox.Items.Add(s);
            }

            page.FiltersListBox.Items.Add(
                new TextBlock()
            {
                Text       = "Vrijeme",
                Foreground = new SolidColorBrush(Windows.UI.Colors.White),
                FontSize   = 20
            }
                );

            //current
            timeToggled["current"] = true;
            ToggleSwitch currentSwitch = new ToggleSwitch()
            {
                Name   = "current",
                Header = "Trenutni",
                IsOn   = true,
                Width  = 300
            };

            currentSwitch.Toggled += new RoutedEventHandler(delegate(object o, RoutedEventArgs a)
            {
                timeToggled["current"] = !timeToggled["current"];
            });
            page.FiltersListBox.Items.Add(currentSwitch);

            //current
            timeToggled["future"] = true;
            ToggleSwitch futureSwitch = new ToggleSwitch()
            {
                Name   = "future",
                Header = "Budući",
                IsOn   = true,
                Width  = 300
            };

            futureSwitch.Toggled += new RoutedEventHandler(delegate(object o, RoutedEventArgs a)
            {
                timeToggled["future"] = !timeToggled["future"];
            });
            page.FiltersListBox.Items.Add(futureSwitch);
        }
Exemplo n.º 6
0
        private void GenerateControls()
        {
            var     settings     = _viewModel.Settings;
            var     properties   = settings.GetType().GetProperties();
            var     groups       = new Dictionary <string, Dictionary <TextBlock, Control> >();
            Control firstControl = null;

            foreach (var property in properties)
            {
                var type         = property.PropertyType;
                var propertyPath = property.Name;
                var genericType  = type.IsGenericType ? type.GetGenericTypeDefinition() : null;

                Control            control      = null;
                DependencyProperty bindProperty = null;
                if (genericType == typeof(SettingSingleSelection <>))
                {
                    if (typeof(INovaromaService).IsAssignableFrom(type.GetGenericArguments().First()))
                    {
                        control = new SingleSelectionUserControl();
                    }
                    else
                    {
                        control = new SingleSelectComboBox();
                    }
                    bindProperty = DataContextProperty;
                    _lateBindables.Add((ILateBindable)property.GetValue(settings));
                }
                else if (genericType == typeof(SettingMultiSelection <>))
                {
                    control      = new MultiSelectionUserControl();
                    bindProperty = DataContextProperty;
                    _lateBindables.Add((ILateBindable)property.GetValue(settings));
                }
                else if (type == typeof(DirectorySelection))
                {
                    control       = new DirectorySelectUserControl();
                    bindProperty  = DirectorySelectUserControl.TextProperty;
                    propertyPath += ".Path";
                }
                else if (!property.CanWrite)
                {
                    continue;
                }
                else if (type == typeof(string))
                {
                    control      = new TextBox();
                    bindProperty = TextBox.TextProperty;
                }
                else if (type.IsNumericType())
                {
                    control      = new NumericUpDown();
                    bindProperty = NumericUpDown.ValueProperty;
                }
                else if (type == typeof(bool) ||
                         (genericType != null && genericType == typeof(Nullable <>) && genericType.GenericTypeArguments[0] == typeof(bool)))
                {
                    control = new ToggleSwitch {
                        Language = Language
                    };
                    bindProperty = ToggleSwitch.IsCheckedProperty;
                }

                if (control != null && bindProperty != null)
                {
                    if (firstControl == null)
                    {
                        firstControl = control;
                    }

                    var    displayAttr = property.GetAttribute <DisplayAttribute>();
                    string displayValue;
                    string description;
                    string groupName;
                    if (displayAttr != null)
                    {
                        displayValue = displayAttr.GetName() ?? property.Name;
                        description  = displayAttr.GetDescription() ?? string.Empty;
                        groupName    = displayAttr.GetGroupName() ?? string.Empty;
                    }
                    else
                    {
                        displayValue = property.Name;
                        description  = string.Empty;
                        groupName    = string.Empty;
                    }

                    var textBlock = new TextBlock();
                    textBlock.VerticalAlignment = VerticalAlignment.Center;
                    textBlock.Margin            = new Thickness(10);
                    textBlock.Text = displayValue;
                    if (!string.IsNullOrEmpty(description))
                    {
                        textBlock.ToolTip = description;
                    }
                    textBlock.SetCurrentValue(Grid.ColumnProperty, 0);

                    control.Margin = new Thickness(10);
                    control.SetCurrentValue(Grid.ColumnProperty, 1);

                    var binding = new Binding();
                    binding.Source = settings;
                    binding.Path   = new PropertyPath(propertyPath);
                    binding.UpdateSourceTrigger = UpdateSourceTrigger.Explicit;
                    var bindingExpression = BindingOperations.SetBinding(control, bindProperty, binding);
                    _bindings.Add(bindingExpression);

                    if (groups.ContainsKey(groupName))
                    {
                        groups[groupName].Add(textBlock, control);
                    }
                    else
                    {
                        groups.Add(groupName, new Dictionary <TextBlock, Control> {
                            { textBlock, control }
                        });
                    }
                }
            }

            foreach (var group in groups)
            {
                var tabItem = new TabItem();
                if (groups.Count > 1)
                {
                    tabItem.Header = string.IsNullOrEmpty(group.Key) ? Novaroma.Properties.Resources.Main : group.Key;
                }
                ControlsTabControl.Items.Add(tabItem);

                var scrollViewer = new ScrollViewer();
                tabItem.Content = scrollViewer;

                var grid = new Grid();
                grid.HorizontalAlignment = HorizontalAlignment.Stretch;
                grid.VerticalAlignment   = VerticalAlignment.Stretch;
                grid.Margin = new Thickness(20);
                grid.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Auto);
                grid.SetValue(ScrollViewer.VerticalScrollBarVisibilityProperty, ScrollBarVisibility.Auto);
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(0, GridUnitType.Auto)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                scrollViewer.Content = grid;

                var i = 0;
                foreach (var controls in group.Value)
                {
                    var rowDefinition = new RowDefinition();
                    rowDefinition.Height = new GridLength(0, GridUnitType.Auto);
                    grid.RowDefinitions.Add(rowDefinition);

                    var textBlock = controls.Key;
                    textBlock.SetCurrentValue(Grid.RowProperty, i);

                    var control = controls.Value;
                    control.SetCurrentValue(Grid.RowProperty, i);

                    grid.Children.Add(controls.Key);
                    grid.Children.Add(controls.Value);

                    i++;
                }
            }

            if (firstControl != null)
            {
                firstControl.Focus();
            }
        }
        private async void PropertyControl_OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
        {
            if (args.NewValue == _currentSample)
            {
                return;
            }

            _currentSample = DataContext as Sample;

            RootPanel.Children.Clear();

            if (_currentSample != null)
            {
                var propertyDesc = await _currentSample.GetPropertyDescriptorAsync();

                if (propertyDesc == null)
                {
                    return;
                }

                foreach (var option in propertyDesc.Options)
                {
                    // Label
                    var label = new TextBlock
                    {
                        Text       = option.Name + ":",
                        Foreground = new SolidColorBrush(Colors.Black)
                    };
                    RootPanel.Children.Add(label);

                    // Control
                    Control            controlToAdd;
                    DependencyProperty dependencyProperty;
                    IValueConverter    converter = null;

                    switch (option.Kind)
                    {
                    case PropertyKind.Slider:
                    case PropertyKind.DoubleSlider:
                        var slider       = new Slider();
                        var sliderOption = option as SliderPropertyOptions;
                        if (sliderOption != null)
                        {
                            slider.Minimum = sliderOption.MinValue;
                            slider.Maximum = sliderOption.MaxValue;
                        }

                        if (option.Kind == PropertyKind.DoubleSlider)
                        {
                            slider.StepFrequency = 0.01;
                        }

                        controlToAdd       = slider;
                        dependencyProperty = RangeBase.ValueProperty;

                        break;

                    case PropertyKind.Enum:
                        var enumType = option.DefaultValue.GetType();
                        var comboBox = new ComboBox
                        {
                            ItemsSource  = Enum.GetNames(enumType),
                            SelectedItem = option.DefaultValue.ToString()
                        };

                        converter          = new EnumConverter(enumType);
                        controlToAdd       = comboBox;
                        dependencyProperty = Selector.SelectedItemProperty;
                        break;

                    case PropertyKind.Bool:
                        var checkBox = new ToggleSwitch();

                        controlToAdd       = checkBox;
                        dependencyProperty = ToggleSwitch.IsOnProperty;
                        break;

                    case PropertyKind.Brush:
                        var colorComboBox = new ComboBox();
                        var dataSource    = typeof(Colors).GetTypeInfo().DeclaredProperties.Select(p => p.Name).ToList();
                        colorComboBox.ItemsSource   = dataSource;
                        colorComboBox.SelectedIndex = dataSource.IndexOf(option.DefaultValue.ToString());

                        converter = new SolidColorBrushConverter();

                        controlToAdd       = colorComboBox;
                        dependencyProperty = Selector.SelectedItemProperty;
                        break;

                    default:
                        var textBox = new TextBox {
                            Text = option.DefaultValue.ToString()
                        };

                        controlToAdd       = textBox;
                        dependencyProperty = TextBox.TextProperty;
                        break;
                    }

                    var binding = new Binding
                    {
                        Source    = propertyDesc.Expando,
                        Path      = new PropertyPath(option.Name + ".Value"),
                        Mode      = BindingMode.TwoWay,
                        Converter = converter
                    };

                    controlToAdd.SetBinding(dependencyProperty, binding);
                    controlToAdd.Margin = new Thickness(0, 5, 0, 20);
                    RootPanel.Children.Add(controlToAdd);
                }
            }
        }
Exemplo n.º 8
0
        protected override void CreateScene()
        {
            FreeCamera camera = new FreeCamera("camera", new Vector3(-3.8f, 2.2f, 5.6f), new Vector3(0, 0.8f, 2.2f))
            {
                Speed     = 5,
                NearPlane = 0.1f
            };

            EntityManager.Add(camera);

            this.Video1 = WaveServices.VideoPlayer.VideoInfoFromPath("Content/Video/bunny.mp4");
            this.Video2 = WaveServices.VideoPlayer.VideoInfoFromPath("Content/Video/bear.mp4");

            WaveServices.VideoPlayer.IsLooped = true;
            WaveServices.VideoPlayer.Play(this.Video1);

            Entity tvRoomEntity = new Entity("tvRoom")
                                  .AddComponent(new Transform3D())
                                  .AddComponent(new Model("Content/TvRoom.wpk"))
                                  .AddComponent(new ModelRenderer())
                                  .AddComponent(new MaterialsMap(new System.Collections.Generic.Dictionary <string, Material>
            {
                { "floor", new DualTextureMaterial("Content/parketFloor_Difuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque) },
                { "tv", new DualTextureMaterial("Content/Tv_Difuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque) },
                { "table", new DualTextureMaterial("Content/table_Difuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque) },
                { "chair", new DualTextureMaterial("Content/Chair_Difuse.wpk", "Content/TvRoomLightingMap.wpk", DefaultLayers.Opaque) },
                { "tv_screen", new BasicMaterial(WaveServices.VideoPlayer.VideoTexture) }
            }
                                                                 ));

            EntityManager.Add(tvRoomEntity);

            StackPanel controlPanel = new StackPanel()
            {
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right,
                Margin      = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30),
                BorderColor = Color.White,
                IsBorder    = true,
            };

            ToggleSwitch muteToggle = new ToggleSwitch()
            {
                OnText  = "Mute",
                OffText = "Mute",
                Margin  = new WaveEngine.Framework.UI.Thickness(5, 5, 5, 10)
            };

            muteToggle.Toggled += (e, s) =>
            {
                WaveServices.VideoPlayer.IsMuted = muteToggle.IsOn;
            };

            controlPanel.Add(muteToggle);

            RadioButton radioButton1 = new RadioButton()
            {
                GroupName = "Videos",
                Text      = "Channel 1",
                Margin    = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 0),
                IsChecked = true
            };

            radioButton1.Checked += (e, s) =>
            {
                WaveServices.VideoPlayer.Play(this.Video1);
            };
            controlPanel.Add(radioButton1);

            RadioButton radioButton2 = new RadioButton()
            {
                GroupName = "Videos",
                Text      = "Channel 2",
                Margin    = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 10)
            };

            radioButton2.Checked += (e, s) =>
            {
                WaveServices.VideoPlayer.Play(this.Video2);
            };
            controlPanel.Add(radioButton2);

            PlayBtn = new Button("playBtn")
            {
                Text    = "Play",
                Opacity = 0.5f,
                Margin  = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 0),
                Width   = 170
            };

            PlayBtn.Click += (e, s) =>
            {
                WaveServices.VideoPlayer.Resume();
                PlayBtn.Opacity  = 0.5f;
                PauseBtn.Opacity = 1f;
            };

            controlPanel.Add(PlayBtn);

            PauseBtn = new Button("pauseBtn")
            {
                Text   = "Pause",
                Width  = 170,
                Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 5),
            };

            PauseBtn.Click += (e, s) =>
            {
                WaveServices.VideoPlayer.Pause();
                PlayBtn.Opacity  = 1f;
                PauseBtn.Opacity = 0.5f;
            };

            controlPanel.Add(PauseBtn);

            EntityManager.Add(controlPanel);
        }
Exemplo n.º 9
0
	void HandleSwitchOff(ToggleSwitch toggleSwitch){
		SoundPlayer.Instance.Play(OffClip);
	}
Exemplo n.º 10
0
 public void fillprint(ToggleSwitch toggleSwitch6, ToggleSwitch toggleSwitch7, ToggleSwitch toggleSwitch8, SpinEdit spinEdit3, SpinEdit spinEdit4, ComboBoxEdit comboBoxEdit23, string UserId)
 {
     toggleSwitch6.IsOn  = bool.Parse(ini.IniReadValue("printsetting", "PrintSwitch"));
     toggleSwitch7.IsOn  = bool.Parse(ini.IniReadValue("printsetting", "CompatibilityMode"));
     toggleSwitch8.IsOn  = bool.Parse(ini.IniReadValue("printsetting", "DetailSwitch"));
     spinEdit3.Text      = ini.IniReadValue("printsetting", "PrintingDelay");
     spinEdit4.Text      = ini.IniReadValue("printsetting", "PrintingNumber");
     comboBoxEdit23.Text = ini.IniReadValue("printsetting", "PrintingDrive");
 }
        public static void GetAmount(ToggleSwitch IsHomeToggleSw, TextBox PrevTextBox, TextBox CurTextBox, TextBox MonTextBox, ref TextBlock ConsTextBox, ref TextBlock AmountTextBox)
        {
            // Count the monthly consumption
            int    IntPrevious  = FormatValue(PrevTextBox);
            int    IntCurrent   = FormatValue(CurTextBox);
            int    IntMonths    = FormatMonths(MonTextBox);
            int    IntDif       = 0;
            double DoubleAmount = 0;
            double DoubleFees   = 0;

            // If the counter reached 10000 KWH it count from 0
            if (IntCurrent > IntPrevious)
            {
                IntDif = IntCurrent - IntPrevious;
            }
            else if (IntCurrent < IntPrevious)
            {
                IntDif = (10000 - IntPrevious) + IntCurrent;
            }
            ConsTextBox.Text = IntDif.ToString();
            int IntMonthConsumption = IntDif / IntMonths;

            // Home usage
            if (IsHomeToggleSw.IsOn == false)
            {
                /* Calculate Fees Here
                 *
                 *
                 *
                 */
                // Calculate Consumption value
                if (IntMonthConsumption <= 100)
                {
                    if (IntMonthConsumption <= 50)
                    {
                        DoubleAmount = IntMonthConsumption * 0.075;
                    }
                    else
                    {
                        DoubleAmount = 3.75 + (IntMonthConsumption - 50) * 0.145;
                    }
                }
                else
                {
                    if (IntMonthConsumption <= 200)
                    {
                        DoubleAmount = IntMonthConsumption * 0.16;
                    }
                    else
                    {
                        if (IntMonthConsumption <= 350)
                        {
                            DoubleAmount = 32 + (IntMonthConsumption - 200) * 0.305;
                        }
                        else
                        {
                            if (IntMonthConsumption <= 650)
                            {
                                DoubleAmount = 77.75 + (IntMonthConsumption - 350) * 0.405;
                            }
                            else
                            {
                                if (IntMonthConsumption <= 1000)
                                {
                                    DoubleAmount = 199.25 + (IntMonthConsumption - 650) * 0.71;
                                }
                                else
                                {
                                    DoubleAmount = 447.75 + (IntMonthConsumption - 1000) * 0.84;
                                }
                            }
                        }
                    }
                }
            }
            // Commercial usage
            else
            {
                /* Calculate Fees Here
                 *
                 *
                 *
                 */
                // Calculate Consumption value
                if (IntMonthConsumption <= 100)
                {
                    DoubleAmount = IntMonthConsumption * 0.32;
                }
                else
                {
                    if (IntMonthConsumption <= 250)
                    {
                        DoubleAmount = IntMonthConsumption * 0.5;
                    }
                    else
                    {
                        if (IntMonthConsumption <= 600)
                        {
                            DoubleAmount = 125 + (IntMonthConsumption - 250) * 0.61;
                        }
                        else
                        {
                            if (IntMonthConsumption <= 1000)
                            {
                                DoubleAmount = 388.5 + (IntMonthConsumption - 600) * 0.81;
                            }
                            else
                            {
                                DoubleAmount = 662.5 + (IntMonthConsumption - 1000) * 0.86;
                            }
                        }
                    }
                }
            }
            // Caculate Total Amount
            double DoubleTotalAmount = DoubleAmount * IntMonths + DoubleFees;

            AmountTextBox.Text = DoubleTotalAmount.ToString();
        }
Exemplo n.º 12
0
 public ToggleConfigItem(string g, string k, string n)
     : base(g, k, n)
 {
     ui              = new ToggleSwitch(); onUICreated();
     ui.IsOnChanged += (s, e) => Save();
 }
Exemplo n.º 13
0
        private void Toggle_Unchecked(object sender, RoutedEventArgs e)
        {
            ToggleSwitch switches = sender as ToggleSwitch;

            switches.Content = "Off";
        }
        private Grid CreateButtonsGrid()
        {
            Grid buttonsGrid = new Grid();

            buttonsGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
            buttonsGrid.VerticalAlignment   = VerticalAlignment.Top;

            RadioButton buttonMorning = new RadioButton();

            buttonMorning.Content             = "Morning";
            buttonMorning.GroupName           = "DayTime";
            buttonMorning.Checked            += DayTimeRadioButton_Checked;
            buttonMorning.HorizontalAlignment = HorizontalAlignment.Center;
            buttonsGrid.Children.Add(buttonMorning);
            buttonsGrid.ColumnDefinitions.Add(new ColumnDefinition());
            Grid.SetColumn(buttonMorning, 0);

            RadioButton buttonDay = new RadioButton();

            buttonDay.Content             = "Day";
            buttonDay.GroupName           = "DayTime";
            buttonDay.Checked            += DayTimeRadioButton_Checked;
            buttonDay.HorizontalAlignment = HorizontalAlignment.Center;
            buttonsGrid.Children.Add(buttonDay);
            buttonsGrid.ColumnDefinitions.Add(new ColumnDefinition());
            Grid.SetColumn(buttonDay, 1);

            RadioButton buttonDusk = new RadioButton();

            buttonDusk.Content             = "Dusk";
            buttonDusk.GroupName           = "DayTime";
            buttonDusk.Checked            += DayTimeRadioButton_Checked;
            buttonDusk.HorizontalAlignment = HorizontalAlignment.Center;
            buttonsGrid.Children.Add(buttonDusk);
            buttonsGrid.ColumnDefinitions.Add(new ColumnDefinition());
            Grid.SetColumn(buttonDusk, 2);

            RadioButton buttonNight = new RadioButton();

            buttonNight.Content             = "Night";
            buttonNight.GroupName           = "DayTime";
            buttonNight.Checked            += DayTimeRadioButton_Checked;
            buttonNight.HorizontalAlignment = HorizontalAlignment.Center;
            buttonsGrid.Children.Add(buttonNight);
            buttonsGrid.ColumnDefinitions.Add(new ColumnDefinition());
            Grid.SetColumn(buttonNight, 3);

            ToggleSwitch buttonHighlighted = new ToggleSwitch();

            buttonHighlighted.OnLabel    = "Highlighted";
            buttonHighlighted.OffLabel   = "Highlighted";
            buttonHighlighted.Checked   += HighlightedButton_Checked;
            buttonHighlighted.Unchecked += HighlightedButton_Unchecked;
            Style style = this.FindResource("CustomMetroToggleSwitch") as Style;

            buttonHighlighted.Style = style;
            buttonHighlighted.HorizontalAlignment = HorizontalAlignment.Center;
            buttonsGrid.Children.Add(buttonHighlighted);
            buttonsGrid.ColumnDefinitions.Add(new ColumnDefinition());
            Grid.SetColumn(buttonHighlighted, 4);

            //Set the default values
            switch (_eDayTime)
            {
            case EDayTime.eMorning:
                buttonMorning.IsChecked = true;
                break;

            case EDayTime.eDay:
                buttonDay.IsChecked = true;
                break;

            case EDayTime.eDusk:
                buttonDusk.IsChecked = true;
                break;

            case EDayTime.eNight:
                buttonNight.IsChecked = true;
                break;
            }
            if (_bIsHighlighted)
            {
                buttonHighlighted.IsChecked = true;
            }

            return(buttonsGrid);
        }
Exemplo n.º 15
0
        private void ToggleSwitch_Click_1(object sender, RoutedEventArgs e)
        {
            ToggleSwitch togle = sender as ToggleSwitch;

            numberhelp = (bool)togle.IsChecked;
        }
Exemplo n.º 16
0
	void HandleFloorSwitchPress (ToggleSwitch floorSwitch){
		gameObject.SetActive(false);
	}
Exemplo n.º 17
0
 public void currencysetting(ToggleSwitch toggleSwitch9, ToggleSwitch toggleSwitch10, ToggleSwitch toggleSwitch11, ToggleSwitch toggleSwitch12, ToggleSwitch toggleSwitch16, SpinEdit spinEdit5, ToggleSwitch toggleSwitch14, ToggleSwitch toggleSwitch13, ToggleSwitch toggleSwitch17, string UserId)
 {
     ini.IniWriteValue("currencysetting", "SelfStart", toggleSwitch9.IsOn.ToString());
     ini.IniWriteValue("currencysetting", "AutomaticUpgrade", toggleSwitch10.IsOn.ToString());
     ini.IniWriteValue("currencysetting", "PushNotice", toggleSwitch11.IsOn.ToString());
     ini.IniWriteValue("currencysetting", "SuspensionWindow", toggleSwitch12.IsOn.ToString());
     ini.IniWriteValue("currencysetting", "ScanningCallUp", toggleSwitch16.IsOn.ToString());
     ini.IniWriteValue("currencysetting", "SweepTimeout", spinEdit5.Text);
     ini.IniWriteValue("currencysetting", "VoiceAnnouncements", toggleSwitch14.IsOn.ToString());
     ini.IniWriteValue("currencysetting", "JiangXiaoHe_VoiceAnnouncements", toggleSwitch13.IsOn.ToString());
     ini.IniWriteValue("currencysetting", "JiangXiaoHe", toggleSwitch17.IsOn.ToString());
 }
Exemplo n.º 18
0
        static FrameworkElement GetUIOptionValue(int opt, JObject root)
        {
            Options option = (Options)opt;

            JProperty        jprop = GetJProperty(option, root);
            FrameworkElement ret   = null;

            try
            {
                switch (option)
                {
                case Options.tail_type:
                {
                    Dictionary <string, int> dic = new Dictionary <string, int>()
                    {
                        { "LINE", 1 }
                        , { "PATTERN", 2 }
                    };
                    ComboBox cb = new ComboBox()
                    {
                        SelectedIndex = 0
                    };
                    var e = dic.GetEnumerator();
                    while (e.MoveNext())
                    {
                        cb.Items.Add(e.Current.Key);
                    }

                    cb.DataContext = jprop.Parent;
                    Binding bd = new Binding(option.ToString());
                    bd.Mode      = BindingMode.TwoWay;
                    bd.Converter = new OnlyInt64TailTypeConverter();
                    cb.SetBinding(ComboBox.SelectedIndexProperty, bd);

                    cb.SelectedIndex = Convert.ToInt32(jprop.Value) - 1;

                    cb.SelectionChanged += delegate {
                        //((JValue)optionValue).Value = dic[cb.SelectedItem.ToString()];
                        ConfigOptionManager.IsChanged = true;
                        TailOptions.current.ChangeSecondGrid();
                    };
                    ret = cb;
                }
                break;

                case Options.input_dir:
                case Options.input_ext:
                case Options.output_dir:
                case Options.output_ext:
                case Options.sid:
                case Options.input_filter:
                //case Options.no_access_sentence:
                case Options.blacklist_filter:
                {
                    TextBox tb = new TextBox() /*Text = optionValue.ToString()*/ }
                    {
                        ;
                        tb.Width = ConfigOptionSize.WIDTH_VALUE;
                        tb.HorizontalAlignment = HorizontalAlignment.Left;
                        ret = tb;

                        tb.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode = BindingMode.TwoWay;
                        // TextBox.Text 의 UpdateSourceTrigger 의 기본속성은 LostFocus 이다.
                        bd.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        tb.SetBinding(TextBox.TextProperty, bd);

                        tb.Text = Convert.ToString(jprop.Value);

                        tb.TextChanged += delegate
                        {
                            //((JValue)optionValue).Value = tb.Text;
                            ConfigOptionManager.IsChanged = true;
                        };
                }
                break;

                case Options.zero_byte_yn:
                case Options.file_reserver_yn:
                case Options.daemon_yn:
                case Options.dir_recursive_yn:
                {
                    ToggleSwitch ts = new ToggleSwitch() /*IsChecked = (bool)optionValue*/ }
                    {
                        ;
                        ts.Width = ConfigOptionSize.WIDTH_VALUE;
                        ts.HorizontalAlignment = HorizontalAlignment.Left;

                        ts.FontSize = 13;
                        ts.OffLabel = "False";
                        ts.OnLabel  = "True";
                        ts.Style    = (Style)App.Current.Resources["MahApps.Metro.Styles.ToggleSwitch.Win10"];

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(ts, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(ts, 1);
                        ret = ts;

                        ts.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyBooleanConverter();
                        ts.SetBinding(ToggleSwitch.IsCheckedProperty, bd);

                        ts.IsChecked = Convert.ToBoolean(jprop.Value);

                        ts.Checked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.IsChanged = true;
                        };
                        ts.Unchecked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.IsChanged = true;
                        };
                }
                break;
                //case Options.reg_yn:
                //	{
                //		ToggleSwitch ts = new ToggleSwitch() { /*IsChecked = (bool)optionValue*/ };
                //		ts.Width = ConfigOptionSize.WIDTH_VALUE;
                //		ts.HorizontalAlignment = HorizontalAlignment.Left;

                //		ts.FontSize = 13;
                //		ts.OffLabel = "False";
                //		ts.OnLabel = "True";
                //		ts.Style = (Style)App.Current.Resources["MahApps.Metro.Styles.ToggleSwitch.Win10"];

                //		//if(panelDetailOption.RowDefinitions.Count > 0)
                //		//	Grid.SetRow(ts, panelDetailOption.RowDefinitions.Count - 1);
                //		//Grid.SetColumn(ts, 1);
                //		ret = ts;

                //		ts.DataContext = jprop.Parent;
                //		Binding bd = new Binding(option.ToString());
                //		bd.Mode = BindingMode.TwoWay;
                //		bd.Converter = new OnlyBooleanConverter();
                //		ts.SetBinding(ToggleSwitch.IsCheckedProperty, bd);

                //		ts.IsChecked = Convert.ToBoolean(jprop.Value);

                //		ts.Checked += delegate
                //		{
                //			//((JValue)optionValue).Value = ts.IsChecked;
                //			ConfigOptionManager.bChanged = true;
                //			TailOptions.current.ChangeSecondGrid();
                //		};
                //		ts.Unchecked += delegate
                //		{
                //			//((JValue)optionValue).Value = ts.IsChecked;
                //			ConfigOptionManager.bChanged = true;
                //			TailOptions.current.ChangeSecondGrid();
                //		};
                //	}
                //	break;
                case Options.interval:
                case Options.no_inform:
                //case Options.shutdown_time:
                case Options.limit_process:
                case Options.dir_recursive_max_depth:
                {
                    NumericUpDown tb_integer = new NumericUpDown() /*Value = (System.Int64)optionValue*/ }
                    {
                        ;
                        tb_integer.Width = ConfigOptionSize.WIDTH_VALUE;
                        tb_integer.HorizontalAlignment = HorizontalAlignment.Left;

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(tb_integer, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(tb_integer, 1);
                        ret = tb_integer;

                        tb_integer.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyInt64Converter();
                        tb_integer.SetBinding(NumericUpDown.ValueProperty, bd);

                        tb_integer.Value = Convert.ToInt64(jprop.Value);

                        tb_integer.ValueChanged += delegate
                        {
                            //((JValue)optionValue).Value = (System.Int64)tb_integer.Value;
                            ConfigOptionManager.IsChanged = true;
                        };
                }
                break;

                default:
                    break;
                }
                if (jprop != null && jprop.Name[0] == ConfigOptionManager.StartDisableProperty &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)] != null &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent != null)
                {
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent.Remove();
                }
            }
            catch (Exception e)
            {
                Log.PrintError(e.Message + " (\"" + option.ToString() + "\" : \"" + jprop + "\")", "UserControls.ConfigOption.Tail.comm_option.GetUIOptionValue");
            }

            if (ret != null)
            {
                ret.Width               = ConfigOptionSize.WIDTH_VALUE;
                ret.Margin              = new Thickness(10, 3, 10, 3);
                ret.VerticalAlignment   = VerticalAlignment.Center;
                ret.HorizontalAlignment = HorizontalAlignment.Left;
            }
            return(ret);
        }
Exemplo n.º 19
0
 public void currencysetting1(ToggleSwitch toggleSwitch9, ToggleSwitch toggleSwitch10, ToggleSwitch toggleSwitch11, ToggleSwitch toggleSwitch12, ToggleSwitch toggleSwitch16, SpinEdit spinEdit5, ToggleSwitch toggleSwitch14, ToggleSwitch toggleSwitch13, ToggleSwitch toggleSwitch17, string UserId)
 {
     toggleSwitch9.IsOn  = bool.Parse(ini.IniReadValue("currencysetting", "SelfStart"));
     toggleSwitch10.IsOn = bool.Parse(ini.IniReadValue("currencysetting", "AutomaticUpgrade"));
     toggleSwitch11.IsOn = bool.Parse(ini.IniReadValue("currencysetting", "PushNotice"));
     toggleSwitch12.IsOn = bool.Parse(ini.IniReadValue("currencysetting", "SuspensionWindow"));
     toggleSwitch16.IsOn = bool.Parse(ini.IniReadValue("currencysetting", "ScanningCallUp"));
     spinEdit5.Text      = ini.IniReadValue("currencysetting", "SweepTimeout");
     toggleSwitch14.IsOn = bool.Parse(ini.IniReadValue("currencysetting", "VoiceAnnouncements"));
     toggleSwitch13.IsOn = bool.Parse(ini.IniReadValue("currencysetting", "JiangXiaoHe_VoiceAnnouncements"));
     toggleSwitch17.IsOn = bool.Parse(ini.IniReadValue("currencysetting", "JiangXiaoHe"));
 }
Exemplo n.º 20
0
        public static void Create(Canvas p, Thickness m)
        {
            if (cm != null)
            {
                cm.ReSize(m);
                ReSize(m);
                return;
            }
            parent = p;
            cm     = new ColorManage();
            cm.Create(p, m);
            ts = new ToggleSwitch();
            if (language == 1)
            {
                ts.IsOn = true;
            }
            ts.Toggled += (o, e) => {
                language         = ts.IsOn ? 1 : 0;
                Setting.language = language;
                MainEx.LanguageChange();
                cm.ChangeLan();
                sharp_t.Text = str_s[language];
                start_t.Text = str_st[language];
                bst.Text     = str_bs[language];
                start_c.Items.Clear();
                int c = MainEx.s_all.Length;
                for (int i = 0; i < c; i++)
                {
                    start_c.Items.Add(MainEx.s_all[i][language]);
                }
                start_c.SelectedIndex = Setting.startindex;
                restore.Content       = str_r[language];
                ChangLanguage();
                //dp.ChangLanguage();
            };
            p.Children.Add(ts);
            ls            = CreateTextBlockNext();
            ls.Foreground = font_brush;
            ls.Text       = "English";
            p.Children.Add(ls);

            sharp_t            = CreateTextBlockNext();
            sharp_t.Foreground = font_brush;
            sharp_t.Text       = str_s[language];
            p.Children.Add(sharp_t);
            start_t            = CreateTextBlockNext();
            start_t.Foreground = font_brush;
            start_t.Text       = str_st[language];
            p.Children.Add(start_t);
            bst            = CreateTextBlockNext();
            bst.Foreground = font_brush;
            bst.Text       = str_bs[language];
            p.Children.Add(bst);

            sharp_c = new ComboBox();
            for (int i = 0; i < 3; i++)
            {
                sharp_c.Items.Add(str_ss[i]);
            }
            switch (Setting.sharp)
            {
            case 270:
                sharp_c.SelectedIndex = 2;
                break;

            case 360:
                sharp_c.SelectedIndex = 1;
                break;

            default:
                sharp_c.SelectedIndex = 0;
                break;
            }

            sharp_c.SelectionChanged += (o, e) => {
                switch (sharp_c.SelectedIndex)
                {
                case 1:
                    Setting.sharp = 360;
                    break;

                case 2:
                    Setting.sharp = 270;
                    break;

                default:
                    Setting.sharp = 720;
                    break;
                }
            };
            p.Children.Add(sharp_c);

            bsc = new ComboBox();
            for (int i = 0; i < 3; i++)
            {
                bsc.Items.Add(str_ss[i]);
            }
            switch (Setting.buffsharp)
            {
            case 270:
                bsc.SelectedIndex = 2;
                break;

            case 360:
                bsc.SelectedIndex = 1;
                break;

            default:
                bsc.SelectedIndex = 0;
                break;
            }
            bsc.SelectionChanged += (o, e) => {
                switch (bsc.SelectedIndex)
                {
                case 1:
                    Setting.buffsharp = 360;
                    break;

                case 2:
                    Setting.buffsharp = 270;
                    break;

                default:
                    Setting.buffsharp = 720;
                    break;
                }
            };
            p.Children.Add(bsc);

            start_c = new ComboBox();
            int l = MainEx.s_all.Length;

            for (int i = 0; i < l; i++)
            {
                start_c.Items.Add(MainEx.s_all[i][language]);
            }
            start_c.SelectedIndex     = Setting.startindex;
            start_c.SelectionChanged += (o, e) => {
                if (start_c.SelectedIndex > -1)
                {
                    Setting.startindex = start_c.SelectedIndex;
                }
            };
            p.Children.Add(start_c);

            CreateDown(p);
            restore            = new Button();
            restore.Click     += (o, e) => { Restore(); };
            restore.Content    = str_r[language];
            restore.Foreground = font_brush;
            p.Children.Add(restore);
            ReSize(m);
            //dp= new DownloadPage();
            //dp.Create(p,new Thickness(0,305,m.Right,m.Bottom));
        }
Exemplo n.º 21
0
        static FrameworkElement GetUIOptionValue(int opt, JObject root)
        {
            Option option = (Option)opt;

            JProperty        jprop = GetJProperty(option, root);
            FrameworkElement ret   = null;

            try
            {
                switch (option)
                {
                case Option.encode_type:
                {
                    Dictionary <string, int> dic = new Dictionary <string, int>()
                    {
                        { "binary", 0 }
                        , { "ASCII", 1 }
                    };
                    ComboBox cb = new ComboBox()
                    {
                        SelectedIndex = 0
                    };
                    var e = dic.GetEnumerator();
                    while (e.MoveNext())
                    {
                        cb.Items.Add(e.Current.Key);
                    }


                    cb.DataContext = jprop.Parent;
                    Binding bd = new Binding(option.ToString());
                    bd.Mode      = BindingMode.TwoWay;
                    bd.Converter = new StringToInt64Converter();
                    cb.SetBinding(ComboBox.SelectedIndexProperty, bd);

                    cb.SelectedIndex = Convert.ToInt32(jprop.Value);

                    cb.SelectionChanged += delegate
                    {
                        ConfigOptionManager.bChanged = true;
                    };
                    ret = cb;
                }
                break;

                case Option.sid:
                case Option.item:
                case Option.schedule_time:
                case Option.delay_time:
                {
                    TextBox tb = new TextBox() /*Text = optionValue.ToString()*/ }
                    {
                        ;
                        tb.Width = ConfigOptionSize.WIDTH_VALUE;
                        tb.HorizontalAlignment = HorizontalAlignment.Left;
                        ret = tb;

                        tb.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode = BindingMode.TwoWay;
                        // TextBox.Text 의 UpdateSourceTrigger 의 기본속성은 LostFocus 이다.
                        bd.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        tb.SetBinding(TextBox.TextProperty, bd);

                        tb.Text = Convert.ToString(jprop.Value);

                        tb.TextChanged += delegate
                        {
                            //((JValue)optionValue).Value = tb.Text;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                case Option.log_console_yn:
                case Option.header_file_save_yn:
                case Option.file_reserver_yn:
                case Option.dir_monitoring_yn:
                case Option.verify_yn:
                case Option.result_log_yn:
                case Option.dir_recursive_yn:
                {
                    ToggleSwitch ts = new ToggleSwitch() /*IsChecked = (bool)optionValue*/ }
                    {
                        ;
                        ts.Width = ConfigOptionSize.WIDTH_VALUE;
                        ts.HorizontalAlignment = HorizontalAlignment.Left;

                        ts.FontSize = 13;
                        ts.OffLabel = "False";
                        ts.OnLabel  = "True";
                        ts.Style    = (Style)App.Current.Resources["MahApps.Metro.Styles.ToggleSwitch.Win10"];

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(ts, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(ts, 1);
                        ret = ts;

                        ts.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyBooleanConverter();
                        ts.SetBinding(ToggleSwitch.IsCheckedProperty, bd);

                        ts.IsChecked = Convert.ToBoolean(jprop.Value);

                        ts.Checked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.bChanged = true;
                        };
                        ts.Unchecked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                case Option.dir_monitoring_term:
                case Option.dir_recursive_max_depth:
                {
                    NumericUpDown tb_integer = new NumericUpDown() /*Value = (System.Int64)optionValue*/ }
                    {
                        ;
                        tb_integer.Width = ConfigOptionSize.WIDTH_VALUE;
                        tb_integer.HorizontalAlignment = HorizontalAlignment.Left;

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(tb_integer, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(tb_integer, 1);
                        ret = tb_integer;

                        tb_integer.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyInt64Converter();
                        tb_integer.SetBinding(NumericUpDown.ValueProperty, bd);

                        tb_integer.Value = Convert.ToInt64(jprop.Value);

                        tb_integer.ValueChanged += delegate
                        {
                            //((JValue)optionValue).Value = (System.Int64)tb_integer.Value;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                default:
                    break;
                }

                if (jprop != null && jprop.Name[0] == ConfigOptionManager.StartDisableProperty &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)] != null &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent != null)
                {
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent.Remove();
                }
            }
            catch (Exception e)
            {
                Log.PrintError(e.Message + " (\"" + option.ToString() + "\" : \"" + jprop + "\")", "UserControls.ConfigOption.File.comm_option.GetUIOptionValue");
            }

            if (ret != null)
            {
                ret.Width               = 150;
                ret.Margin              = new Thickness(10, 3, 10, 3);
                ret.VerticalAlignment   = VerticalAlignment.Center;
                ret.HorizontalAlignment = HorizontalAlignment.Left;
            }
            return(ret);
        }
Exemplo n.º 22
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Gray;
            //RenderManager.DebugLines = true;

            // Toggle 1
            int offsetTop = 20;
            int spacing   = 80;

            toggle1 = new ToggleSwitch()
            {
                Margin = new Thickness(20, offsetTop, 0, 0),
            };
            EntityManager.Add(toggle1.Entity);

            // Toggle 2
            toggle2 = new ToggleSwitch()
            {
                Margin  = new Thickness(20, offsetTop + spacing, 0, 0),
                Width   = 150,
                OnText  = "High",
                OffText = "Low",
            };
            EntityManager.Add(toggle2.Entity);

            // Toggle 3
            toggle3 = new ToggleSwitch()
            {
                Margin     = new Thickness(20, offsetTop + spacing * 2, 0, 0),
                Width      = 200,
                OnText     = "DirectX",
                OffText    = "OpenGL",
                Foreground = Color.Purple,
                Background = Color.LightPink,
            };
            EntityManager.Add(toggle3.Entity);

            // Toggle 4
            toggle4 = new ToggleSwitch()
            {
                Margin     = new Thickness(20, offsetTop + spacing * 3, 0, 0),
                Width      = 200,
                OnText     = "Victory!",
                OffText    = "You lose",
                Foreground = Color.Yellow,
                Background = Color.Red,
                TextColor  = Color.Yellow,
                IsOn       = true,
            };
            toggle4.Toggled += toggle4_Toggled;
            EntityManager.Add(toggle4.Entity);

            textblock1 = new TextBlock()
            {
                Margin = new Thickness(20, offsetTop + spacing * 4, 0, 0),
                Text   = "Event:",
            };
            EntityManager.Add(textblock1.Entity);

            // Toggle 5
            toggle5 = new ToggleSwitch()
            {
                Margin     = new Thickness(20, offsetTop + spacing * 5, 0, 0),
                Width      = 200,
                OnText     = "Sonic",
                OffText    = "MarioBros",
                Foreground = Color.Orange,
                Background = Color.DarkGray,
                TextColor  = Color.Orange,
            };
            EntityManager.Add(toggle5.Entity);

            button1 = new Button()
            {
                Margin = new Thickness(20, offsetTop + spacing * 6, 0, 0),
                Text   = "Set On",
            };
            button1.Click += button1_Click;
            EntityManager.Add(button1.Entity);

            button2 = new Button()
            {
                Margin = new Thickness(130, offsetTop + spacing * 6, 0, 0),
                Text   = "Set Off",
            };
            button2.Click += button2_Click;
            EntityManager.Add(button2.Entity);

            // Image Check
            AddCheckImage("Content/ToggleSwitchSample.wpk");
        }
Exemplo n.º 23
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Black;
            //RenderManager.DebugLines = true;

            FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 4, 12), new Vector3(0, 4, 0))
            {
                Speed = 5
            };

            EntityManager.Add(camera.Entity);

            RenderManager.SetActiveCamera(camera.Entity);

            PointLight Light0 = new PointLight("Light0", new Vector3(-5, 8, 10))
            {
                Color       = Color.White,
                Attenuation = 20,
            };

            Light0.Entity.AddComponent(new MoveBehavior()
            {
                Speed = 0.2f
            });

            EntityManager.Add(Light0.Entity);

            float value = 0.0f;
            Color c     = new Color(value, value, value, 1);

            Entity cubeModel = new Entity("Cube")
                               .AddComponent(new Transform3D()
            {
                Scale = new Vector3(6)
            })
                               //.AddComponent(new Spinner() { IncreaseY = 0.02f })
                               .AddComponent(new BoxCollider())
                               .AddComponent(new Model("Content/Cube.wpk"))
                               .AddComponent(new MaterialsMap(new NormalMappingMaterial("Content/floor.wpk", "Content/floor_normal_spec.wpk", "Content/lightmap.wpk")
            {
                AmbientColor = c
            }))                                                                                                                                                                // "Content/lightmap.wpk"
                               .AddComponent(new ModelRenderer());

            EntityManager.Add(cubeModel);

            #region UI
            Slider slider1 = new Slider()
            {
                Margin  = new Thickness(10, 90, 0, 0),
                Width   = 500,
                Minimum = 4,
                Maximum = 40,
                Value   = 30
            };

            slider1.RealTimeValueChanged += (s, e) =>
            {
                var entity    = EntityManager.Find("Light0");
                var component = entity.FindComponent <PointLightProperties>();
                component.Attenuation = e.NewValue;
            };

            EntityManager.Add(slider1);

            Slider slider2 = new Slider()
            {
                Margin  = new Thickness(10, 140, 0, 0),
                Width   = 500,
                Minimum = 1,
                Maximum = 100
            };

            slider2.RealTimeValueChanged += (s, e) =>
            {
                var entity    = EntityManager.Find("Cube");
                var component = entity.FindComponent <MaterialsMap>();
                var material  = (component.DefaultMaterial as NormalMappingMaterial);

                float v  = (float)e.NewValue / 100.0f;
                Color c1 = new Color(v, v, v, 1);
                material.AmbientColor = c1;
            };

            EntityManager.Add(slider2);

            ToggleSwitch lightmapEnabled = new ToggleSwitch()
            {
                Margin  = new Thickness(10, 10, 0, 0),
                IsOn    = true,
                OnText  = "LightMap On",
                OffText = "LightMap Off",
            };

            lightmapEnabled.Toggled += (s, e) =>
            {
                var entity    = EntityManager.Find("Cube");
                var component = entity.FindComponent <MaterialsMap>();
                var material  = (component.DefaultMaterial as NormalMappingMaterial);
                material.LightMapEnabled = !material.LightMapEnabled;
            };

            EntityManager.Add(lightmapEnabled);

            ToggleSwitch textureEnabled = new ToggleSwitch()
            {
                Margin  = new Thickness(10, 40, 0, 0),
                IsOn    = true,
                OnText  = "Texture On",
                OffText = "Texture Off"
            };

            textureEnabled.Toggled += (s, o) =>
            {
                var entity    = EntityManager.Find("Cube");
                var component = entity.FindComponent <MaterialsMap>();
                var material  = (component.DefaultMaterial as NormalMappingMaterial);
                material.TextureEnabled = !material.TextureEnabled;
            };

            EntityManager.Add(textureEnabled);

            ToggleSwitch normalMapEnabled = new ToggleSwitch()
            {
                Margin  = new Thickness(300, 10, 0, 0),
                IsOn    = true,
                OnText  = "NormalMap On",
                OffText = "NormalMap Off"
            };

            normalMapEnabled.Toggled += (s, o) =>
            {
                var entity    = EntityManager.Find("Cube");
                var component = entity.FindComponent <MaterialsMap>();
                var material  = (component.DefaultMaterial as NormalMappingMaterial);
                material.NormalMappingEnabled = !material.NormalMappingEnabled;
            };

            EntityManager.Add(normalMapEnabled);
            #endregion
        }
Exemplo n.º 24
0
        public static string LayerName(this ToggleSwitch toggleSwitch)
        {
            var switchName = toggleSwitch.Content.ToString();

            return(string.Format("Layer_{0}", switchName));
        }
Exemplo n.º 25
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.CornflowerBlue;

            //"spineboy","walk"),
            //"powerup","animation"),

            string file = "spineboy";

            var ratio = WaveServices.ViewportManager.RatioX;

            this.skeleton = new Entity("Spine")
                            .AddComponent(new Transform2D()
            {
                X = 350, Y = 460, XScale = 1, YScale = 1
            })
                            .AddComponent(new SkeletalData("Content/" + file + ".atlas"))
                            .AddComponent(new SkeletalAnimation("Content/" + file + ".json"))
                            .AddComponent(new SkeletalRenderer()
            {
                ActualDebugMode = SkeletalRenderer.DebugMode.None
            });

            EntityManager.Add(this.skeleton);

            #region UI
            Slider slider1 = new Slider()
            {
                Margin  = new Thickness(10, 40, 0, 0),
                Width   = 500,
                Minimum = -25,
                Maximum = 25,
                Value   = 0
            };

            slider1.RealTimeValueChanged += (s, e) =>
            {
                var entity    = EntityManager.Find("Light0");
                var component = skeleton.FindComponent <SkeletalAnimation>();
                component.Speed = e.NewValue / 10f;
            };

            EntityManager.Add(slider1);

            ToggleSwitch debugMode = new ToggleSwitch()
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin  = new Thickness(0, 10, 10, 0),
                IsOn    = false,
                OnText  = "Debug On",
                OffText = "Debug Off",
                Width   = 200
            };

            debugMode.Toggled += (s, o) =>
            {
                RenderManager.DebugLines = ((ToggleSwitch)s).IsOn;
            };

            EntityManager.Add(debugMode);

            CheckBox debugBones = new CheckBox()
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin = new Thickness(0, 60, 10, 0),
                Text   = "Bones",
                Width  = 150,
            };

            debugBones.Checked += (s, o) =>
            {
                if (o.Value)
                {
                    this.skeleton.FindComponent <SkeletalRenderer>().ActualDebugMode |= SkeletalRenderer.DebugMode.Bones;
                }
                else
                {
                    this.skeleton.FindComponent <SkeletalRenderer>().ActualDebugMode &= SkeletalRenderer.DebugMode.Quads;
                }
            };

            EntityManager.Add(debugBones);

            CheckBox debugQuads = new CheckBox()
            {
                HorizontalAlignment = HorizontalAlignment.Right,
                Margin = new Thickness(0, 110, 10, 0),
                Text   = "Quads",
                Width  = 150,
            };

            debugQuads.Checked += (s, o) =>
            {
                if (o.Value)
                {
                    this.skeleton.FindComponent <SkeletalRenderer>().ActualDebugMode |= SkeletalRenderer.DebugMode.Quads;
                }
                else
                {
                    this.skeleton.FindComponent <SkeletalRenderer>().ActualDebugMode &= SkeletalRenderer.DebugMode.Bones;
                }
            };

            EntityManager.Add(debugQuads);
            #endregion
        }
 public ToggleSwitchAutomationPeer(ToggleSwitch owner) : base(owner)
 {
 }
Exemplo n.º 27
0
        private async void ToggleSwitch_Toggled(object sender, RoutedEventArgs e)
        {
            ToggleSwitch toggleSwitch = (ToggleSwitch)sender;

            await iotHub.SendCloudToDeviceMessageAsync(toggleSwitch.IsOn? "0" : "1");
        }
Exemplo n.º 28
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            this.bunnyVideo = WaveServices.VideoPlayer.VideoInfoFromPath(WaveContent.Assets.Video.bear_mp4);
            this.bearVideo  = WaveServices.VideoPlayer.VideoInfoFromPath(WaveContent.Assets.Video.bunny_mp4);

            WaveServices.VideoPlayer.IsLooped = true;
            WaveServices.VideoPlayer.Play(this.bunnyVideo);

            StackPanel controlPanel = new StackPanel()
            {
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right,
                Margin      = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30),
                BorderColor = Color.White,
                IsBorder    = true,
            };

            ToggleSwitch muteToggle = new ToggleSwitch()
            {
                OnText  = "Mute",
                OffText = "Mute",
                Margin  = new WaveEngine.Framework.UI.Thickness(5, 5, 5, 10)
            };

            muteToggle.Toggled += (e, s) =>
            {
                WaveServices.VideoPlayer.IsMuted = muteToggle.IsOn;
            };

            controlPanel.Add(muteToggle);

            RadioButton radioButton1 = new RadioButton()
            {
                GroupName = "Videos",
                Text      = "Channel 1",
                Margin    = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 0),
                IsChecked = true
            };

            radioButton1.Checked += (e, s) =>
            {
                WaveServices.VideoPlayer.Play(this.bunnyVideo);
            };
            controlPanel.Add(radioButton1);

            RadioButton radioButton2 = new RadioButton()
            {
                GroupName = "Videos",
                Text      = "Channel 2",
                Margin    = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 10)
            };

            radioButton2.Checked += (e, s) =>
            {
                WaveServices.VideoPlayer.Play(this.bearVideo);
            };
            controlPanel.Add(radioButton2);

            playBtn = new Button("playBtn")
            {
                Text    = "Play",
                Opacity = 0.5f,
                Margin  = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 0),
                Width   = 170
            };

            playBtn.Click += (e, s) =>
            {
                WaveServices.VideoPlayer.Resume();
                playBtn.Opacity  = 0.5f;
                pauseBtn.Opacity = 1f;
            };

            controlPanel.Add(playBtn);

            pauseBtn = new Button("pauseBtn")
            {
                Text   = "Pause",
                Width  = 170,
                Margin = new WaveEngine.Framework.UI.Thickness(5, 0, 5, 5),
            };

            pauseBtn.Click += (e, s) =>
            {
                WaveServices.VideoPlayer.Pause();
                playBtn.Opacity  = 1f;
                pauseBtn.Opacity = 0.5f;
            };

            controlPanel.Add(pauseBtn);

            EntityManager.Add(controlPanel);
        }
Exemplo n.º 29
0
        protected ToggleSwitch AddToggleSwitch(string name, Point posn, Size size, ToggleSwitchPosition defaultPosition,
                                               string positionOneImage, string positionTwoImage, ToggleSwitchType defaultType, ClickType clickType, string interfaceDeviceName, string interfaceElementName,
                                               bool fromCenter, bool horizontal = false, string interfaceIndicatorElementName = "")
        {
            if (fromCenter)
            {
                posn = FromCenter(posn, size);
            }
            string componentName = GetComponentName(name);

            ToggleSwitch newSwitch = new ToggleSwitch();

            newSwitch.Name            = componentName;
            newSwitch.SwitchType      = defaultType;
            newSwitch.ClickType       = clickType;
            newSwitch.DefaultPosition = defaultPosition;
            newSwitch.HasIndicator    = true;
            if (interfaceIndicatorElementName != "")
            {
                // if there is an indicatorElementname then the image names will be partial
                // and need to be completed
                newSwitch.PositionOneImage            = positionOneImage + " off.png";
                newSwitch.PositionTwoImage            = positionTwoImage + " off.png";
                newSwitch.PositionOneIndicatorOnImage = positionOneImage + " on.png";
                newSwitch.PositionTwoIndicatorOnImage = positionTwoImage + " on.png";
                newSwitch.HasIndicator = true;
            }
            else
            {
                newSwitch.PositionOneImage = positionOneImage;
                newSwitch.PositionTwoImage = positionTwoImage;
                newSwitch.HasIndicator     = false;
            }
            newSwitch.Width  = size.Width;
            newSwitch.Height = size.Height;

            newSwitch.Top  = posn.Y;
            newSwitch.Left = posn.X;
            if (horizontal)
            {
                newSwitch.Rotation    = HeliosVisualRotation.CW;
                newSwitch.Orientation = ToggleSwitchOrientation.Horizontal;
            }

            Children.Add(newSwitch);

            foreach (IBindingTrigger trigger in newSwitch.Triggers)
            {
                AddTrigger(trigger, componentName);
            }
            AddAction(newSwitch.Actions["set.position"], componentName);

            AddDefaultOutputBinding(
                childName: componentName,
                deviceTriggerName: "position.changed",
                interfaceActionName: interfaceDeviceName + ".set." + interfaceElementName
                );
            AddDefaultInputBinding(
                childName: componentName,
                interfaceTriggerName: interfaceDeviceName + "." + interfaceElementName + ".changed",
                deviceActionName: "set.position");

            if (newSwitch.HasIndicator)
            {
                AddAction(newSwitch.Actions["set.indicator"], componentName);

                AddDefaultInputBinding(
                    childName: componentName,
                    interfaceTriggerName: interfaceDeviceName + "." + interfaceIndicatorElementName + ".changed",
                    deviceActionName: "set.indicator");
            }
            return(newSwitch);
        }
Exemplo n.º 30
0
 public void Fillgraspsetting(ToggleSwitch toggleSwitch1, RadioGroup RadioGroup, ComboBoxEdit comboBoxEdit3,
                              ComboBoxEdit comboBoxEdit4, ComboBoxEdit comboBoxEdit6, ComboBoxEdit comboBoxEdit5, SpinEdit spinEdit1, ToggleSwitch toggleSwitch2, TextEdit textEdit4, TextEdit textEdit5, ToggleSwitch toggleSwitch3, SpinEdit spinEdit2, TextEdit textEdit6,
                              ComboBoxEdit comboBoxEdit7, TextEdit textEdit7, ComboBoxEdit comboBoxEdit8, TextEdit textEdit8, ComboBoxEdit comboBoxEdit9, TextEdit textEdit9, ComboBoxEdit comboBoxEdit10, TextEdit textEdit10, ComboBoxEdit comboBoxEdit11,
                              TextEdit textEdit11, ComboBoxEdit comboBoxEdit12, CheckEdit checkEdit1, ComboBoxEdit comboBoxEdit13, string UserId)
 {
     try
     {
         toggleSwitch1.IsOn          = bool.Parse(ini.IniReadValue("graspsetting", "ExtractionMethodState"));
         RadioGroup.SelectedIndex    = int.Parse(ini.IniReadValue("graspsetting", "GrabMode")) + 1;
         comboBoxEdit3.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "GrabSerialPort"));
         comboBoxEdit4.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "Grabbing_BaudRate"));
         comboBoxEdit6.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "GuestShowPort"));
         comboBoxEdit5.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "Grabbing_BaudRate"));
         toggleSwitch2.IsOn          = bool.Parse(ini.IniReadValue("graspsetting", "FocusReturnState"));
         toggleSwitch3.IsOn          = bool.Parse(ini.IniReadValue("graspsetting", "SelfCheckoutState"));
         spinEdit1.Text = ini.IniReadValue("graspsetting", "PaymentWaitingTime");
         spinEdit2.Text = ini.IniReadValue("graspsetting", "KeyIntervalTime");
         textEdit4.Text = ini.IniReadValue("graspsetting", "Coordinate").Split(',')[0];
         textEdit5.Text = ini.IniReadValue("graspsetting", "Coordinate").Split(',')[1];
         textEdit6.Text = ini.IniReadValue("graspsetting", "Step1Name");
         comboBoxEdit7.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "Step1Frequency"));
         textEdit7.Text = ini.IniReadValue("graspsetting", "Step2Name");
         comboBoxEdit8.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "Step2Frequency"));
         textEdit8.Text = ini.IniReadValue("graspsetting", "Step3Name");
         comboBoxEdit9.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "Step3Frequency"));
         textEdit9.Text = ini.IniReadValue("graspsetting", "Step4Name");
         comboBoxEdit10.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "Step4Frequency"));
         textEdit10.Text = ini.IniReadValue("graspsetting", "Step5Name");
         comboBoxEdit11.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "Step5Frequency"));
         textEdit11.Text = ini.IniReadValue("graspsetting", "Step6Name");
         comboBoxEdit12.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "Step6Frequency"));
         comboBoxEdit13.SelectedIndex = int.Parse(ini.IniReadValue("graspsetting", "FillAmount"));
         checkEdit1.Checked           = bool.Parse(ini.IniReadValue("graspsetting", "FillAmountState"));
     }catch (Exception e1)
     {
         Log4NetHelper.WriteErrorLog(e1.Message);
     }
 }
Exemplo n.º 31
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Gray;
            //RenderManager.DebugLines = true;

            // Group 1
            int group1Top = 20;

            radio1 = new RadioButton()
            {
                Width      = 360,
                Margin     = new Thickness(20, group1Top, 0, 0),
                Text       = "Group 1 - Choice 1",
                GroupName  = "First group",
                Foreground = Color.Black,
                IsChecked  = true
            };
            EntityManager.Add(radio1.Entity);

            radio2 = new RadioButton()
            {
                Width      = 360,
                Margin     = new Thickness(20, group1Top + 40, 0, 0),
                Text       = "Group 1 - Choice 2",
                GroupName  = "First group",
                Foreground = Color.Black
            };
            EntityManager.Add(radio2.Entity);

            // Free
            radio3 = new RadioButton()
            {
                Width       = 180,
                Margin      = new Thickness(20, 180, 0, 0),
                Text        = "Free choice",
                IsBorder    = true,
                BorderColor = Color.Yellow
            };
            EntityManager.Add(radio3.Entity);

            // Toggle
            toggle = new ToggleSwitch()
            {
                Margin = new Thickness(220, 180, 0, 0)
            };
            toggle.Toggled += toggle_Toggled;
            EntityManager.Add(toggle.Entity);

            // Group 2
            int group2Top = 300;

            radio4 = new RadioButton()
            {
                Width      = 360,
                Margin     = new Thickness(20, group2Top, 0, 0),
                Text       = "Group 2 - Choice 1",
                GroupName  = "Second group",
                Foreground = Color.Yellow,
                IsChecked  = true
            };
            radio4.Checked += radio_group2_Checked;
            EntityManager.Add(radio4.Entity);

            radio5 = new RadioButton()
            {
                Width      = 360,
                Margin     = new Thickness(20, group2Top + 40, 0, 0),
                Text       = "Group 2 - Choice 2",
                GroupName  = "Second group",
                Foreground = Color.LightSalmon,
            };
            radio5.Checked += radio_group2_Checked;
            EntityManager.Add(radio5.Entity);

            radio6 = new RadioButton()
            {
                Width      = 360,
                Margin     = new Thickness(20, group2Top + 80, 0, 0),
                Text       = "Group 2 - Choice 3",
                GroupName  = "Second group",
                Foreground = Color.LightSkyBlue
            };
            radio6.Checked += radio_group2_Checked;
            EntityManager.Add(radio6.Entity);

            // Event text
            textBlock = new TextBlock()
            {
                Width  = 360,
                Height = 40,
                Margin = new Thickness(20, group2Top + 120, 0, 0),
                Text   = "Selected:"
            };
            EntityManager.Add(textBlock.Entity);

            // Image check
            AddCheckImage("Content/RadioButtonSample.wpk");
        }
Exemplo n.º 32
0
	void HandleSwitchOff(ToggleSwitch toggleSwitch){
		spriteRenderer.material = OffTexture;
	}
Exemplo n.º 33
0
        private async void EnterButton_click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(TermsValue.Text) == false && char.IsDigit(TermsValue.Text, 0) == true)
            {
                if (0 < Convert.ToInt32(TermsValue.Text) && Convert.ToInt32(TermsValue.Text) < 50)
                {
                    fixdecistack.Children.Clear();
                    Toggalstack.Children.Clear();
                    termsprintStack.Children.Clear();
                    CoeffiStack.Children.Clear();
                    XStack.Children.Clear();;
                    PowerStack.Children.Clear();
                    plueStack.Children.Clear();
                    calstack.Children.Clear();
                    fixinterstack.Children.Clear();
                    FixInterationtext.Text = "";
                    toggleon   = 1;
                    toggletemp = 0;

                    EnterValues.Text  = "Enter Values : ";
                    Fixdeciaml.Text   = "Fix Decimal";
                    fixdecivalue.Text = "4";
                    fixdecistack.Children.Add(fixdecivalue);

                    Coefficientblock.Text = "Coefficiant";
                    Xblock.Text           = "X";
                    Powerblock.Text       = "Power";

                    ToggleSwitch fixinttoggle = new ToggleSwitch();
                    fixinttoggle.Header     = "Fix Iterations";
                    fixinttoggle.OnContent  = "YES";
                    fixinttoggle.OffContent = "NO";
                    fixinttoggle.Toggled   += ToggalSeitchevents;

                    Toggalstack.Children.Add(fixinttoggle);

                    cal.Content             = "Calculate";
                    cal.HorizontalAlignment = HorizontalAlignment.Center;
                    cal.VerticalAlignment   = VerticalAlignment.Center;
                    cal.Click += cal_Click;
                    calstack.Children.Add(cal);

                    x0value.Text = "x0 : ";
                    x1value.Text = "x1 : ";

                    x0getvalues.Width = 50;
                    x1getvalues.Width = 50;

                    x0Stack.Children.Add(x0getvalues);
                    x1Stack.Children.Add(x1getvalues);


                    BisectionMethod_Class.terms = Convert.ToInt32(TermsValue.Text);

                    for (int i = 0; i < BisectionMethod_Class.terms; i++)
                    {
                        coeff[i] = new TextBox();
                        X[i]     = new TextBox();
                        Power[i] = new TextBox();

                        coeff[i].Height = 25;
                        X[i].Height     = 25;
                        coeff[i].Width  = 35;
                        Power[i].Height = 25;


                        if (i < BisectionMethod_Class.terms - 1)
                        {
                            X[i].Text = "x";
                        }
                        else
                        {
                            X[i].Text = "1";
                        }

                        tems[i]          = new TextBlock();
                        tems[i].Text     = "Term : " + (i + 1);
                        tems[i].Margin   = new Thickness(0, margin, 0, 0);
                        tems[i].FontSize = 30;

                        if (i < BisectionMethod_Class.terms - 1)
                        {
                            plusprint[i]          = new TextBlock();
                            plusprint[i].Text     = "+";
                            plusprint[i].FontSize = 30;
                            plusprint[i].Margin   = new Thickness(0, margin, 0, 0);
                            plueStack.Children.Add(plusprint[i]);
                        }

                        termsprintStack.Children.Add(tems[i]);
                        CoeffiStack.Children.Add(coeff[i]);
                        XStack.Children.Add(X[i]);
                        PowerStack.Children.Add(Power[i]);
                    }
                }
                else
                {
                    var dialogs = new MessageDialog("Value is between 1 to 50");
                    dialogs.Title = "Invalid Values";
                    dialogs.Commands.Add(new UICommand {
                        Label = "OK", Id = 0
                    });
                    var ress = await dialogs.ShowAsync();
                }
            }
            else
            {
                var dialogs = new MessageDialog("Value is not Set To null or wrong");
                dialogs.Title = "Invalid Values";
                dialogs.Commands.Add(new UICommand {
                    Label = "OK", Id = 0
                });
                var ress = await dialogs.ShowAsync();
            }
        }
Exemplo n.º 34
0
	void HandleFloorSwitchRelease (ToggleSwitch floorSwitch){
		gameObject.SetActive(true);
	}
Exemplo n.º 35
0
 public ToggleSwitchAutomationPeer([NotNull] ToggleSwitch owner) : base(owner)
 {
 }
        private void ToggleSwitch_Click(object sender, RoutedEventArgs e)
        {
            ToggleSwitch toggleSwitch = sender as ToggleSwitch;

            if ((bool)toggleSwitch.IsChecked)
            {
                ChartHood.HideZeroLevel();
                ChartInsAir.HideZeroLevel();
                ChartInsWall.HideZeroLevel();
                ChartAttAir.HideZeroLevel();
                ChartTemperature1.HideZeroLevel();
                ChartTemperature2.HideZeroLevel();
                ChartAttWalls1.HideZeroLevel();
                ChartAttWalls2.HideZeroLevel();
                ChartAttWalls3.HideZeroLevel();
                ChartAttWalls4.HideZeroLevel();
                ChartAttWalls5.HideZeroLevel();
                ChartAttWalls6.HideZeroLevel();
                ChartInsPresure.HideZeroLevel();
                ChartAttiPresure.HideZeroLevel();
                ChartPresure.HideZeroLevel();
                ChartLevel1Presure.HideZeroLevel();
                ChartLevel2Transmitter.HideZeroLevel();
                ChartGestureControlHigh.HideZeroLevel();
                ChartGestureControlLow.HideZeroLevel();
                ChartShake1.HideZeroLevel();
                ChartShake2.HideZeroLevel();
                ChartShake3.HideZeroLevel();
                ChartShake4.HideZeroLevel();
                ChartShake5.HideZeroLevel();
                ChartShake6.HideZeroLevel();
                ChartShake7.HideZeroLevel();
                ChartShake8.HideZeroLevel();
                ChartShake9.HideZeroLevel();
                ChartShake10.HideZeroLevel();
                ChartShake11.HideZeroLevel();
                ChartShake12.HideZeroLevel();
                ChartLash1X.HideZeroLevel();
                ChartLash1Y.HideZeroLevel();
                ChartLash1Z.HideZeroLevel();
                ChartLash2X.HideZeroLevel();
                ChartLash2Y.HideZeroLevel();
                ChartLash2Z.HideZeroLevel();
                ChartLash1_1.HideZeroLevel();
                ChartLash1_2.HideZeroLevel();
                ChartLash1_3.HideZeroLevel();
                ChartLash2.HideZeroLevel();
                ChartNoise1.HideZeroLevel();
                ChartNoise2.HideZeroLevel();
                ChartNoise.HideZeroLevel();
            }
            else
            {
                ChartHood.SetFixedRange();
                ChartInsAir.SetFixedRange();
                ChartInsWall.SetFixedRange();
                ChartAttAir.SetFixedRange();
                ChartTemperature1.SetFixedRange();
                ChartTemperature2.SetFixedRange();
                ChartAttWalls1.SetFixedRange();
                ChartAttWalls2.SetFixedRange();
                ChartAttWalls3.SetFixedRange();
                ChartAttWalls4.SetFixedRange();
                ChartAttWalls5.SetFixedRange();
                ChartAttWalls6.SetFixedRange();
                ChartInsPresure.SetFixedRange();
                ChartAttiPresure.SetFixedRange();
                ChartPresure.SetFixedRange();
                ChartLevel1Presure.SetFixedRange();
                ChartLevel2Transmitter.SetFixedRange();
                ChartGestureControlHigh.SetFixedRange();
                ChartGestureControlLow.SetFixedRange();
                ChartShake1.SetFixedRange();
                ChartShake2.SetFixedRange();
                ChartShake3.SetFixedRange();
                ChartShake4.SetFixedRange();
                ChartShake5.SetFixedRange();
                ChartShake6.SetFixedRange();
                ChartShake7.SetFixedRange();
                ChartShake8.SetFixedRange();
                ChartShake9.SetFixedRange();
                ChartShake10.SetFixedRange();
                ChartShake11.SetFixedRange();
                ChartShake12.SetFixedRange();
                ChartLash1X.SetFixedRange();
                ChartLash1Y.SetFixedRange();
                ChartLash1Z.SetFixedRange();
                ChartLash2X.SetFixedRange();
                ChartLash2Y.SetFixedRange();
                ChartLash2Z.SetFixedRange();
                ChartLash1_1.SetFixedRange();
                ChartLash1_2.SetFixedRange();
                ChartLash1_3.SetFixedRange();
                ChartLash2.SetFixedRange();
                ChartNoise1.SetFixedRange();
                ChartNoise2.SetFixedRange();
                ChartNoise.SetFixedRange();
            }
        }
Exemplo n.º 37
0
	void HandleSwitchOff (ToggleSwitch toggleSwitch){
		if (SwitchesInRequiredState()){
			if (OnSequenceComplete != null) OnSequenceComplete();
		}
	}