Example #1
0
 private void insertThemeExpressionToolStripMenuItem_Click(object sender, EventArgs e)
 {
     using (var theme = new ThemeCreator(_edSvc, _cls, this))
     {
         theme.ShowDialog();
     }
 }
Example #2
0
        private void NewMenuItem_Click(object sender, EventArgs e)
        {
            using (ThemeCreator tc = new ThemeCreator())
            {
                if (tc.ShowDialog() == DialogResult.OK)
                {
                    int   id = TempThemes.Count;
                    Theme t  = tc.Theme;
                    t.ID = id;
                    TempThemes.Add(t);
                    SettingsHaveChanged = true;
                }
            }

            LoadThemeImages(TempThemes);
        }
Example #3
0
        public ActionResult Create(ThemeInfo model)
        {
            if (!ModelState.IsValid)
            {
                return(this.InvalidModelState());
            }

            try
            {
                var creator = new ThemeCreator(model);
                creator.Create();
            }
            catch (ThemeCreateException ex)
            {
                return(this.Failed(ex.Message, HttpStatusCode.InternalServerError));
            }

            return(this.Ok());
        }
Example #4
0
        private void EditMenuItem_Click(object sender, EventArgs e)
        {
            using (ThemeCreator tc = new ThemeCreator((Theme)SelectedItem.Tag))
            {
                if (tc.ShowDialog() == DialogResult.OK)
                {
                    SelectedItem.Tag = tc.Theme;
                    for (int i = 0; i < TempThemes.Count; i++)
                    {
                        if (TempThemes[i].ID == tc.Theme.ID)
                        {
                            TempThemes[i] = tc.Theme;
                        }
                    }
                    SettingsHaveChanged = true;
                }
            }

            LoadThemeImages(TempThemes);
        }
Example #5
0
        private void btnCreateTheme_Click(object sender, EventArgs e)
        {
            ThemeCreator dlg = new ThemeCreator(_edSvc, _editedLayer, GetLayerClass(), _style);

            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                try
                {
                    _init = true;
                    ReSyncRulesToBindingList(_style);
                    CheckThemeExplodeStatus();
                    _edSvc.SyncSessionCopy();
                    GenerateStylePreviewsForVisibleRows(false);
                }
                finally
                {
                    _init = false;
                    _edSvc.HasChanged();
                }
            }
        }
        private void CreateThemeButton_Click(object sender, EventArgs e)
        {
            try
            {
                IVectorStyle owner = null;

                if (m_point != null)
                {
                    owner = m_point;
                }
                else if (m_line != null)
                {
                    owner = m_line;
                }
                else if (m_area != null)
                {
                    owner = m_area;
                }
                else if (m_comp != null)
                {
                    owner = m_comp;
                }

                if (owner is ICompositeTypeStyle)
                {
                    MessageBox.Show(Strings.CannotCreateThemeForCompositeStyleClassicEditor);
                    return;
                }

                ILayerDefinition       layer = (ILayerDefinition)m_owner.Editor.GetEditedResource();
                IVectorLayerDefinition vl    = (IVectorLayerDefinition)layer.SubLayer;
                if (string.IsNullOrEmpty(vl.FeatureName))
                {
                    MessageBox.Show(Strings.NoFeatureClassAssigned);
                    return;
                }
                var cls = m_owner.Editor.CurrentConnection.FeatureService.GetClassDefinition(vl.ResourceId, vl.FeatureName);
                if (cls == null)
                {
                    MessageBox.Show(string.Format(Strings.FeatureClassNotFound, vl.FeatureName));
                    return;
                }
                ThemeCreator dlg = new ThemeCreator(
                    m_owner.Editor,
                    layer,
                    m_owner.SelectedClass,
                    owner);
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    var area  = owner as IAreaVectorStyle;
                    var point = owner as IPointVectorStyle;
                    var line  = owner as ILineVectorStyle;
                    if (area != null)
                    {
                        SetItem(m_parent, area);
                    }
                    else if (point != null)
                    {
                        SetItem(m_parent, point);
                    }
                    else if (line != null)
                    {
                        SetItem(m_parent, line);
                    }

                    m_owner.HasChanged();
                    m_owner.UpdateDisplay();
                }
            }
            catch (Exception ex)
            {
                string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
                m_owner.SetLastException(ex);
                MessageBox.Show(this, string.Format(Strings.GenericError, msg), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }