private void Edit()
        {
            var listBoxItem = Parameters.SelectedItem as ListBoxItem;

            if (listBoxItem == null)
            {
                return;
            }

            var descriptor = listBoxItem.Tag as DataSourceParameterManager.DataSourceParameterDescriptor;

            if (descriptor == null)
            {
                return;
            }

            var dataSource = new DataSourceString(DataSourceField.Text);

            var result = descriptor.Instance.Execute(DatabaseUri, Field, dataSource);

            if (result == null)
            {
                return;
            }

            DataSourceField.Text = result.ToString();
        }
        private void Browse([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            var itemId      = new ItemId(DatabaseTreeViewItem.RootItemGuid);
            var databaseUri = DatabaseUri;

            var dataSource = new DataSourceString(DataSourceField.Text);

            var value = dataSource["datasource"];

            if (!string.IsNullOrEmpty(value))
            {
                Guid guid;
                if (Guid.TryParse(value, out guid))
                {
                    itemId = new ItemId(guid);
                }
            }

            var databaseName = dataSource["database"];

            if (string.IsNullOrEmpty(databaseName))
            {
                databaseName = dataSource["databasename"];
            }

            if (!string.IsNullOrEmpty(databaseName))
            {
                databaseUri = new DatabaseUri(DatabaseUri.Site, new DatabaseName(databaseName));
            }

            var itemUri = new ItemUri(databaseUri, itemId);

            var dialog = new SelectItemDialog();

            dialog.Initialize(Rocks.Resources.Browse, itemUri);

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

            dataSource.Path = string.Empty;
            dialog.GetSelectedItemPath(delegate(string itemPath)
            {
                dataSource.Remove(@"datasource");
                dataSource.Path      = itemPath;
                DataSourceField.Text = dataSource.ToString();
            });
        }
示例#3
0
        protected void SetDataSource([NotNull] DataSourceString dataSource)
        {
            Debug.ArgumentNotNull(dataSource, nameof(dataSource));

            var path = dataSource.Path;

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            if (path.StartsWith(@"query:", StringComparison.InvariantCultureIgnoreCase))
            {
                dataSource.Path = string.Empty;
                return;
            }

            dataSource["datasource"] = path;
            dataSource.Path          = string.Empty;
        }
示例#4
0
        public void Append([NotNull] DataSourceString url)
        {
            Assert.ArgumentNotNull(url, nameof(url));

            Append(url.Parameters);
        }
示例#5
0
 public abstract DataSourceString Execute(DatabaseUri databaseUri, BuildSourceField field, DataSourceString dataSource);