Exemplo n.º 1
0
        private void bColor_Click(object sender, System.EventArgs e)
        {
            ColorDialog cd = new ColorDialog();

            cd.AnyColor = true;
            cd.FullOpen = true;

            cd.CustomColors = ReportDesigner.GetCustomColors();
            cd.Color        =
                DesignerUtility.ColorFromHtml(cbColor.Text, System.Drawing.Color.Black);
            try
            {
                if (cd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                ReportDesigner.SetCustomColors(cd.CustomColors);
                if (sender == this.bColor)
                {
                    cbColor.Text = ColorTranslator.ToHtml(cd.Color);
                }
            }
            finally
            {
                cd.Dispose();
            }
            return;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load the Application, D8TopLevel, and make a call to its own get text.
        /// </summary>
        /// <param name="eTextEvent"></param>
        /// <param name="pMapProdInfo"></param>
        /// <returns></returns>
        protected override string GetText(mmAutoTextEvents eTextEvent, IMMMapProductionInfo pMapProdInfo)
        {
            if (App == null)
            {
                App = DesignerUtility.GetApplication();
            }
            if (App == null)
            {
                ToolUtility.LogError(_ProgID + ": Could not load Application Extension");
                return(_defaultDisplay);
            }

            ID8TopLevel topLevel = App.FindExtensionByName("DesignerTopLevel") as ID8TopLevel;

            if (topLevel == null)
            {
                return(_defaultDisplay);
            }

            string DisplayString = GetDxText(eTextEvent, pMapProdInfo, topLevel);

            if (string.IsNullOrEmpty(DisplayString))
            {
                return(_defaultDisplay);
            }
            else
            {
                return(DisplayString);
            }
        }
 private void bTestConnection_Click(object sender, System.EventArgs e)
 {
     if (DesignerUtility.TestConnection(this.cbDataProvider.Text, tbConnection.Text))
     {
         MessageBox.Show("Connection succeeded!", "Test Connection");
     }
 }
Exemplo n.º 4
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            Graphics g          = e.Graphics;
            Color    BlockColor = Color.Empty;
            int      left       = RECTCOLOR_LEFT;

            if (e.State == DrawItemState.Selected || e.State == DrawItemState.None)
            {
                e.DrawBackground();
            }
            if (e.Index == -1)
            {
                BlockColor = SelectedIndex < 0 ? BackColor : DesignerUtility.ColorFromHtml(this.Text, Color.Empty);
            }
            else
            {
                BlockColor = DesignerUtility.ColorFromHtml((string)this.Items[e.Index], Color.Empty);
            }
            // Fill rectangle
            if (BlockColor.IsEmpty && this.Text.StartsWith("="))
            {
                g.DrawString("fx", this.Font, Brushes.Black, e.Bounds);
            }
            else
            {
                g.FillRectangle(new SolidBrush(BlockColor), left, e.Bounds.Top + RECTCOLOR_TOP, RECTCOLOR_WIDTH,
                                ItemHeight - 2 * RECTCOLOR_TOP);
            }
            base.OnDrawItem(e);
        }
Exemplo n.º 5
0
        public override void SetUp()
        {
            base.SetUp();

            _dataSource = new BindableObjectDataSource();

            _mockRepository = new MockRepository();
            _stubSite       = _mockRepository.Stub <ISite>();
            SetupResult.For(_stubSite.DesignMode).Return(true);
            _dataSource.Site = _stubSite;

            _mockDesignerHost = _mockRepository.StrictMock <IDesignerHost>();
            SetupResult.For(_stubSite.GetService(typeof(IDesignerHost))).Return(_mockDesignerHost);

            var helperStub = _mockRepository.Stub <IDesignModeHelper> ();

            SetupResult.For(helperStub.DesignerHost).Return(_mockDesignerHost);

            _typeResolutionServiceMock = _mockRepository.StrictMock <ITypeResolutionService> ();
            SetupResult.For(_mockDesignerHost.GetService(typeof(ITypeResolutionService))).Return(_typeResolutionServiceMock);

            var typeDiscoveryServiceStub = _mockRepository.Stub <ITypeDiscoveryService> ();

            SetupResult.For(typeDiscoveryServiceStub.GetTypes(null, false)).IgnoreArguments().Return(Assembly.GetExecutingAssembly().GetTypes());
            SetupResult.For(_mockDesignerHost.GetService(typeof(ITypeDiscoveryService))).Return(typeDiscoveryServiceStub);

            // initialize IoC and mixin infrastructure to remove sideeffects in test.
            MixinTypeUtility.GetConcreteMixedType(typeof(SimpleBusinessObjectClass));

            DesignerUtility.SetDesignMode(helperStub);
        }
Exemplo n.º 6
0
        private void SetColor(ComboBox cbColor)
        {
            ColorDialog cd = new ColorDialog();

            cd.AnyColor = true;
            cd.FullOpen = true;

            cd.CustomColors = RdlDesignerForm.CustomColors;
            cd.Color        = DesignerUtility.ColorFromHtml(cbColor.Text, System.Drawing.Color.Empty);

            try
            {
                if (cd.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                RdlDesignerForm.CustomColors = cd.CustomColors;
                cbColor.Text = ColorTranslator.ToHtml(cd.Color);
            }
            finally
            {
                cd.Dispose();
            }

            return;
        }
Exemplo n.º 7
0
        void IDeviceSpecificDesigner.SetDeviceSpecific(String deviceSpecificParentID, DeviceSpecific ds)
        {
            Style style = (Style)_styleSheet[deviceSpecificParentID];

            Debug.Assert(null != style, "style is null in IDeviceSpecificDesigner.SetDeviceSpecific");
            if (null != ds)
            {
                ds.SetOwner((MobileControl)_styleSheet);
            }
            style.DeviceSpecific = ds;

            if (CurrentChoice != null && 0 == String.Compare(CurrentStyle.Name, deviceSpecificParentID, StringComparison.OrdinalIgnoreCase))
            {
                if (ds == null)
                {
                    CurrentChoice = null;
                }
                else
                {
                    // This makes sure that the CurrentChoice value is set to null is
                    // it was deleted during the deviceSpecific object editing
                    if (CurrentChoice.Filter.Length == 0)
                    {
                        TemplateDeviceFilter = SR.GetString(SR.DeviceFilter_DefaultChoice);
                    }
                    else
                    {
                        TemplateDeviceFilter = DesignerUtility.ChoiceToUniqueIdentifier(CurrentChoice);
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void tvTablesColumns_ExpandTable(TreeNode tNode)
        {
            if (tNode.Parent == null)                   // Check for Tables or Views
            {
                return;
            }

            if (tNode.FirstNode.Text != "")             // Have we already filled it out?
            {
                return;
            }

            // Need to obtain the column information for the requested table/view
            // suppress redraw until tree view is complete
            tvTablesColumns.BeginUpdate();

            string           sql        = "SELECT * FROM " + DesignerUtility.NormalizeSqlName(tNode.Text);
            List <SqlColumn> tColumns   = DesignerUtility.GetSqlColumns(_Draw, _DataSource, sql);
            bool             bFirstTime = true;

            foreach (SqlColumn sc in tColumns)
            {
                if (bFirstTime)
                {
                    bFirstTime           = false;
                    tNode.FirstNode.Text = sc.Name;
                }
                else
                {
                    tNode.Nodes.Add(sc.Name);
                }
            }

            tvTablesColumns.EndUpdate();
        }
Exemplo n.º 9
0
        public void DesignModeIsDetected()
        {
            var service =
                (ITypeDiscoveryService)PrivateInvoke.InvokeNonPublicStaticMethod(typeof(DeclarativeConfigurationBuilder), "GetTypeDiscoveryService");

            Assert.That(service, Is.InstanceOf(typeof(AssemblyFinderTypeDiscoveryService)));

            var repository           = new MockRepository();
            var designModeHelperMock = repository.StrictMock <IDesignModeHelper> ();
            var designerHostMock     = repository.StrictMock <IDesignerHost>();
            var designerServiceMock  = repository.StrictMock <ITypeDiscoveryService> ();

            designModeHelperMock.Expect(mock => mock.DesignerHost).Return(designerHostMock);
            designerHostMock.Expect(mock => mock.GetService(typeof(ITypeDiscoveryService))).Return(designerServiceMock);

            repository.ReplayAll();

            DesignerUtility.SetDesignMode(designModeHelperMock);
            try
            {
                service = (ITypeDiscoveryService)PrivateInvoke.InvokeNonPublicStaticMethod(typeof(DeclarativeConfigurationBuilder), "GetTypeDiscoveryService");

                Assert.That(service, Is.Not.InstanceOf(typeof(AssemblyFinderTypeDiscoveryService)));
                Assert.That(service, Is.SameAs(designerServiceMock));
            }
            finally
            {
                DesignerUtility.ClearDesignMode();
            }

            repository.VerifyAll();
        }
Exemplo n.º 10
0
 void SetPadding(string l, PropertyExpr pe, bool bMinus) //Josh: Eddited to allow negative padding on top and left
 {
     if (!_pri.IsExpression(pe.Expression))
     {
         DesignerUtility.ValidateSize(pe.Expression, true, /*false*/ bMinus);
     }
     SetStyleValue(l, pe.Expression);
 }
Exemplo n.º 11
0
 void SetPadding(string l, PropertyExpr pe)
 {
     if (!_pri.IsExpression(pe.Expression))
     {
         DesignerUtility.ValidateSize(pe.Expression, true, false);
     }
     SetStyleValue(l, pe.Expression);
 }
Exemplo n.º 12
0
        private void FillChoicesComboBox()
        {
            Debug.Assert(_dsd != null);

            _cmbChoices.Items.Clear();

            if (null != _ds || null != _dsd.UnderlyingObject)
            {
                _cmbChoices.Items.Add(SR.GetString(SR.DeviceFilter_NoChoice));
            }

            if (null == _ds)
            {
                if (_cmbChoices.Items.Count > 0)
                {
                    _cmbChoices.SelectedIndex = 0;
                }
            }
            else
            {
                bool addedDefault = false;
                foreach (DeviceSpecificChoice choice in _ds.Choices)
                {
                    if (String.Empty == choice.Filter)
                    {
                        if (!addedDefault)
                        {
                            _cmbChoices.Items.Add(SR.GetString(SR.DeviceFilter_DefaultChoice));
                            addedDefault = true;
                        }
                    }
                    else
                    {
                        if (!choice.Filter.Equals(SR.GetString(SR.DeviceFilter_NoChoice)))
                        {
                            _cmbChoices.Items.Add(DesignerUtility.ChoiceToUniqueIdentifier(choice));
                        }
                    }
                }
                if (null != _designer.CurrentChoice && _designer.CurrentDeviceSpecific == _ds)
                {
                    if (String.Empty == _designer.CurrentChoice.Filter)
                    {
                        _cmbChoices.SelectedItem = SR.GetString(SR.DeviceFilter_DefaultChoice);
                    }
                    else
                    {
                        _cmbChoices.SelectedItem = DesignerUtility.ChoiceToUniqueIdentifier(_designer.CurrentChoice);
                    }
                }
                else
                {
                    Debug.Assert(_cmbChoices.Items.Count > 0);
                    _cmbChoices.SelectedItem = SR.GetString(SR.DeviceFilter_NoChoice);
                }
            }
        }
Exemplo n.º 13
0
        public string GetConstructionNotes(ID8TopLevel topLevel, IEnvelope FilterExtent)
        {
            //Parse the Design Tree
            ID8List TopList = topLevel as ID8List;

            TopList.Reset();

            IMMPxApplication PxApp = null;

            try
            {
                PxApp = DesignerUtility.GetPxApplication();
            }
            catch (Exception ex)
            {
                ToolUtility.LogError(_ProgID + ": Could obtain a Px Application reference.", ex);
                return(_defaultDisplay);
            }

            try
            {
                TopList.Reset();
                ID8List WorkRequest = TopList.Next(false) as ID8List;
                if (WorkRequest == null)
                {
                    return("");
                }

                //WorkRequest.Reset();
                //ID8List Design = WorkRequest.Next(false) as ID8List;

                //Get the Design XML
                IMMPersistentXML WrXml = WorkRequest as IMMPersistentXML;

                string result = Utility.LabellingUtility.GetConstructionNotes(PxApp, WrXml, FilterExtent);
                if (string.IsNullOrEmpty(result))
                {
                    return(_NoFeatures);
                }
                else
                {
                    return(result);
                }
            }
            catch (ApplicationException apex)
            {
                //ignore exception, no features
                return(_NoFeatures);
            }
            catch (Exception ex)
            {
                ToolUtility.LogError(_ProgID + ": Error Retrieving Construction Notes", ex);
                return(_defaultDisplay);
            }
        }
Exemplo n.º 14
0
        private void bGetFilename_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Data source reference files (*.dsr)|*.dsr" +
                         "|All files (*.*)|*.*";
            ofd.FilterIndex = 1;
            if (tbFilename.Text.Length > 0)
            {
                ofd.FileName = tbFilename.Text;
            }
            else
            {
                ofd.FileName = "*.dsr";
            }

            ofd.Title        = "Specify Data Source Reference File Name";
            ofd.DefaultExt   = "dsr";
            ofd.AddExtension = true;

            try
            {
                if (_FileName != null)
                {
                    ofd.InitialDirectory = Path.GetDirectoryName(_FileName.LocalPath);
                }
            }
            catch
            {
            }
            try
            {
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        string dsr = DesignerUtility.RelativePathTo(
                            Path.GetDirectoryName(_FileName.LocalPath), Path.GetDirectoryName(ofd.FileName));

                        string f = Path.GetFileNameWithoutExtension(ofd.FileName);

                        tbFilename.Text = dsr == "" ? f : dsr + Path.DirectorySeparatorChar + f;
                    }
                    catch
                    {
                        tbFilename.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
                    }
                }
            }
            finally
            {
                ofd.Dispose();
            }
        }
 private void cbDataProvider_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     if (cbDataProvider.Text == "ODBC")
     {
         lODBC.Visible = cbOdbcNames.Visible = true;
         DesignerUtility.FillOdbcNames(cbOdbcNames);
     }
     else
     {
         lODBC.Visible = cbOdbcNames.Visible = false;
     }
 }
Exemplo n.º 16
0
 private void debug_CheckChoicesForDuplicate(DeviceSpecificChoice runtimeChoice)
 {
     foreach (ChoiceTreeNode choiceNode in _cbChoices.Items)
     {
         if (choiceNode.Name == runtimeChoice.Filter &&
             choiceNode.RuntimeChoice.Argument == runtimeChoice.Argument)
         {
             Debug.Fail("Loaded duplicate choice: " +
                        DesignerUtility.ChoiceToUniqueIdentifier(runtimeChoice));
         }
     }
 }
        public void GetTypeResolutionService_DesignModeContext()
        {
            var typeResolutionServiceStub = MockRepository.GenerateStub <ITypeResolutionService>();
            var designerHostMock          = MockRepository.GenerateStub <IDesignerHost>();

            designerHostMock.Expect(_ => _.GetService(typeof(ITypeResolutionService))).Return(typeResolutionServiceStub);

            DesignerUtility.SetDesignMode(new StubDesignModeHelper(designerHostMock));
            Assert.That(ContextAwareTypeUtility.GetTypeResolutionService(), Is.SameAs(typeResolutionServiceStub));

            designerHostMock.VerifyAllExpectations();
        }
Exemplo n.º 18
0
        public void Apply()
        {
            XmlNode rNode = _Draw.GetReportNode();

            _Draw.SetElement(rNode, "Width", DesignerUtility.MakeValidSize(tbWidth.Text, false));
            _Draw.SetElement(rNode, "Author", tbReportAuthor.Text);
            _Draw.SetElement(rNode, "Description", tbReportDescription.Text);
            _Draw.SetElement(rNode, "PageWidth", tbPageWidth.Text);
            _Draw.SetElement(rNode, "PageHeight", tbPageHeight.Text);
            if (tbMarginLeft.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "LeftMargin", tbMarginLeft.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "LeftMargin");
            }
            if (tbMarginRight.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "RightMargin", tbMarginRight.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "RightMargin");
            }
            if (tbMarginBottom.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "BottomMargin", tbMarginBottom.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "BottomMargin");
            }
            if (tbMarginTop.Text.Trim().Length > 0)
            {
                _Draw.SetElement(rNode, "TopMargin", tbMarginTop.Text);
            }
            else
            {
                _Draw.RemoveElement(rNode, "TopMargin");
            }
            // Page header settings
            XmlNode phNode = _Draw.GetCreateNamedChildNode(rNode, "PageHeader");

            _Draw.SetElement(phNode, "PrintOnFirstPage", this.chkPHFirst.Checked?"true":"false");
            _Draw.SetElement(phNode, "PrintOnLastPage", this.chkPHLast.Checked?"true":"false");
            // Page footer settings
            XmlNode pfNode = _Draw.GetCreateNamedChildNode(rNode, "PageFooter");

            _Draw.SetElement(pfNode, "PrintOnFirstPage", this.chkPFFirst.Checked?"true":"false");
            _Draw.SetElement(pfNode, "PrintOnLastPage", this.chkPFLast.Checked?"true":"false");
        }
