コード例 #1
0
        public override void Execute(object parameter)
        {
            var context = Context;

            if (context == null)
            {
                return;
            }

            var control = context.Field.Control;

            if (control == null)
            {
                return;
            }

            var field = new BuildSourceField(context.Field.Type, control.GetValue());

            var dialog = new BuildSourceDialog(context.Field.FieldUris.First().DatabaseUri, field, control.GetValue());

            if (AppHost.Shell.ShowDialog(dialog) != true)
            {
                return;
            }

            control.SetValue(dialog.DataSource);
        }
コード例 #2
0
        private void Browse([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            Commit();

            var field = new BuildSourceField(Field.Type, Field.Source)
            {
                Name        = Field.Name,
                Id          = Field.Id,
                SectionName = Field.Section.Name,
                Shared      = Field.Shared,
                Unversioned = Field.Unversioned,
                Validations = Field.Validations
            };

            var dialog = new BuildSourceDialog(TemplateDesigner.TemplateUri.DatabaseUri, field, FieldSource.Text);

            if (AppHost.Shell.ShowDialog(dialog) != true)
            {
                return;
            }

            FieldSource.Text = dialog.DataSource;
        }