Exemple #1
0
        public override void Execute(object parameter)
        {
            var context = parameter as TemplateDesignerContext;

            if (context == null)
            {
                return;
            }

            var d = new SetIconDialog();

            d.Initialize(context.TemplateDesigner.TemplateUri.Site, context.TemplateDesigner.TemplateIcon);
            if (AppHost.Shell.ShowDialog(d) != true)
            {
                return;
            }

            context.TemplateDesigner.TemplateIcon = d.FileName;

            var path = @"/sitecore/shell/~/icon/" + d.FileName.Replace(@"16x16", @"32x32");

            var icon = new Icon(context.TemplateDesigner.TemplateUri.Site, path);

            context.TemplateDesigner.QuickInfoIcon.Source = icon.GetSource();

            context.TemplateDesigner.SetModified(true);
        }
Exemple #2
0
        public override void Execute(object parameter)
        {
            var context = parameter as IItemSelectionContext;

            if (context == null)
            {
                return;
            }

            var firstItem = context.Items.FirstOrDefault();

            if (firstItem == null)
            {
                return;
            }

            var iconPath = firstItem.Icon.IconPath;

            foreach (var item in context.Items)
            {
                if (item.Icon.IconPath != iconPath)
                {
                    iconPath = string.Empty;
                }
            }

            var n = iconPath.IndexOf("~/icon/", StringComparison.InvariantCultureIgnoreCase);

            if (n >= 0)
            {
                iconPath = iconPath.Mid(n + 7);
            }

            n = iconPath.IndexOf("/IconCache/", StringComparison.InvariantCultureIgnoreCase);
            if (n >= 0)
            {
                iconPath = iconPath.Mid(n + 11);
            }

            var d = new SetIconDialog();

            d.Initialize(firstItem.ItemUri.Site, iconPath);
            if (AppHost.Shell.ShowDialog(d) != true)
            {
                return;
            }

            var value = d.FileName.Replace("32x32", "16x16");

            foreach (var item in context.Items)
            {
                ItemModifier.Edit(item.ItemUri, FieldIds.Icon, value);
            }
        }
Exemple #3
0
        private void Browse([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            var d = new SetIconDialog();

            d.Initialize(sourceField.FieldUris.First().ItemVersionUri.Site, TextBox.Text);
            if (AppHost.Shell.ShowDialog(d) != true)
            {
                return;
            }

            TextBox.Text = d.FileName;
        }
Exemple #4
0
        /// <summary>The execute.</summary>
        /// <param name="parameter">The parameter.</param>
        public override void Execute(object parameter)
        {
            var context = parameter as ContentEditorContext;

            if (context == null)
            {
                return;
            }

            context.ContentEditor.ContentModel.GetChanges();

            var field = this.GetIconField(context);

            if (field == null)
            {
                return;
            }

            var d = new SetIconDialog();

            d.Initialize(field.FieldUris.First().ItemVersionUri.Site, field.Value);
            if (d.ShowDialog() != true)
            {
                return;
            }

            context.ContentEditor.ContentModel.IsModified = true;
            field.Value = d.FileName;
            if (field.Control != null)
            {
                field.Control.SetValue(d.FileName);
            }

            var control = context.ContentEditor.AppearanceOptions.Skin.GetControl();

            var image = control.FindChild <Image>(@"QuickInfoIcon");

            if (image == null)
            {
                return;
            }

            var path = @"/sitecore/shell/~/icon/" + d.FileName.Replace(@"16x16", @"32x32");

            var icon = new Icon(field.FieldUris.First().Site, path);

            image.Source = icon.GetSource();
        }
        private void Browse([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            var d = new SetIconDialog();

            d.Initialize(DatabaseUri.Site, IconPath);

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

            IconPath = d.FileName;

            ReloadIcon();
        }