Example #1
0
        public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IFeatureService featSvc, FdoProviderCapabilities caps)
            : this()
        {
            _fsId = fsId;
            _mode = mode;
            _cls = cls;
            _featSvc = featSvc;

            IQueryControl ctrl = null;
            switch (_mode)
            {
                case QueryMode.SQL:
                    ctrl = new SqlQueryCtrl(fsId, featSvc);
                    _inner = ctrl;
                    break;
                case QueryMode.Standard:
                    ctrl = new StandardQueryCtrl(fsId, featSvc, cls, caps);
                    _inner = ctrl;
                    break;
            }

            if (ctrl == null)
            {
                throw new ArgumentException(Strings.UnknownQueryMode);
            }

            ctrl.Content.Dock = DockStyle.Fill;
            queryPane.Controls.Add(ctrl.Content);
        }
 public FdoExpressionCompletionDataProvider(ClassDefinition cls, FdoProviderCapabilities caps)
 {
     _klass = cls;
     _caps = caps;
     this.DefaultIndex = 0;
     this.PreSelection = null;
     this.ImageList = new System.Windows.Forms.ImageList();
     this.ImageList.Images.Add(Properties.Resources.block);
     this.ImageList.Images.Add(Properties.Resources.property);
     this.ImageList.Images.Add(Properties.Resources.funnel);
 }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StandardQueryCtrl"/> class.
 /// </summary>
 /// <param name="fsId">The fs id.</param>
 /// <param name="featSvc">The feat SVC.</param>
 /// <param name="cls">The CLS.</param>
 /// <param name="caps">The caps.</param>
 public StandardQueryCtrl(string fsId, IFeatureService featSvc, ClassDefinition cls, FdoProviderCapabilities caps)
     : this()
 {
     _fsId = fsId;
     _featSvc = featSvc;
     _cls = cls;
     _caps = caps;
     foreach (var prop in cls.Properties)
     {
         chkProperties.Items.Add(prop.Name, true);
     }
 }
 /// <summary>
 /// Deserializes xml markup from file into an FdoProviderCapabilities object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output FdoProviderCapabilities object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out FdoProviderCapabilities obj, out System.Exception exception)
 {
     exception = null;
     obj = default(FdoProviderCapabilities);
     try {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out FdoProviderCapabilities obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an FdoProviderCapabilities object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output FdoProviderCapabilities object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out FdoProviderCapabilities obj, out System.Exception exception)
 {
     exception = null;
     obj = default(FdoProviderCapabilities);
     try {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex) {
         exception = ex;
         return false;
     }
 }
 public static bool LoadFromFile(string fileName, out FdoProviderCapabilities obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
Example #8
0
        /// <summary>
        /// Initializes the dialog.
        /// </summary>
        /// <param name="featSvc">The feature service.</param>
        /// <param name="caps">The provider capabilities.</param>
        /// <param name="cls">The class definition.</param>
        /// <param name="featuresSourceId">The features source id.</param>
        /// <param name="attachStylizationFunctions">if set to <c>true</c> stylization functions are also attached</param>
        public void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
        {
            try
            {
                _cls = cls;
                _featSvc = featSvc;
                m_featureSource = featuresSourceId;
                _caps = caps;

                SortedList<string, PropertyDefinition> sortedCols = new SortedList<string, PropertyDefinition>();
                foreach (var col in _cls.Properties)
                {
                    sortedCols.Add(col.Name, col);
                }

                ColumnName.Items.Clear();
                ColumnName.Tag = sortedCols;

                foreach (var col in sortedCols.Values)
                {
                    string name = col.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.Click += delegate
                    {
                        InsertText(name);
                    };
                    btnProperties.DropDown.Items.Add(btn);

                    ColumnName.Items.Add(name);
                }

                if (ColumnName.Items.Count > 0)
                    ColumnName.SelectedIndex = 0;

                //Functions
                SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition> sortedFuncs = new SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition>();
                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in caps.Expression.FunctionDefinitionList)
                {
                    sortedFuncs.Add(func.Name, func);
                }

                if (attachStylizationFunctions)
                {
                    foreach (var func in Utility.GetStylizationFunctions())
                    {
                        sortedFuncs.Add(func.Name, func);
                    }
                }

                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in sortedFuncs.Values)
                {
                    string name = func.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.ToolTipText = func.Description;

                    string fmt = "{0}({1})"; //NOXLATE
                    List<string> args = new List<string>();
                    foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
                    {
                        args.Add(argDef.Name.Trim());
                    }
                    string expr = string.Format(fmt, name, FdoExpressionCompletionDataProvider.StringifyFunctionArgs(args));
                    btn.Click += delegate
                    {
                        InsertText(expr);
                    };
                    btnFunctions.DropDown.Items.Add(btn);
                }

                //Spatial Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Spatial)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnSpatial.DropDown.Items.Add(btn);
                }

                //Distance Operators
                foreach (FdoProviderCapabilitiesFilterOperation1 op in caps.Filter.Distance)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnDistance.DropDown.Items.Add(btn);
                }

                //Conditional Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Condition)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnCondition.DropDown.Items.Add(btn);
                }
            }
            catch
            {
            }
        }
