protected static void AddPropertiesForRepositoryLocalObject(RepositoryLocalObjectData rlo, PeekResult result, string currentUserId) { if (rlo == null) { return; } result.LockedBy = LinkEntry.From(rlo.LockInfo.LockUser, Resources.LabelLockedBy, currentUserId); result.MetadataSchema = LinkEntry.From(rlo.MetadataSchema, Resources.LabelMetadataSchema, currentUserId); if (rlo.LocationInfo != null) { result.WebDavUrl = TextEntry.From(rlo.LocationInfo.WebDavUrl, Resources.LabelWebDavUrl); } FullVersionInfo versionInfo = rlo.VersionInfo as FullVersionInfo; if (versionInfo != null) { if (result.CreationDate != null) { result.CreationDate.User = GetUserTitle(versionInfo.Creator, currentUserId); } if (result.RevisionDate != null) { result.RevisionDate.User = GetUserTitle(versionInfo.Revisor, currentUserId); } if (versionInfo.LastVersion != null && versionInfo.LastVersion.Value > 1) { result.Versions = NumberEntry.From(versionInfo.LastVersion.Value, Resources.LabelVersions); } } }
// Action du clic sur le bouton de validation: private void GuessButton_Clicked(object sender, EventArgs e) { int number = 0; if (leftTries > 0) { try { number = Int32.Parse(NumberEntry.Text); } catch { DisplayAlert("Erreur", "Il faut saisir un nombre entre 1 et 10", "OK"); NumberEntry.Text = ""; return; } bool resultat = teste_nombre(number); if (resultat == true) { #pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel ResultAction(guessNumber, true); #pragma warning restore CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel } else { NumberEntry.Text = ""; TriesLabel.Text = "Vies restantes : " + leftTries; if (leftTries == 0) { #pragma warning disable CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel ResultAction(guessNumber, false); #pragma warning restore CS4014 // Dans la mesure où cet appel n'est pas attendu, l'exécution de la méthode actuelle continue avant la fin de l'appel return; } NumberEntry.Focus(); } } }
StackLayout Entry_Row_Layout(ProductProperty Bind_Context) { var stack = new StackLayout { BackgroundColor = Color.White, Orientation = StackOrientation.Horizontal, HeightRequest = 60, Margin = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(20, 0, 20, 0) }; if (Bind_Context == null) { return(stack); } Entry entry = null; if (Bind_Context.IsNumberKeyboard) { entry = new NumberEntry(12) { IsEnabled = controlEnabled, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 40, VerticalOptions = LayoutOptions.Center, TextColor = (Color)App.Current.Resources["GreyishBrown"], FontFamily = "SanFranciscoDisplay-Regular", PlaceholderColor = Color.FromRgb(179, 179, 179) }; entry.Keyboard = Keyboard.Numeric; } else { entry = new Entry() { IsEnabled = controlEnabled, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 40, VerticalOptions = LayoutOptions.Center, TextColor = (Color)App.Current.Resources["GreyishBrown"], FontFamily = "SanFranciscoDisplay-Regular", PlaceholderColor = Color.FromRgb(179, 179, 179) }; } entry.SetBinding(Entry.TextProperty, "PropertyValue", BindingMode.TwoWay); entry.BindingContext = Bind_Context; var label = new Label { FontFamily = "SanFranciscoDisplay-Regular", HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, TextColor = (Color)App.Current.Resources["GreyishBrown"] }; label.SetBinding(Label.TextProperty, Settings.DeviceLanguage == "en" ? "PropertyName" : "PropertyName_FR"); label.BindingContext = Bind_Context; stack.Children.Add(label); stack.Children.Add(entry); return(stack); }
public SettingsWindow(Window parent) : base("CrystalBoy Settings") { int row = 0; masterContainer = new Grid { ColumnSpacing = 5, RowSpacing = 10 }; Add(masterContainer); //Window Size windowSizeLabel = new Label("Window Size:"); windowSizeWidth = new NumberEntry(Program.settings.WindowWidth, 1, 999999999) { InputPurpose = InputPurpose.Digits }; windowSizeHeight = new NumberEntry(Program.settings.WindowHeight, 1, 999999999) { InputPurpose = InputPurpose.Digits }; masterContainer.Attach(windowSizeLabel, 0, row, 1, 1); masterContainer.Attach(windowSizeWidth, 1, row, 1, 1); masterContainer.Attach(windowSizeHeight, 2, row, 1, 1); row++; //Hardware Type hardwareTypeLabel = new Label("Hardware Type:"); hardwareTypeList = new ComboBox(Enum.GetNames(typeof(HardwareType))); hardwareTypeList.Active = (int)Program.settings.HardwareType; hardwareTypeList.Changed += (sender, args) => { Program.settings.HardwareType = (HardwareType)hardwareTypeList.Active; }; masterContainer.Attach(hardwareTypeLabel, 0, row, 1, 1); masterContainer.Attach(hardwareTypeList, 1, row, 1, 1); row++; //Use Bootstrap useBootstrapLabel = new Label("Use Bootstrap Rom:"); useBootstrapButton = new CheckButton { Active = Program.settings.UseBootstrapRom }; useBootstrapButton.Toggled += (sender, args) => { Program.settings.UseBootstrapRom = useBootstrapButton.Active; }; masterContainer.Attach(useBootstrapLabel, 0, row, 1, 1); masterContainer.Attach(useBootstrapButton, 1, row, 1, 1); row++; //Limit Speed limitSpeedLabel = new Label("Limit Speed:"); limitSpeedButton = new CheckButton { Active = Program.settings.LimitSpeed }; limitSpeedButton.Toggled += (sender, args) => { Program.settings.LimitSpeed = limitSpeedButton.Active; }; masterContainer.Attach(limitSpeedLabel, 0, row, 1, 1); masterContainer.Attach(limitSpeedButton, 1, row, 1, 1); row++; //Rom Search Path romSearchPathLabel = new Label("Rom Search Path:"); romSearchPathEntry = new Entry(); masterContainer.Attach(romSearchPathLabel, 0, row, 1, 1); masterContainer.Attach(romSearchPathEntry, 1, row, 1, 1); row++; //Open Controller Configuration openControllerSettings = new Button("Controller Configuration"); openControllerSettings.Pressed += (sender, args) => { ControllerSettingsWindow controllerSettingsWindow = new ControllerSettingsWindow(this); }; masterContainer.Attach(openControllerSettings, 1, row, 1, 1); row++; //Save, Cancel, and Reset Buttons resetSettingsButton = new Button { Label = "Reset to Defaults" }; resetSettingsButton.Pressed += (sender, args) => { Program.settings = Settings.Default; ReloadInterfaceValues(); }; cancelSettingsButton = new Button { Label = "Cancel" }; cancelSettingsButton.Pressed += (sender, args) => { Program.settings = Settings.Load(); Close(); }; saveSettingsButton = new Button { Label = "Save" }; saveSettingsButton.Pressed += Save; masterContainer.Attach(resetSettingsButton, 0, row, 1, 1); masterContainer.Attach(cancelSettingsButton, 2, row, 1, 1); masterContainer.Attach(saveSettingsButton, 3, row, 30, 1); //Show ShowAll(); Resize(400, 300); DeleteEvent += (o, args) => { parent.Sensitive = true; }; ReloadInterfaceValues(); parent.Sensitive = false; parent.GetPosition(out int x, out int y); Move(x, y); }