Exemplo n.º 19
0
        protected override String GetDesignTimeNormalHtml()
        {
            String curChoice, message;
            bool   _isNonHtmlSchema = false;

            if (null == CurrentChoice)
            {
                curChoice = SR.GetString(SR.DeviceSpecific_PropNotSet);
                message   = SR.GetString(SR.DeviceSpecific_DefaultMessage);
            }
            else
            {
                if (CurrentChoice.Filter.Length == 0)
                {
                    curChoice = SR.GetString(SR.DeviceFilter_DefaultChoice);
                }
                else
                {
                    curChoice = HttpUtility.HtmlEncode(DesignerUtility.ChoiceToUniqueIdentifier(CurrentChoice));
                }

                if (IsHTMLSchema(CurrentChoice))
                {
                    message = SR.GetString(SR.DeviceSpecific_TemplateEditingMessage);
                }
                else
                {
                    _isNonHtmlSchema = true;
                    message          = SR.GetString(SR.DeviceSpecific_DefaultMessage);
                }
            }

            if (_isDuplicate || _isNonHtmlSchema)
            {
                return(String.Format(CultureInfo.CurrentCulture, _duplicateDesignTimeHTML,
                                     new Object[]
                {
                    _ds.Site.Name,
                    curChoice,
                    message,
                    _isDuplicate ? MobileControlDesigner.errorIcon :
                    MobileControlDesigner.infoIcon,
                    _isDuplicate ?
                    SR.GetString(SR.DeviceSpecific_DuplicateWarningMessage) :
                    SR.GetString(SR.MobileControl_NonHtmlSchemaErrorMessage)
                }));
            }
            else
            {
                return(String.Format(CultureInfo.CurrentCulture, _designTimeHTML, _ds.Site.Name, curChoice, message));
            }
        }
        public void TearDown()
        {
            PrivateInvoke.SetNonPublicStaticField(
                typeof(ContextAwareTypeUtility),
                "s_defaultTypeDiscoveryService",
                new Lazy <ITypeDiscoveryService> (() => _oldTypeDiscoveryService));
            PrivateInvoke.SetNonPublicStaticField(
                typeof(ContextAwareTypeUtility),
                "s_defaultTypeResolutionService",
                new Lazy <ITypeResolutionService> (() => _oldTypeResolutionService));
            DesignerUtility.ClearDesignMode();

            TypeDiscoveryConfiguration.SetCurrent(_oldTypeDiscoveryConfiguration);
            TypeResolutionConfiguration.SetCurrent(_oldTypeResolutionConfiguration);
        }
