本文整理汇总了C#中IRibbonControl类的典型用法代码示例。如果您正苦于以下问题:C# IRibbonControl类的具体用法?C# IRibbonControl怎么用?C# IRibbonControl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRibbonControl类属于命名空间,在下文中一共展示了IRibbonControl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
);
});
}
);
}
开发者ID:chenyuzhcy,项目名称:stock-analysis-addin,代码行数:26,代码来源:RibbonMenu.cs
示例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();
}
}
开发者ID:evilch,项目名称:WordHighlight,代码行数:26,代码来源:OneNoteConnect.cs
示例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");
}
开发者ID:ufora,项目名称:dotnet,代码行数:31,代码来源:UforaRibbon.cs
示例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;
}
}
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:34,代码来源:BackstageView.cs
示例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();
// }
//);
}
}
开发者ID:chenyuzhcy,项目名称:stock-analysis-addin,代码行数:25,代码来源:RibbonMenu.cs
示例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();
}
开发者ID:csainty,项目名称:github-for-outlook,代码行数:8,代码来源:GithubExplorerRibbon.cs
示例7: CreateIssue
public void CreateIssue(IRibbonControl ribbonControl)
{
if (!CanCreateIssue) return;
var issueViewModel = createIssuesViewModelFactory();
issueViewModel.Initialise(selectedMailItem);
contentHost.AddOrActivate(issueViewModel);
CanCreateIssue = false;
}
开发者ID:huangchao-shanghai,项目名称:VSTOContrib,代码行数:9,代码来源:GithubExplorerRibbon.cs
示例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));
}
}
开发者ID:system-tradingtech,项目名称:DataTools,代码行数:10,代码来源:ExcelRibbon.cs
示例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();
}
开发者ID:kevzettler,项目名称:speedsheet,代码行数:10,代码来源:AddinModule.cs
示例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);
}
开发者ID:fantasticswallow,项目名称:tanets-blue,代码行数:11,代码来源:Connect.cs
示例11: GetImage
public IPictureDisp GetImage(IRibbonControl control)
{
switch (control.Id)
{
case "createTask":
{
return base.GetPicture(Properties.Resources.gtfo32x32);
}
}
return null;
}
开发者ID:xgid,项目名称:github-for-outlook,代码行数:12,代码来源:GithubMailItem.cs
示例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;
}
开发者ID:setsunafjava,项目名称:vpsp,代码行数:12,代码来源:RibbonDelegateControl.cs
示例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;
}
}
开发者ID:huangchao-shanghai,项目名称:VSTOContrib,代码行数:52,代码来源:RibbonFactoryController.cs
示例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;
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:14,代码来源:BackstageView.cs
示例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());
}
开发者ID:JoyPeterson,项目名称:VSTOContrib,代码行数:15,代码来源:RibbonFactoryController.cs
示例16: CreateIssue
public void CreateIssue(IRibbonControl control)
{
if (mailItem == null) return;
if (tasks.User == null)
tasks.Login();
tasks.Title = mailItem.Subject;
tasks.Sender = mailItem.Sender.Name;
tasks.ReceivedDate = mailItem.ReceivedTime;
tasks.Body = string.Format("Sender: {0} <{1}>\nReceived: {2}\n\n{3}",
mailItem.Sender.Name,
mailItem.Sender.Address,
mailItem.ReceivedTime.ToString(CultureInfo.CurrentCulture),
mailItem.Body);
new GithubExplorerWindow(tasks).Show();
}
开发者ID:xgid,项目名称:github-for-outlook,代码行数:18,代码来源:GithubMailItem.cs
示例17: ShowForm
// This will enable the form to be displayed when clicking the add in button
public void ShowForm(IRibbonControl control)
{
Window context = control.Context as Window;
if (context != null)
{
CWin32WindowWrapper owner = new CWin32WindowWrapper((IntPtr)context.WindowHandle);
MainForm form = new MainForm(_applicationObject as Application);
form.ShowDialog(owner);
form.Dispose();
form = null;
context = null;
owner = null;
}
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
}
开发者ID:ptaffet,项目名称:OneNoteRibbonAddIn,代码行数:19,代码来源:Connect.cs
示例18: KindleSync
public void KindleSync(IRibbonControl control)
{
// Extract information from the form.
//
AmazonRegistrationForm inputForm = new AmazonRegistrationForm();
inputForm.ShowDialog();
inputForm.Focus();
if (inputForm.User == null)
{
return;
}
string username = inputForm.User.UserName;
string password = inputForm.User.Password;
string sectionId = onApp.Windows.CurrentWindow.CurrentSectionId;
// Getting content from amazon site.
//
HighlightsExtractor extractor = new HighlightsExtractor();
extractor.LogIn(username, password);
foreach (BookWithHighlights bookWithHighlights in extractor.Crawl())
{
StringBuilder sb = new StringBuilder();
foreach (string highlight in bookWithHighlights.Highlights)
{
sb.AppendLine(highlight);
sb.AppendLine();
}
string newPageId;
onApp.CreateNewPage(sectionId, out newPageId);
string newPageContent;
onApp.GetPageContent(newPageId, out newPageContent);
var doc = XDocument.Parse(newPageContent);
var ns = doc.Root.Name.Namespace;
onApp.UpdatePageContent(GetXDocForNewPage(newPageId, ns, bookWithHighlights.BookName, sb.ToString()).ToString());
}
}
开发者ID:LepiKlark,项目名称:KindleToOnenote,代码行数:43,代码来源:KindleToOneNotePlugin.cs
示例19: OpenMainForm_Click
public void OpenMainForm_Click(IRibbonControl ribbon)
{
try
{
if (_mainForm == null)
{
_mainForm = new Xero2ExcelWinForm(new ExcelApplicationWrapper(Application), ServiceLocator.Current);
}
if (!_mainForm.Visible)
{
_mainForm.Show();
}
}
catch (Exception ex)
{
ShowGeneralError(ex);
}
}
开发者ID:danbarratt,项目名称:Xero2Excel,代码行数:19,代码来源:Xero2ExcelRibbon.cs
示例20: InvokeGet
public object InvokeGet(IRibbonControl control, Expression<Action> caller, params object[] parameters)
{
var methodName = caller.GetMethodName();
CallbackTarget callbackTarget = vstoContribContext.TagToCallbackTargetLookup[control.Tag + methodName];
var view = (object)control.Context;
IRibbonViewModel viewModelInstance = ribbonViewModelResolver.ResolveInstanceFor(view);
VstoContribLog.Debug(l => l("Ribbon callback {0} being invoked on {1} (View: {2}, ViewModel: {3})",
methodName, control.Id, view.ToLogFormat(), viewModelInstance.ToLogFormat()));
Type type = viewModelInstance.GetType();
PropertyInfo property = type.GetProperty(callbackTarget.Method);
if (property != null)
{
return type.InvokeMember(callbackTarget.Method,
BindingFlags.GetProperty,
null,
viewModelInstance,
null);
}
try
{
return type.InvokeMember(callbackTarget.Method,
BindingFlags.InvokeMethod,
null,
viewModelInstance,
new[]
{
control
}
.Concat(parameters)
.ToArray());
}
catch (MissingMethodException)
{
throw new InvalidOperationException(
string.Format("Expecting method with signature: {0}.{1}(IRibbonControl control)",
type.Name,
callbackTarget.Method));
}
}
开发者ID:JoyPeterson,项目名称:VSTOContrib,代码行数:43,代码来源:RibbonFactoryController.cs
注:本文中的IRibbonControl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论