コード例 #1
0
ファイル: ListUI.xaml.cs プロジェクト: psryland/rylogic_code
        // Example Usage:
        //  var dlg = new ListUI(owner)
        //  {
        //      Title = "Available Options",
        //      Prompt = "Choose one of these",
        //      SelectionMode = SelectionMode.Extended,
        //      DisplayMember = nameof(Thing.Name),
        //      AllowCancel = true,
        //  };
        //  dlg.Items.AddRange(Model.AllTheThings());
        //  if (dlg.ShowDialog() == true)
        //  {
        //      Use(dlg.SelectedItems.Cast<Thing>());
        //  }

        public ListUI(Window?owner = null)
        {
            InitializeComponent();
            Owner       = owner;
            Icon        = Owner?.Icon;
            AllowCancel = false;
            Items       = new ObservableCollection <object>();
            DataContext = this;

            Accept = Command.Create(this, () =>
            {
                if (!IsValid)
                {
                    return;
                }
                DialogResult = true;
                Close();
            });
            m_list.SelectionChanged += (s, a) =>
            {
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsValid)));
            };
            m_list.PreviewMouseDoubleClick += (s, a) =>
            {
                Accept.Execute();
            };
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            acceptButton        = FindViewById <LinearLayout>(Resource.Id.okButton);
            acceptButton.Click += (o, e) => Accept.Execute().Subscribe();

            canceltButton        = FindViewById <LinearLayout>(Resource.Id.cancelButton);
            canceltButton.Click += (o, e) => Cancel.Execute().Subscribe();
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            monday    = FindViewById <CheckBox>(Resource.Id.mondayCheckBox);
            tuesday   = FindViewById <CheckBox>(Resource.Id.tuesdayCheckBox);
            wednesday = FindViewById <CheckBox>(Resource.Id.wednesdayCheckBox);
            thursday  = FindViewById <CheckBox>(Resource.Id.thursdayCheckBox);
            friday    = FindViewById <CheckBox>(Resource.Id.fridayCheckBox);
            saturday  = FindViewById <CheckBox>(Resource.Id.saturdayCheckBox);
            sunday    = FindViewById <CheckBox>(Resource.Id.sundayCheckBox);
            Accept    = ReactiveCommand.Create <Unit, bool[]>(x =>
            {
                return(GetSelectedDays());
            }
                                                              );
            acceptButton        = FindViewById <LinearLayout>(Resource.Id.okButton);
            acceptButton.Click += (o, e) => Accept.Execute().Subscribe();

            canceltButton        = FindViewById <LinearLayout>(Resource.Id.cancelButton);
            canceltButton.Click += (o, e) => Cancel.Execute().Subscribe();
        }