Exemplo n.º 21
0
        private void tbSize_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            TextBox tb = sender as TextBox;

            if (tb == null)
            {
                return;
            }

            try { DesignerUtility.ValidateSize(tb.Text, false, false); }
            catch (Exception ex)
            {
                e.Cancel = true;
                MessageBox.Show(string.Format("Size value of {0} is invalid.\r\n", tb.Text, ex.Message), tb.Tag + " Field Invalid");
            }
        }
Exemplo n.º 22
0
        public bool IsValid()
        {
            XmlNode ri = this._ReportItems[0] as XmlNode;

            if (tbName.Enabled && fName)
            {
                string nerr = _Draw.NameError(ri, this.tbName.Text);
                if (nerr != null)
                {
                    MessageBox.Show(nerr, "Name");
                    return(false);
                }
            }
            string name = "";

            try
            {                   // allow minus if Line and only one item selected
                bool bMinus = ri.Name == "Line" && tbName.Enabled? true: false;
                if (fLeft)
                {
                    name = "Left";
                    DesignerUtility.ValidateSize(this.tbLeft.Text, true, false);
                }
                if (fTop)
                {
                    name = "Top";
                    DesignerUtility.ValidateSize(this.tbTop.Text, true, false);
                }
                if (fWidth)
                {
                    name = "Width";
                    DesignerUtility.ValidateSize(this.tbWidth.Text, true, bMinus);
                }
                if (fHeight)
                {
                    name = "Height";
                    DesignerUtility.ValidateSize(this.tbHeight.Text, true, bMinus);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, name + " Size is Invalid");
                return(false);
            }

            return(true);
        }
        private bool ValidateAppliedFilters()
        {
            StringCollection duplicateChoices =
                DesignerUtility.GetDuplicateChoiceTreeNodes(
                    _appliedFiltersList.TvList.Nodes
                    );

            if (duplicateChoices.Count > 0)
            {
                GenericUI.ShowWarningMessage(
                    SR.GetString(SR.AppliedDeviceFiltersDialog_Title),
                    SR.GetString(SR.AppliedDeviceFiltersDialog_DuplicateChoices,
                                 GenericUI.BuildCommaDelimitedList(duplicateChoices))
                    );
                return(false);
            }
            return(true);
        }
        public void SetUp()
        {
            _oldTypeDiscoveryService        = ContextAwareTypeUtility.GetTypeDiscoveryService();
            _oldTypeDiscoveryConfiguration  = TypeDiscoveryConfiguration.Current;
            _oldTypeResolutionService       = ContextAwareTypeUtility.GetTypeResolutionService();
            _oldTypeResolutionConfiguration = TypeResolutionConfiguration.Current;

            PrivateInvoke.SetNonPublicStaticField(
                typeof(ContextAwareTypeUtility),
                "s_defaultTypeDiscoveryService",
                new Lazy <ITypeDiscoveryService> (() => TypeDiscoveryConfiguration.Current.CreateTypeDiscoveryService()));
            PrivateInvoke.SetNonPublicStaticField(
                typeof(ContextAwareTypeUtility),
                "s_defaultTypeResolutionService",
                new Lazy <ITypeResolutionService> (() => TypeResolutionConfiguration.Current.CreateTypeResolutionService()));
            DesignerUtility.ClearDesignMode();
            TypeDiscoveryConfiguration.SetCurrent(new TypeDiscoveryConfiguration());
            TypeResolutionConfiguration.SetCurrent(new TypeResolutionConfiguration(new DefaultTypeResolutionService()));
        }
        public override void Initialize(IComponent component)
        {
            ArgumentUtility.CheckNotNull("component", component);

            base.Initialize(component);
            SetViewFlags(ViewFlags.DesignTimeHtmlRequiresLoadComplete, true);

            Assertion.IsNotNull(component.Site, "The component does not have a Site.");
            IDesignerHost designerHost = (IDesignerHost)component.Site.GetService(typeof(IDesignerHost));

            Assertion.IsNotNull(designerHost, "No IDesignerHost found.");

            if (!DesignerUtility.IsDesignMode || !object.ReferenceEquals(DesignerUtility.DesignModeHelper.DesignerHost, designerHost))
            {
                DesignerUtility.SetDesignMode(new WebDesginModeHelper(designerHost));
            }

            EnsureCheckForDuplicateAssemblies();
        }
