本文整理汇总了C#中IRibbonControl类的典型用法代码示例。如果您正苦于以下问题:C# IRibbonControl类的具体用法?C# IRibbonControl怎么用?C# IRibbonControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRibbonControl类属于命名空间,在下文中一共展示了IRibbonControl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildEquityAnalysisModel
public void BuildEquityAnalysisModel(IRibbonControl control)
{
MessageDialog x = new MessageDialog("Building Model...", Constants.AddInName);
x.DoAction(
(dialog) =>
{
TaskEx.Delay(0).Then((t) =>
{
string ticker = (string)ExcelUtil.Worksheet("Main").Range("Symbol").Value;
FinanceDataLoader.BuildEquityAnalysis(ticker).Then(
result =>
{
dialog.SetMessage("Done!");
dialog.Resume();
}
).Finally(
e =>
{
dialog.SetMessage("Error occurred" + e.Message);
}
);
});
}
);
}
示例2: HighlightWords
public void HighlightWords(IRibbonControl control)
{
Window context = control.Context as Window;
try
{
WordMatcher matcher = new WordMatcher(AppRegKey);
matcher.LoadHightlightDefineFile(null);
string pageId = OneNoteHelper.HierarchyHelper.GetActiveObjectID(context.Application, OneNoteHelper.HierarchyHelper._ObjectType.Page);
HighlightPage(context.Application, pageId, matcher);
//OneNoteHelper.HierarchyHelper.GoThoughHierarchy(context.Application, (application, pageId) => HighlightPage(application, pageId, matcher));
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString(), "Error");
EventLog.WriteEntry(EventLogSource, ex.ToString());
}
finally
{
context = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
}
示例3: OnLogonButtonPressed
public void OnLogonButtonPressed(IRibbonControl control)
{
string clusterUrl = "";
int itemIndx = 0;
switch (control.Id)
{
case "LogonButton1":
clusterUrl = "https://dev.ufora.com:443";
itemIndx = 1;
break;
case "LogonButton2":
clusterUrl = "https://demo.ufora.com:443";
itemIndx = 2;
break;
case "LogonButton3":
clusterUrl = "https://stable.ufora.com:443";
itemIndx = 3;
break;
default:
clusterUrl = "";
break;
}
if (clusterUrl != "")
{
ClusterLogonForm logonForm = new ClusterLogonForm(clusterUrl, itemIndx);
logonForm.Show();
}
else
MessageBox.Show("undefined url");
}
示例4: GetImage
public Image GetImage(IRibbonControl control)
{
switch (control.Id)
{
case "WorkshareSaveAsRecentFoldersBrowse":
{
return Utils.GetEmbeddedImage("Workshare.SharedRibbon.Library.Resources.browse.png");
}
case "SaveToWorkshareButton":
{
return Utils.GetEmbeddedImage("Workshare.SharedRibbon.Library.Resources.save-icon.png");
}
case "ShareToWorkshareButton":
{
return Utils.GetEmbeddedImage("Workshare.SharedRibbon.Library.Resources.share-icon.png");
}
case "Bullet1":
case "Bullet2":
case "Bullet3":
case "Bullet4":
case "Bullet5":
case "Bullet6":
case "Bullet7":
case "Bullet8":
{
return Utils.GetEmbeddedImage("Workshare.SharedRibbon.Library.Resources.bullet.png");
}
default:
{
return Image;
}
}
}
示例5: CreateModel
public void CreateModel(IRibbonControl control)
{
SelectTemplate t = new SelectTemplate();
if (t.ShowDialog().Value)
{
//MessageDialog x = new MessageDialog("Creating Model...", Constants.AddInName);
//x.DoAction(
// (dialog) =>
// {
Excel.Application app = ExcelUtil.Application;
Excel.Workbook wb = app.Workbooks.Open(t.SelectedTemplateFullPath);
Excel.Worksheet currentSheet = (Excel.Worksheet)wb.ActiveSheet;
Excel.Worksheet ws = (Excel.Worksheet)wb.Worksheets.Add();
ws.Name = "Config";
ws.Visible = Excel.Enums.XlSheetVisibility.xlSheetVeryHidden;
currentSheet.Activate();
ws.Range("A1").Value = t.SelectedTemplate;
//dialog.SetMessage("Done!");
//dialog.Resume();
// }
//);
}
}
示例6: CreateIssue
public void CreateIssue(IRibbonControl ribbonControl)
{
//TODO create proper task window and show it here.. selectedMailItem will be populated properly
new Window
{
Content = new TextBlock { Text = string.Format("Create issue here for {0}", selectedMailItem.Subject)}
}.Show();
}
示例7: CreateIssue
public void CreateIssue(IRibbonControl ribbonControl)
{
if (!CanCreateIssue) return;
var issueViewModel = createIssuesViewModelFactory();
issueViewModel.Initialise(selectedMailItem);
contentHost.AddOrActivate(issueViewModel);
CanCreateIssue = false;
}
示例8: RunTagMacro
// RunTagMacro helper function
public virtual void RunTagMacro(IRibbonControl control)
{
if (!string.IsNullOrEmpty(control.Tag))
{
// CONSIDER: Is this a danger for shutting down - surely not...?
object app = ExcelDnaUtil.Application;
app.GetType().InvokeMember("Run", BindingFlags.InvokeMethod, null, app, new object[] { control.Tag }, new CultureInfo(1033));
}
}
示例9: adxRibbonButton1_OnClick
private void adxRibbonButton1_OnClick(object sender, IRibbonControl control, bool pressed)
{
Excel.Range selectedRange = null;
if (ExcelApp.Selection is Excel.Range)
{
selectedRange = ExcelApp.Selection as Excel.Range;
}
Form derpForm = new ParamMapForm(selectedRange);
derpForm.ShowDialog();
}
示例10: OnMainButtonClick
public void OnMainButtonClick(IRibbonControl control)
{
HTMLGenerator.IsResizeFont = IsSizeChange;
var l = cli.GetCurrentId();
var px = cli.GetPageContent(l);
var xe = HTMLGenerator.CreateFromXml(px);
var id = HTMLGenerator.PageId;
id = id.Remove(id.LastIndexOf('}')).Remove(0, id.LastIndexOf('{') + 1);
var xmlPath = System.IO.Path.Combine(pathdict, id + ".html");
HTMLGenerator.WriteXml(xmlPath, xe);
}
示例11: GetImage
public IPictureDisp GetImage(IRibbonControl control)
{
switch (control.Id)
{
case "createTask":
{
return base.GetPicture(Properties.Resources.gtfo32x32);
}
}
return null;
}
示例12: RegisterRibbonExtension
public void RegisterRibbonExtension(IRibbonControl ribbonControl, string location)
{
ribbon.RegisterDataExtension(ribbonControl.GetXmlDefinition(), location);
// Select all command to register
if (ribbonControl.Command != null)
{
ribbonCommands.Add(ribbonControl.Command);
}
isRegistedRibbons = true;
}
示例13: Invoke
public void Invoke(IRibbonControl control, Expression<Action> caller, params object[] parameters)
{
try
{
CallbackTarget callbackTarget =
vstoContribContext.TagToCallbackTargetLookup[control.Tag + caller.GetMethodName()];
IRibbonViewModel viewModelInstance = ribbonViewModelResolver.ResolveInstanceFor(control.Context);
Type type = viewModelInstance.GetType();
PropertyInfo property = type.GetProperty(callbackTarget.Method);
if (property != null)
{
type.InvokeMember(callbackTarget.Method,
BindingFlags.SetProperty,
null,
viewModelInstance,
new[]
{
parameters.Single()
});
}
else
{
type.InvokeMember(callbackTarget.Method,
BindingFlags.InvokeMethod,
null,
viewModelInstance,
new[]
{
control
}
.Concat(parameters)
.ToArray());
}
}
catch (TargetInvocationException e)
{
var innerEx = e.InnerException;
PreserveStackTrace(innerEx);
if (vstoContribContext.ErrorHandlers.Count == 0)
{
Trace.TraceError(innerEx.ToString());
}
var handled = vstoContribContext.ErrorHandlers.Any(errorHandler => errorHandler.Handle(innerEx));
if (!handled)
throw innerEx;
}
}
示例14: GetLabel
public string GetLabel(IRibbonControl control)
{
if (!string.IsNullOrEmpty(control.Tag))
{
var index = Convert.ToInt32(control.Tag);
if (index > _recentFolders.Count - 1)
{
return string.Empty;
}
return MakePrettyBreadcrumb(_recentFolders[index]);
}
return string.Empty;
}
示例15: InvokeGetContent
public string InvokeGetContent(IRibbonControl control, Expression<Action> caller, params object[] parameters)
{
// Remove any previous registered callbacks for this dynamic context
vstoContribContext.RemoveCallbacksForDynamicContext(control.Tag);
// Delegate to the view model to get the raw xml
var xmlString = InvokeGet(control, caller, parameters);
if (xmlString == null) return null;
// Rewrite the XML with our callbacks, registering new callback targets
var ribbonXmlRewriter = new RibbonXmlRewriter(vstoContribContext, ribbonViewModelResolver);
var ribbonType = vstoContribContext.TagToCallbackTargetLookup[control.Tag + caller.GetMethodName()].RibbonType;
return ribbonXmlRewriter.RewriteDynamicXml(ribbonType, control.Tag, xmlString.ToString());
}