public MainPage() { InitializeComponent(); BindingContext = new MainPageViewModel(); BarcodeText.SetBinding(Entry.TextProperty, nameof(ViewModel.BarcodeText)); BarcodePresenter.SetBinding(ZXingBarcodeImageView.BarcodeValueProperty, nameof(ViewModel.BarcodeText)); EncodingOptions barcodeOptions = new EncodingOptions(); barcodeOptions.Height = 300; barcodeOptions.Width = 300; BarcodePresenter.BarcodeOptions = barcodeOptions; }
public string this[string name] { get { string result = null; if (name == "BarcodeText") { if (BarcodeText == null || BarcodeText.Trim() == "") { result = "This Field Cannot Be Empty..."; if (!validationErrors.ContainsKey(name)) { validationErrors.Add(name, result); } } else { validationErrors.Remove(name); } } else if (name == "txt_one") { if (txt_one == null || txt_one.Trim() == "") { result = "This Field Cannot Be Empty"; if (!validationErrors.ContainsKey(name)) { validationErrors.Add(name, result); } } else { validationErrors.Remove(name); } } else if (name == "txt_two") { if (txt_two == null || txt_two.Trim() == "") { result = "This Field Cannot Be Empty"; if (!validationErrors.ContainsKey(name)) { validationErrors.Add(name, result); } } else { validationErrors.Remove(name); } } else if (name == "txt_three") { if (txt_three == null || txt_three.Trim() == "") { result = "This Field Cannot Be Empty"; if (!validationErrors.ContainsKey(name)) { validationErrors.Add(name, result); } } else { validationErrors.Remove(name); } } else if (name == "txt_four") { if (txt_four == null || txt_four.Trim() == "") { result = "This Field Cannot Be Empty"; if (!validationErrors.ContainsKey(name)) { validationErrors.Add(name, result); } } else { validationErrors.Remove(name); } } else if (name == "txt_five") { if (txt_five == null || txt_five.Trim() == "") { result = "This Field Cannot Be Empty"; if (!validationErrors.ContainsKey(name)) { validationErrors.Add(name, result); } } else { validationErrors.Remove(name); } } else if (name == "txt_six") { if (txt_six == null || txt_six.Trim() == "") { result = "This Field Cannot Be Empty"; if (!validationErrors.ContainsKey(name)) { validationErrors.Add(name, result); } } else { validationErrors.Remove(name); } } return(result); } }
public MainWindow() { InitializeComponent(); Title = $"{Application.ResourceAssembly.GetName().Name} {Application.ResourceAssembly.GetName().Version}"; _clockTimer.Tick += (sender, args) => ClockText.Text = $"{DateTime.Now}"; _clockTimer.Interval = TimeSpan.FromSeconds(1); _clockTimer.Start(); ClockText.Text = $"{DateTime.Now}"; SerialPortComboBox.ItemsSource = SerialPort.GetPortNames(); SocketStatusChangedHandler(); SerialPortStatusChangedHandler(); GameExeText.SetBinding(TextBox.TextProperty, new Binding { Path = new PropertyPath("GameExe"), Source = _config, Mode = BindingMode.OneWay }); ToolCfgText.SetBinding(TextBox.TextProperty, new Binding { Path = new PropertyPath("ToolCfg"), Source = _config, Mode = BindingMode.OneWay }); ProfileNameText.SetBinding(TextBox.TextProperty, new Binding { Path = new PropertyPath("ProfileName"), Source = _config, Mode = BindingMode.OneWay }); ProfileCfgText.SetBinding(TextBox.TextProperty, new Binding { Path = new PropertyPath("ProfileCfg"), Source = _config, Mode = BindingMode.OneWay }); ServerUrlText.SetBinding(TextBox.TextProperty, new Binding { Path = new PropertyPath("ServerUrl"), Source = _config, Mode = BindingMode.OneWay }); SerialPortComboBox.SetBinding(Selector.SelectedItemProperty, new Binding { Path = new PropertyPath("SerialPort"), Source = _config, Mode = BindingMode.TwoWay }); LogEvent.OnLogEvent += NewLogEvent; _status.OnLastBarcodeChanged += LastBarcodeChangedHandler; _status.OnSocketStatusChanged += SocketStatusChangedHandler; _status.OnSerialPortStatusChanged += SerialPortStatusChangedHandler; BarcodeText.Focus(); }