Exemplo n.º 26
0
 public bool IsValid()
 {
     if (fFontSize)
     {
         try
         {
             if (!this.cbFontSize.Text.Trim().StartsWith("="))
             {
                 DesignerUtility.ValidateSize(this.cbFontSize.Text, false, false);
             }
         }
         catch (Exception e)
         {
             MessageBox.Show(e.Message, "Invalid Font Size");
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 27
0
        public bool IsValid()
        {
            try
            {
                if (fWidth)
                {
                    DesignerUtility.ValidateSize(this.tbColumnWidth.Text, true, false);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Width is Invalid");
                return(false);
            }

            if (fHidden)
            {
                string vh = this.tbHidden.Text.Trim();
                if (vh.Length > 0)
                {
                    if (vh.StartsWith("="))
                    {
                    }
                    else
                    {
                        vh = vh.ToLower();
                        switch (vh)
                        {
                        case "true":
                        case "false":
                            break;

                        default:
                            MessageBox.Show(String.Format("{0} must be an expression or 'true' or 'false'", tbHidden.Text), "Hidden is Invalid");
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
        void IDeviceSpecificDesigner.SetDeviceSpecific(String deviceSpecificParentID, DeviceSpecific ds)
        {
            Debug.Assert(_defaultDeviceSpecificIdentifier == deviceSpecificParentID);

            if (_mobileControl != null)
            {
                if (null != ds)
                {
                    ds.SetOwner(_mobileControl);
                }
                _mobileControl.DeviceSpecific = ds;
            }
            else if (_control != null && ds == null)
            {
                Debug.Assert(_control is DeviceSpecific);

                // Clear the choices if it is a DeviceSpecific control.
                ((DeviceSpecific)_control).Choices.Clear();
            }

            if (null != CurrentChoice)
            {
                if (null == ds)
                {
                    CurrentChoice = null;
                }
                else
                {
                    // This makes sure that the CurrentChoice value is set to null if
                    // it was deleted during the deviceSpecific object editing
                    if (CurrentChoice.Filter.Length == 0)
                    {
                        TemplateDeviceFilter = SR.GetString(SR.DeviceFilter_DefaultChoice);
                    }
                    else
                    {
                        TemplateDeviceFilter = DesignerUtility.ChoiceToUniqueIdentifier(CurrentChoice);
                    }
                }
            }
        }
Exemplo n.º 29
0
        private bool ValidateLoadedChoices()
        {
            StringCollection duplicateChoices =
                DesignerUtility.GetDuplicateChoiceTreeNodes(
                    _cbChoices.Items
                    );

            if (duplicateChoices.Count > 0)
            {
                if (!_ignoreSelectionChanged)
                {
                    GenericUI.ShowWarningMessage(
                        SR.GetString(SR.PropertyOverridesDialog_Title),
                        SR.GetString(SR.PropertyOverridesDialog_DuplicateChoices,
                                     GenericUI.BuildCommaDelimitedList(duplicateChoices))
                        );
                }
                return(false);
            }
            return(true);
        }
Exemplo n.º 30
0
        private DeviceSpecificChoice GetChoiceFromIdentifier(String choiceIdentifier, DeviceSpecific ds)
        {
            if (null == ds)
            {
                return(null);
            }

            Debug.Assert(ds.Choices != null);

            foreach (DeviceSpecificChoice choice in ds.Choices)
            {
                if (DesignerUtility.ChoiceToUniqueIdentifier(choice).Equals(choiceIdentifier) ||
                    (String.Empty == choice.Filter &&
                     choiceIdentifier.Equals(SR.GetString(SR.DeviceFilter_DefaultChoice))))
                {
                    return(choice);
                }
            }

            return(null);
        }