Example #9
0
 public override void Bind(IEditorService service)
 {
     //Only available on MGOS 2.2 and above
     this.LocalPreviewEnabled = service.SiteVersion >= new Version(2, 2);
     _fs = (IFeatureSource)service.GetEditedResource();
     _caps = service.FeatureService.GetProviderCapabilities(_fs.Provider);
     _fsvc = service.FeatureService;
     _rsvc = service.ResourceService;
     _edsvc = service;
     _edsvc.RegisterCustomNotifier(this);
     this.ConfigEnabled = _caps.Connection.SupportsConfiguration;
 }
        /// <summary>
        /// Reloads the tree.
        /// </summary>
        /// <param name="fsId">The fs id.</param>
        /// <param name="caps">The caps.</param>
        public void ReloadTree(string fsId, FdoProviderCapabilities caps)
        {
            currentFsId = fsId;
            _caps = caps;
            ClearPreviewPanes();
            trvSchema.Nodes.Clear();

            string[] schemaNames = _fsvc.GetSchemas(currentFsId);
            foreach (var s in schemaNames)
            {
                var schemaNode = new TreeNode(s);
                schemaNode.Tag = new SchemaNodeTag(s);
                schemaNode.ImageIndex = schemaNode.SelectedImageIndex = IDX_SCHEMA;
                schemaNode.Nodes.Add(Strings.TextLoading);
                trvSchema.Nodes.Add(schemaNode);
            }
        }
        /// <summary>
        /// Initializes the dialog.
        /// </summary>
        /// <param name="featSvc">The feature service.</param>
        /// <param name="caps">The provider capabilities.</param>
        /// <param name="cls">The class definition.</param>
        /// <param name="featuresSourceId">The features source id.</param>
        /// <param name="attachStylizationFunctions">If true, Stylization FDO functions will be included</param>
        public void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
        {
            try
            {
                _cls = cls;
                _featSvc = featSvc;
                m_featureSource = featuresSourceId;

                //TODO: Perhaps add column type and indication of primary key
                SortedList<string, PropertyDefinition> sortedCols = new SortedList<string, PropertyDefinition>();
                foreach (var col in _cls.Properties)
                {
                    sortedCols.Add(col.Name, col);
                }

                ColumnName.Items.Clear();
                ColumnName.Tag = sortedCols;

                foreach (var col in sortedCols.Values)
                {
                    string name = col.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.Click += delegate
                    {
                        InsertText(name);
                    };
                    btnProperties.DropDown.Items.Add(btn);

                    ColumnName.Items.Add(name);
                }

                if (ColumnName.Items.Count > 0)
                    ColumnName.SelectedIndex = 0;

                LoadCompletableProperties(_cls.Properties);

                //TODO: Figure out how to translate the enums into something usefull

                //Functions
                SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition> sortedFuncs = new SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition>();
                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in caps.Expression.FunctionDefinitionList)
                {
                    sortedFuncs.Add(func.Name, func);
                }

                if (attachStylizationFunctions)
                {
                    foreach (var func in GetStylizationFunctions())
                    {
                        sortedFuncs.Add(func.Name, func);
                    }
                }

                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in sortedFuncs.Values)
                {
                    string name = func.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.ToolTipText = func.Description;
                    string fmt = "{0}({1})";
                    List<string> args = new List<string>();
                    foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
                    {
                        args.Add(argDef.Name.Trim());
                    }
                    string expr = string.Format(fmt, name, string.Join(", ", args.ToArray()));
                    btn.Click += delegate
                    {
                        InsertText(expr);
                    };
                    btnFunctions.DropDown.Items.Add(btn);
                }
                LoadCompletableFunctions(caps.Expression.FunctionDefinitionList);
                if (attachStylizationFunctions)
                    LoadCompletableFunctions(GetStylizationFunctions());

                //Spatial Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Spatial)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertFilter(name);
                    };
                    btnSpatial.DropDown.Items.Add(btn);
                }

                //Distance Operators
                foreach (FdoProviderCapabilitiesFilterOperation1 op in caps.Filter.Distance)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertFilter(name);
                    };
                    btnDistance.DropDown.Items.Add(btn);
                }

                //Conditional Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Condition)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertFilter(name);
                    };
                    btnCondition.DropDown.Items.Add(btn);
                }

                /*try
                {
                    /*FdoProviderCapabilities cap = m_connection.GetProviderCapabilities(m_providername);
                    foreach (FdoProviderCapabilitiesFilterType cmd in cap.Filter.Condition)
                        FunctionCombo.Items.Add(cmd.ToString());

                    FunctionLabel.Enabled = FunctionCombo.Enabled = true;
                }
                catch
                {
                    FunctionLabel.Enabled = FunctionCombo.Enabled = false;
                }*/
            }
            catch
            {
            }
        }