本文整理汇总了C#中Ribbon类的典型用法代码示例。如果您正苦于以下问题:C# Ribbon类的具体用法?C# Ribbon怎么用?C# Ribbon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ribbon类属于命名空间,在下文中一共展示了Ribbon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseRibbonControl
/// <summary>
/// BaseRibbonControl ctor
/// </summary>
/// <param name="ribbon">parent ribbon</param>
/// <param name="commandID">command id attached to this control</param>
protected BaseRibbonControl(Ribbon ribbon, uint commandID)
{
_ribbon = ribbon;
_commandID = commandID;
ribbon.AddRibbonControl(this);
}
示例2: Render
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
{
var typeName = context.Parameters["type"];
var viewName = context.Parameters["viewName"];
var ruleContext = new RuleContext
{
Item = context.CustomData as Item
};
ruleContext.Parameters["ViewName"] = viewName;
if (context.Parameters["features"].Contains(HideListViewFeatures.AllExport.ToString()))
{
return;
}
bool hideNonSpecific =
context.Parameters["features"].Contains(HideListViewFeatures.NonSpecificExport.ToString());
foreach (
Item scriptItem in
ModuleManager.GetFeatureRoots(IntegrationPoints.ListViewExportFeature)
.SelectMany(parent => parent.Children)
.Where(scriptItem => RulesUtils.EvaluateRules(scriptItem["ShowRule"], ruleContext, hideNonSpecific)))
{
RenderSmallButton(output, ribbon, Control.GetUniqueID("export"),
Translate.Text(scriptItem.DisplayName),
scriptItem["__Icon"], string.Empty,
string.Format("export:results(scriptDb={0},scriptID={1})", scriptItem.Database.Name,
scriptItem.ID),
RulesUtils.EvaluateRules(scriptItem["EnableRule"], context.CustomData as Item) &&
context.Parameters["ScriptRunning"] == "0",
false);
}
}
示例3: RibbonOrbAdornerGlyph
public RibbonOrbAdornerGlyph(BehaviorService behaviorService, RibbonDesigner designer, Ribbon ribbon)
: base(new RibbonOrbAdornerGlyphBehavior())
{
_behaviorService = behaviorService;
_componentDesigner = designer;
_ribbon = ribbon;
}
示例4: RibbonTab
public RibbonTab(Ribbon ribbon, uint commandId)
: base(ribbon, commandId)
{
AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId));
AddPropertiesProvider(_labelPropertiesProvider = new LabelPropertiesProvider(ribbon, commandId));
AddPropertiesProvider(_tooltipPropertiesProvider = new TooltipPropertiesProvider(ribbon, commandId));
}
示例5: Render2
public void Render2(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
{
Assert.ArgumentNotNull(output, "output");
Assert.ArgumentNotNull(ribbon, "ribbon");
Assert.ArgumentNotNull(button, "button");
Assert.ArgumentNotNull(context, "context");
var contextDb = context.Parameters["contextDB"];
var contextItemId = context.Parameters["contextItem"];
var currentSessionName = context.Parameters["currentSessionName"];
var contextItem = !string.IsNullOrEmpty(contextDb) && !string.IsNullOrEmpty(contextItemId)
? Factory.GetDatabase(contextDb).GetItem(contextItemId)
: null;
output.Write("<div class=\"iseRibbonContextPanel {0}\">",
context.Parameters["ScriptRunning"] == "1" ? "disabled" : string.Empty);
// timestamp added because Sitecore won't re-send it to browser it if content didn't change - so changing session to the same wouldn't close the dropdowns
output.Write("<div class=\"scRibbonToolbarSmallButtons scRibbonContextLabels\" timestamp=\"{0}\">",
DateTime.Now.ToString("O"));
output.Write("<div class=\"iseRibbonContextPanelLabel\">");
output.Write(Translate.Text("Context"));
output.Write("</div>");
output.Write("<div class=\"iseRibbonContextPanelLabel\">");
output.Write(Translate.Text("Session"));
output.Write("</div>");
output.Write("</div>");
var contextButton = Factory.GetDatabase("core").GetItem("{C733DE04-FFA2-4DCB-8D18-18EB1CB898A3}");
var path = contextItem != null ? contextItem.GetProviderPath().EllipsisString(50) : "none";
var icon = contextItem != null ? contextItem.Appearance.Icon : contextButton.Appearance.Icon;
RenderSmallGalleryButton(output, contextButton, context, ribbon, path, icon);
var sessionButton = Factory.GetDatabase("core").GetItem("{0C784F54-2B46-4EE2-B0BA-72384125E123}");
RenderSmallGalleryButton(output, sessionButton, context, ribbon, currentSessionName, string.Empty);
output.Write("</div>");
}
示例6: Render
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
{
var typeName = context.Parameters["type"];
var viewName = context.Parameters["viewName"];
var ruleContext = new RuleContext
{
Item = context.CustomData as Item
};
ruleContext.Parameters["ViewName"] = viewName;
if (!string.IsNullOrEmpty(typeName))
{
foreach (
Item scriptItem in
ModuleManager.GetFeatureRoots(IntegrationPoints.ListViewRibbonFeature)
.Select(parent => parent.Paths.GetSubItem(typeName))
.Where(scriptLibrary => scriptLibrary != null)
.SelectMany(scriptLibrary => scriptLibrary.Children,
(scriptLibrary, scriptItem) => new {scriptLibrary, scriptItem})
.Where(
@t => RulesUtils.EvaluateRules(@t.scriptItem["ShowRule"], ruleContext)
)
.Select(@t => @t.scriptItem))
{
RenderSmallButton(output, ribbon, Control.GetUniqueID("export"),
Translate.Text(scriptItem.DisplayName),
scriptItem["__Icon"], string.Empty,
string.Format("listview:action(scriptDb={0},scriptID={1})", scriptItem.Database.Name,
scriptItem.ID),
RulesUtils.EvaluateRules(scriptItem["EnableRule"], ruleContext) &&
context.Parameters["ScriptRunning"] == "0",
false);
}
}
}
示例7: RibbonSplitButton
public RibbonSplitButton(Ribbon ribbon, uint commandId)
: base(ribbon, commandId)
{
AddPropertiesProvider(_enabledPropertiesProvider = new EnabledPropertiesProvider(ribbon, commandId));
AddPropertiesProvider(_keytipPropertiesProvider = new KeytipPropertiesProvider(ribbon, commandId));
AddPropertiesProvider(_tooltipPropertiesProvider = new TooltipPropertiesProvider(ribbon, commandId));
}
示例8: Render
/// <summary>
/// The render.
/// </summary>
/// <param name="output">
/// The output.
/// </param>
/// <param name="ribbon">
/// The ribbon.
/// </param>
/// <param name="button">
/// The button.
/// </param>
/// <param name="context">
/// The context.
/// </param>
public override void Render(System.Web.UI.HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
{
Assert.ArgumentNotNull(output, "output");
Assert.ArgumentNotNull(ribbon, "ribbon");
Assert.ArgumentNotNull(button, "button");
Assert.ArgumentNotNull(context, "context");
if (!Settings.Analytics.Enabled)
{
return;
}
Item[] items = context.Items;
if (items.Length != 1)
{
return;
}
ID clientDeviceId = WebEditUtil.GetClientDeviceId();
System.Collections.Generic.IEnumerable<RenderingDefinition> testingRenderings;
if (Context.ClientPage.IsEvent)
{
string text = WebEditUtil.ConvertJSONLayoutToXML(WebUtil.GetFormValue("scLayout"));
if (text == null)
{
return;
}
testingRenderings = GetTestingRenderings(LayoutDefinition.Parse(text), clientDeviceId, Client.ContentDatabase);
}
else
{
Item item = items[0];
testingRenderings = GetTestingRenderings(item, clientDeviceId);
}
output.Write("<div id=\"ComponentsPanelListHolder\" class=\"scRibbonGallery\">");
output.Write("<div id=\"ComponentsPanelList\" class=\"scRibbonGalleryList\" style=\"width: 310px;\">");
int num = 0;
foreach (RenderingDefinition current in testingRenderings)
{
output.Write("<div style=\"display:\"block\">");
this.RenderComponent(output, current, num,context);
num++;
output.Write("</div>");
}
output.Write("</div>");
int val = 500;
int val2 = 350;
int num2 = 100;
int num3 = num * num2 + 80;
num3 = System.Math.Max(System.Math.Min(val, num3), val2);
int num4 = 116;
int num5 = 24;
int num6 = 30;
int num7 = num6 + num4 * System.Math.Min(num, 3) + num5;
string click = (num == 0) ? "javascript:void(0);" : "javascript:return scShowComponentsGallery(this, event, 'Gallery.Components', {{height: {0}, width: {1} }}, {{}});".FormatWith(new object[]
{
num7,
num3
});
base.RenderPanelButtons(output, "ComponentsPanelList", click);
output.Write("</div>");
}
示例9: Ribbon_Should_Be_Able_To_Store_Multiple_Contextual_Groups
public void Ribbon_Should_Be_Able_To_Store_Multiple_Contextual_Groups()
{
var ribbon = new Ribbon("MyRibbon");
ribbon.With(() => _sut);
ribbon.With(() => ContextualGroup.Create("2nd"));
Assert.AreEqual(2,ribbon._contextualGroups.Count);
}
示例10: Render
public override void Render(HtmlTextWriter output, Ribbon ribbon, Item button, CommandContext context)
{
var psButtons = button.GetChildren();
foreach (Item psButton in psButtons)
{
var msg = Message.Parse(this, psButton["Click"]);
var scriptDb = msg.Arguments["scriptDB"];
var scriptId = msg.Arguments["script"];
if (string.IsNullOrWhiteSpace(scriptDb) || string.IsNullOrWhiteSpace(scriptId))
{
continue;
}
var scriptItem = Factory.GetDatabase(scriptDb).GetItem(scriptId);
if (scriptItem == null || !RulesUtils.EvaluateRules(scriptItem["ShowRule"], context.Items[0]))
{
continue;
}
RenderLargeButton(output, ribbon, Control.GetUniqueID("script"),
Translate.Text(scriptItem.DisplayName),
scriptItem["__Icon"], string.Empty,
psButton["Click"],
RulesUtils.EvaluateRules(scriptItem["EnableRule"], context.Items[0]),
false, context);
return;
}
}
示例11: RibbonQuickAccessToolbarGlyph
public RibbonQuickAccessToolbarGlyph(BehaviorService behaviorService, RibbonDesigner designer, Ribbon ribbon)
: base(new RibbonQuickAccessGlyphBehavior(designer, ribbon))
{
_behaviorService = behaviorService;
_componentDesigner = designer;
_ribbon = ribbon;
}
示例12: Id_Should_Be_Composed_If_Parent_Is_Present
public void Id_Should_Be_Composed_If_Parent_Is_Present()
{
var tab = new Tab("Tab2").With(() => _sut);
var ribbon = new Ribbon("Ribbon3")
.With(()=>tab);
Assert.AreEqual("Ribbon3.Tab2.MyGroup", _sut.Id);
}
示例13: RibbonMouseSensor
/// <summary>
/// Creates a new Sensor for specified objects
/// </summary>
/// <param name="control">Control to listen mouse events</param>
/// <param name="ribbon">Ribbon that will be affected</param>
/// <param name="tabs">Tabs that will be sensed</param>
/// <param name="panels">Panels that will be sensed</param>
/// <param name="items">Items that will be sensed</param>
public RibbonMouseSensor(Control control, Ribbon ribbon, IEnumerable<RibbonTab> tabs, IEnumerable<RibbonPanel> panels, IEnumerable<RibbonItem> items)
: this(control, ribbon)
{
if (tabs != null) Tabs.AddRange(tabs);
if (panels != null) Panels.AddRange(panels);
if (items != null) Items.AddRange(items);
}
示例14: AutomateTasksDialog
//*************************************************************************
// Constructor: AutomateTasksDialog()
//
/// <summary>
/// Initializes a new instance of the <see cref="AutomateTasksDialog" />
/// class.
/// </summary>
///
/// <param name="thisWorkbook">
/// Workbook containing the graph contents.
/// </param>
///
/// <param name="ribbon">
/// The application's Ribbon.
/// </param>
//*************************************************************************
public AutomateTasksDialog(
ThisWorkbook thisWorkbook,
Ribbon ribbon
)
{
Debug.Assert(thisWorkbook != null);
Debug.Assert(ribbon != null);
m_oAutomateTasksUserSettings = new AutomateTasksUserSettings();
m_oThisWorkbook = thisWorkbook;
m_oRibbon = ribbon;
InitializeComponent();
// Instantiate an object that saves and retrieves the user settings for
// this dialog. Note that the object automatically saves the settings
// when the form closes.
m_oAutomateTasksDialogUserSettings =
new AutomateTasksDialogUserSettings(this);
DoDataExchange(false);
AssertValid();
}
示例15: TooltipPropertiesProvider
/// <summary>
/// TooltipPropertiesProvider ctor
/// </summary>
/// <param name="ribbon">parent ribbon</param>
/// <param name="commandId">ribbon control command id</param>
public TooltipPropertiesProvider(Ribbon ribbon, uint commandId)
: base(ribbon, commandId)
{
// add supported properties
_supportedProperties.Add(RibbonProperties.TooltipTitle);
_supportedProperties.Add(RibbonProperties.TooltipDescription);
}