本文整理汇总了C#中MonoMac.AppKit.NSMenu类 的典型用法代码示例。如果您正苦于以下问题:C# NSMenu类的具体用法?C# NSMenu怎么用?C# NSMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSMenu类 属于MonoMac.AppKit命名空间,在下文中一共展示了NSMenu类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateNsMenu
private void CreateNsMenu() {
var menu = new NSMenu ();
statusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(30);
statusItem.Menu = menu;
statusItem.Image = NSImage.ImageNamed("statusicon");
statusItem.HighlightMode = true;
menu.RemoveAllItems ();
browseMenuItem = new NSMenuItem ("Browse Media Library", "b", delegate {
Browse (NSApplication.SharedApplication);
});
menu.AddItem (browseMenuItem);
configureMenuItem = new NSMenuItem ("Configure Media Browser", "c", delegate {
Configure (NSApplication.SharedApplication);
});
menu.AddItem (configureMenuItem);
communityMenuItem = new NSMenuItem ("Visit Community", "v", delegate {
Community (NSApplication.SharedApplication);
});
menu.AddItem (communityMenuItem);
quitMenuItem = new NSMenuItem ("Quit", "q", delegate {
Quit (NSApplication.SharedApplication);
});
menu.AddItem (quitMenuItem);
}
开发者ID:paul-777, 项目名称:Emby, 代码行数:31, 代码来源:MenuBarIcon.cs
示例2: StatusItemBurritoDayView
public StatusItemBurritoDayView(Container container)
{
this.menu = new NSMenu();
this.menu.AddItem(this.refreshMenuItem);
this.menu.AddItem(this.launchMenuItem);
this.menu.AddItem(NSMenuItem.SeparatorItem);
this.menu.AddItem(this.durationMenuItem);
this.menu.AddItem(this.locationMenuItem);
this.menu.AddItem(this.separatorMenuItem);;
this.menu.AddItem(this.dismissMenuitem);
this.menu.AddItem(this.quitMenuItem);
this.launchMenuItem.Activated += delegate {
var handler = this.urlActivated;
if (handler != null)
{
handler(this, "http://isitburritoday.com");
}
};
this.quitMenuItem.Activated += (sender, e) =>
NSApplication.SharedApplication.Terminate(sender as NSObject);
this.presenters = new IDisposable[]
{
container.Resolve<BurritoDayPresenter, IBurritoDayView>(this),
container.Resolve<UrlActivationPresenter, IUrlActivationView>(this),
};
}
开发者ID:ataranto, 项目名称:tepeyac, 代码行数:33, 代码来源:StatusItemBurritoDayView.cs
示例3: FinishedLaunching
public override void FinishedLaunching(NSObject notification)
{
// mainWindowController = new MainWindowController ();
// mainWindowController.Window.MakeKeyAndOrderFront (this);
// Construct menu that will be displayed when tray icon is clicked
var notifyMenu = new NSMenu();
var exitMenuItem = new NSMenuItem("Quit",
(a,b) => {
NSApplication.SharedApplication.Terminate(this);
//System.Environment.Exit(0);
});
var startMidiModMenuItem = new NSMenuItem("Run",
(a,b) => { RunMidiMod(); });
var mappingmodMidiModMenuItem = new NSMenuItem("Mapping Mod",
(a,b) => { ActivateMappingMod(); });
statusMenuItem = new NSMenuItem("STATUS",
(a,b) => { });
statusMenuItem.Enabled = false;
var versionMenuItem = new NSMenuItem("Version 1.0",
(a,b) => { });
versionMenuItem.Enabled = false;
var seperatorItem = NSMenuItem.SeparatorItem;
notifyMenu.AutoEnablesItems = false;
// Just add 'Quit' command
notifyMenu.AddItem (statusMenuItem);
notifyMenu.AddItem (versionMenuItem);
notifyMenu.AddItem (seperatorItem);
notifyMenu.AddItem (startMidiModMenuItem);
notifyMenu.AddItem (mappingmodMidiModMenuItem);
notifyMenu.AddItem(exitMenuItem);
// Display tray icon in upper-right-hand corner of the screen
sItem = NSStatusBar.SystemStatusBar.CreateStatusItem(16); //def 16
sItem.Menu = notifyMenu;
sItem.Title = "MidiMod";
sItem.ToolTip = "Midi Mod";
sItem.Image = NSImage.FromStream(System.IO.File.OpenRead(NSBundle.MainBundle.ResourcePath + @"/9b244f1232672041.icns"));
sItem.HighlightMode = true;
UpdateStatus ("Mod not startet");
// Remove the system tray icon from upper-right hand corner of the screen
// (works without adjusting the LSUIElement setting in Info.plist)
NSApplication.SharedApplication.ActivationPolicy =
NSApplicationActivationPolicy.Accessory;
}
开发者ID:cansik, 项目名称:midimodifier, 代码行数:54, 代码来源:AppDelegate.cs
示例4: DidFinishLaunching
public override void DidFinishLaunching(NSNotification notification)
{
var menu = new NSMenu ();
var menuItem = new NSMenuItem ();
menu.AddItem (menuItem);
var appMenu = new NSMenu ();
var quitItem = new NSMenuItem ("Quit " + NSProcessInfo.ProcessInfo.ProcessName, "q", (s, e) => NSApplication.SharedApplication.Terminate (menu));
appMenu.AddItem (quitItem);
var window = new NSWindow ();
menuItem.Submenu = appMenu;
NSApplication.SharedApplication.MainMenu = menu;
}
开发者ID:Sracinas, 项目名称:XamarinTest, 代码行数:16, 代码来源:AppDelegate.cs
示例5: CreateNsMenu
private void CreateNsMenu() {
var menu = new NSMenu ();
statusItem = NSStatusBar.SystemStatusBar.CreateStatusItem(30);
statusItem.Menu = menu;
statusItem.Image = NSImage.ImageNamed("statusicon");
statusItem.HighlightMode = true;
menu.RemoveAllItems ();
browseMenuItem = new NSMenuItem ("Browse Media Library", "b", delegate {
Browse (NSApplication.SharedApplication);
});
menu.AddItem (browseMenuItem);
configureMenuItem = new NSMenuItem ("Configure Media Browser", "c", delegate {
Configure (NSApplication.SharedApplication);
});
menu.AddItem (configureMenuItem);
developerMenuItem = new NSMenuItem ("Developer Resources");
menu.AddItem (developerMenuItem);
var developerMenu = new NSMenu ();
developerMenuItem.Submenu = developerMenu;
apiMenuItem = new NSMenuItem ("Api Documentation", "a", delegate {
ApiDocs (NSApplication.SharedApplication);
});
developerMenu.AddItem (apiMenuItem);
githubMenuItem = new NSMenuItem ("Github", "g", delegate {
Github (NSApplication.SharedApplication);
});
developerMenu.AddItem (githubMenuItem);
communityMenuItem = new NSMenuItem ("Visit Community", "v", delegate {
Community (NSApplication.SharedApplication);
});
menu.AddItem (communityMenuItem);
quitMenuItem = new NSMenuItem ("Quit", "q", delegate {
Quit (NSApplication.SharedApplication);
});
menu.AddItem (quitMenuItem);
}
开发者ID:jabbera, 项目名称:MediaBrowser, 代码行数:47, 代码来源:MenuBarIcon.cs
示例6: MDServicesMenuItem
public MDServicesMenuItem ()
{
Title = GettextCatalog.GetString ("Services");
var sub = NSApplication.SharedApplication.ServicesMenu;
if (sub == null) {
sub = new NSMenu ();
NSApplication.SharedApplication.ServicesMenu = sub;
} else {
foreach (var m in sub.Supermenu.ItemArray ()) {
if (m.Submenu == sub) {
m.Submenu = new NSMenu ();
break;
}
}
}
Submenu = sub;
}
开发者ID:Kalnor, 项目名称:monodevelop, 代码行数:17, 代码来源:MDServicesMenuItem.cs
示例7: MenuWillOpen
public override void MenuWillOpen(NSMenu menu)
{
MenuIsOpen = true;
}
开发者ID:nicolas-raoul, 项目名称:SparkleShare, 代码行数:4, 代码来源:SparkleStatusIcon.cs
示例8: CreateMenu
public void CreateMenu()
{
this.menu = new NSMenu () { AutoEnablesItems = false };
this.state_item = new NSMenuItem () {
Title = Controller.StateText,
Enabled = false
};
this.folder_item = new NSMenuItem () {
Title = "SparkleShare",
Enabled = true
};
this.folder_item.Image = this.sparkleshare_image;
this.folder_item.Image.Size = new SizeF (16, 16);
this.add_item = new NSMenuItem () {
Title = "Add Hosted Project…",
Enabled = true
};
this.recent_events_item = new NSMenuItem () {
Title = "Recent Changes…",
Enabled = Controller.RecentEventsItemEnabled
};
this.about_item = new NSMenuItem () {
Title = "About SparkleShare",
Enabled = true
};
this.quit_item = new NSMenuItem () {
Title = "Quit",
Enabled = Controller.QuitItemEnabled
};
this.folder_menu_items = new NSMenuItem [Controller.Folders.Length];
this.error_menu_items = new NSMenuItem [Controller.Folders.Length];
this.try_again_menu_items = new NSMenuItem [Controller.Folders.Length];
if (Controller.Folders.Length > 0) {
int i = 0;
foreach (string folder_name in Controller.Folders) {
NSMenuItem item = new NSMenuItem () { Title = folder_name };
this.folder_menu_items [i] = item;
if (!string.IsNullOrEmpty (Controller.FolderErrors [i])) {
item.Image = this.caution_image;
item.Submenu = new NSMenu ();
this.error_menu_items [i] = new NSMenuItem ();
this.error_menu_items [i].Title = Controller.FolderErrors [i];
this.try_again_menu_items [i] = new NSMenuItem ();
this.try_again_menu_items [i].Title = "Try Again";
this.try_again_menu_items [i].Activated += Controller.TryAgainDelegate (folder_name);;
item.Submenu.AddItem (this.error_menu_items [i]);
item.Submenu.AddItem (NSMenuItem.SeparatorItem);
item.Submenu.AddItem (this.try_again_menu_items [i]);
} else {
item.Image = this.folder_image;
this.folder_menu_items [i].Activated += Controller.OpenFolderDelegate (folder_name);
}
item.Image.Size = new SizeF (16, 16);
i++;
};
}
if (Controller.RecentEventsItemEnabled)
this.recent_events_item.Activated += delegate { Controller.RecentEventsClicked (); };
this.add_item.Activated += delegate { Controller.AddHostedProjectClicked (); };
this.about_item.Activated += delegate { Controller.AboutClicked (); };
this.quit_item.Activated += delegate { Controller.QuitClicked (); };
this.menu.AddItem (this.state_item);
this.menu.AddItem (NSMenuItem.SeparatorItem);
this.menu.AddItem (this.folder_item);
this.submenu = new NSMenu ();
this.submenu.AddItem (this.recent_events_item);
this.submenu.AddItem (this.add_item);
this.submenu.AddItem (NSMenuItem.SeparatorItem);
this.submenu.AddItem (this.about_item);
this.folder_item.Submenu = this.submenu;
foreach (NSMenuItem item in this.folder_menu_items)
this.menu.AddItem (item);
this.menu.AddItem (NSMenuItem.SeparatorItem);
this.menu.AddItem (this.quit_item);
this.menu.Delegate = new SparkleMenuDelegate ();
this.status_item.Menu = this.menu;
//.........这里部分代码省略.........
开发者ID:nicolas-raoul, 项目名称:SparkleShare, 代码行数:101, 代码来源:SparkleStatusIcon.cs
示例9: MenuDidClose
public override void MenuDidClose(NSMenu menu)
{
MenuIsOpen = false;
}
开发者ID:nicolas-raoul, 项目名称:SparkleShare, 代码行数:4, 代码来源:SparkleStatusIcon.cs
示例10: MenuWillHighlightItem
public override void MenuWillHighlightItem(NSMenu menu, NSMenuItem item)
{
}
开发者ID:pantarai, 项目名称:SparkleShare, 代码行数:3, 代码来源:SparkleStatusIcon.cs
示例11: StartSearch
partial void StartSearch(MonoMac.AppKit.NSSearchField sender)
{
var noteResults = AppDelegate.NoteEngine.GetNotes (sender.StringValue, true);
NSMenu noteSearchMenu = new NSMenu ("Search Results");
var action = new MonoMac.ObjCRuntime.Selector ("searchResultSelected");
foreach (var name in noteResults.Values.Select (n => n.Title))
noteSearchMenu.AddItem (name, action, string.Empty);
Console.WriteLine (sender.Frame);
Console.WriteLine (sender.Superview.Frame);
Console.WriteLine (sender.Superview.Superview.Frame);
NSEvent evt = NSEvent.OtherEvent (NSEventType.ApplicationDefined,
new PointF (sender.Frame.Left, sender.Frame.Top),
(NSEventModifierMask)0,
0,
sender.Window.WindowNumber,
sender.Window.GraphicsContext,
(short)NSEventType.ApplicationDefined,
0, 0);
NSMenu.PopUpContextMenu (noteSearchMenu, evt, searchField);
}
开发者ID:garuma, 项目名称:Macboy, 代码行数:20, 代码来源:MyDocument.cs
示例12: CreateMenu
public void CreateMenu()
{
using (NSAutoreleasePool a = new NSAutoreleasePool ())
{
StatusItem.Image = AnimationFrames [0];
StatusItem.AlternateImage = AnimationFramesActive [0];
StatusItem.Image.Size = new SizeF (16, 16);
StatusItem.AlternateImage.Size = new SizeF (16, 16);
Menu = new NSMenu ();
Menu.AutoEnablesItems = false;
StateMenuItem = new NSMenuItem () {
Title = StateText,
Enabled = false
};
Menu.AddItem (StateMenuItem);
Menu.AddItem (NSMenuItem.SeparatorItem);
FolderMenuItem = new NSMenuItem () {
Title = "SparkleShare"
};
FolderMenuItem.Activated += delegate {
Program.Controller.OpenSparkleShareFolder ();
};
FolderMenuItem.Image = SparkleShareImage;
FolderMenuItem.Image.Size = new SizeF (16, 16);
FolderMenuItem.Enabled = true;
Menu.AddItem (FolderMenuItem);
FolderMenuItems = new NSMenuItem [Program.Controller.Folders.Count];
if (Controller.Folders.Length > 0) {
Tasks = new EventHandler [Program.Controller.Folders.Count];
int i = 0;
foreach (string folder_name in Program.Controller.Folders) {
NSMenuItem item = new NSMenuItem ();
item.Title = folder_name;
if (Program.Controller.UnsyncedFolders.Contains (folder_name))
item.Image = CautionImage;
else
item.Image = FolderImage;
item.Image.Size = new SizeF (16, 16);
Tasks [i] = OpenFolderDelegate (folder_name);
FolderMenuItems [i] = item;
FolderMenuItems [i].Activated += Tasks [i];
FolderMenuItem.Enabled = true;
i++;
};
} else {
FolderMenuItems = new NSMenuItem [1];
FolderMenuItems [0] = new NSMenuItem () {
Title = "No projects yet",
Enabled = false
};
}
foreach (NSMenuItem item in FolderMenuItems)
Menu.AddItem (item);
Menu.AddItem (NSMenuItem.SeparatorItem);
SyncMenuItem = new NSMenuItem () {
Title = "Add Hosted Project…",
Enabled = true
};
if (!Program.Controller.FirstRun) {
SyncMenuItem.Activated += delegate {
InvokeOnMainThread (delegate {
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
if (SparkleUI.Setup == null) {
SparkleUI.Setup = new SparkleSetup ();
SparkleUI.Setup.Controller.ShowAddPage ();
}
if (!SparkleUI.Setup.IsVisible)
SparkleUI.Setup.Controller.ShowAddPage ();
SparkleUI.Setup.OrderFrontRegardless ();
SparkleUI.Setup.MakeKeyAndOrderFront (this);
});
};
}
Menu.AddItem (SyncMenuItem);
Menu.AddItem (NSMenuItem.SeparatorItem);
//.........这里部分代码省略.........
开发者ID:adriangibanelbtactic, 项目名称:SparkleShare, 代码行数:101, 代码来源:SparkleStatusIcon.cs
示例13: SetGlobalMenu
public override bool SetGlobalMenu (CommandManager commandManager, string commandMenuAddinPath, string appMenuAddinPath)
{
if (setupFail)
return false;
try {
InitApp (commandManager);
NSApplication.SharedApplication.HelpMenu = null;
var rootMenu = NSApplication.SharedApplication.MainMenu;
if (rootMenu == null) {
rootMenu = new NSMenu ();
NSApplication.SharedApplication.MainMenu = rootMenu;
} else {
rootMenu.RemoveAllItems ();
}
CommandEntrySet appCes = commandManager.CreateCommandEntrySet (appMenuAddinPath);
rootMenu.AddItem (new MDSubMenuItem (commandManager, appCes));
CommandEntrySet ces = commandManager.CreateCommandEntrySet (commandMenuAddinPath);
foreach (CommandEntry ce in ces) {
rootMenu.AddItem (new MDSubMenuItem (commandManager, (CommandEntrySet) ce));
}
} catch (Exception ex) {
try {
var m = NSApplication.SharedApplication.MainMenu;
if (m != null) {
m.Dispose ();
}
NSApplication.SharedApplication.MainMenu = null;
} catch {}
LoggingService.LogError ("Could not install global menu", ex);
setupFail = true;
return false;
}
return true;
}
开发者ID:pjt33, 项目名称:monodevelop, 代码行数:39, 代码来源:MacPlatform.cs
示例14: CreateMenu
public void CreateMenu()
{
using (NSAutoreleasePool a = new NSAutoreleasePool ())
{
StatusItem.Image = AnimationFrames [0];
StatusItem.AlternateImage = AnimationFramesActive [0];
StatusItem.Image.Size = new SizeF (16, 16);
StatusItem.AlternateImage.Size = new SizeF (16, 16);
Menu = new NSMenu ();
Menu.AutoEnablesItems = false;
StateMenuItem = new NSMenuItem () {
Title = StateText,
Enabled = false
};
Menu.AddItem (StateMenuItem);
Menu.AddItem (NSMenuItem.SeparatorItem);
FolderMenuItem = new NSMenuItem () {
Title = "SparkleShare"
};
FolderMenuItem.Activated += delegate {
Controller.SparkleShareClicked ();
};
FolderMenuItem.Image = SparkleShareImage;
FolderMenuItem.Image.Size = new SizeF (16, 16);
FolderMenuItem.Enabled = true;
Menu.AddItem (FolderMenuItem);
FolderMenuItems = new NSMenuItem [Program.Controller.Folders.Count];
if (Controller.Folders.Length > 0) {
Tasks = new EventHandler [Program.Controller.Folders.Count];
int i = 0;
foreach (string folder_name in Program.Controller.Folders) {
NSMenuItem item = new NSMenuItem ();
item.Title = folder_name;
if (Program.Controller.UnsyncedFolders.Contains (folder_name))
item.Image = CautionImage;
else
item.Image = FolderImage;
item.Image.Size = new SizeF (16, 16);
Tasks [i] = OpenFolderDelegate (folder_name);
FolderMenuItems [i] = item;
FolderMenuItems [i].Activated += Tasks [i];
FolderMenuItem.Enabled = true;
i++;
};
} else {
FolderMenuItems = new NSMenuItem [1];
FolderMenuItems [0] = new NSMenuItem () {
Title = "No projects yet",
Enabled = false
};
}
foreach (NSMenuItem item in FolderMenuItems)
Menu.AddItem (item);
Menu.AddItem (NSMenuItem.SeparatorItem);
SyncMenuItem = new NSMenuItem () {
Title = "Add Hosted Project…",
Enabled = true
};
SyncMenuItem.Activated += delegate {
Controller.AddHostedProjectClicked ();
};
Menu.AddItem (SyncMenuItem);
RecentEventsMenuItem = new NSMenuItem () {
Title = "View Recent Changes…",
Enabled = (Controller.Folders.Length > 0)
};
if (Controller.Folders.Length > 0) {
RecentEventsMenuItem.Activated += delegate {
Controller.OpenRecentEventsClicked ();
};
}
Menu.AddItem (RecentEventsMenuItem);
Menu.AddItem (NSMenuItem.SeparatorItem);
NotificationsMenuItem = new NSMenuItem () {
//.........这里部分代码省略.........
开发者ID:shish, 项目名称:SparkleShare, 代码行数:101, 代码来源:SparkleStatusIcon.cs
示例15: CreateMenu
// Creates the menu that is popped up when the
// user clicks the status icon
public void CreateMenu()
{
Menu = new NSMenu ();
StateMenuItem = new NSMenuItem () {
Title = StateText
};
Menu.AddItem (StateMenuItem);
Menu.AddItem (NSMenuItem.SeparatorItem);
FolderMenuItem = new NSMenuItem () {
Title = "SparkleShare"
};
FolderMenuItem.Activated += delegate {
SparkleShare.Controller.OpenSparkleShareFolder ();
};
string folder_icon_path = Path.Combine (NSBundle.MainBundle.ResourcePath,
"sparkleshare-mac.icns");
FolderMenuItem.Image = new NSImage (folder_icon_path);
FolderMenuItem.Image.Size = new SizeF (16, 16);
Menu.AddItem (FolderMenuItem);
if (SparkleShare.Controller.Folders.Count > 0) {
FolderMenuItems = new NSMenuItem [SparkleShare.Controller.Folders.Count];
Tasks = new EventHandler [SparkleShare.Controller.Folders.Count];
int i = 0;
foreach (string path in SparkleShare.Controller.Folders) {
// TODO
// if (repo.HasUnsyncedChanges)
// folder_action.IconName = "dialog-error";
NSMenuItem item = new NSMenuItem ();
item.Title = System.IO.Path.GetFileName (path);
item.Image = NSImage.ImageNamed ("NSFolder");
item.Image.Size = new SizeF (16, 16);
Tasks [i] = OpenEventLogDelegate(item.Title);
FolderMenuItems [i] = item;
FolderMenuItems [i].Activated += Tasks [i];
Menu.AddItem (FolderMenuItems [i]);
i++;
};
} else {
FolderMenuItems = new NSMenuItem [1];
FolderMenuItems [0] = new NSMenuItem () {
Title = "No Remote Folders Yet"
};
Menu.AddItem (FolderMenuItems [0]);
}
Menu.AddItem (NSMenuItem.SeparatorItem);
SyncMenuItem = new NSMenuItem () {
Title = "Add Remote Folder…"
};
if (!SparkleShare.Controller.FirstRun) {
SyncMenuItem.Activated += delegate {
InvokeOnMainThread (delegate {
NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
if (SparkleUI.Intro == null) {
SparkleUI.Intro = new SparkleIntro ();
SparkleUI.Intro.ShowServerForm (true);
}
if (!SparkleUI.Intro.IsVisible)
SparkleUI.Intro.ShowServerForm (true);
SparkleUI.Intro.OrderFrontRegardless ();
SparkleUI.Intro.MakeKeyAndOrderFront (this);
});
};
//.........这里部分代码省略.........
开发者ID:qirtaiba, 项目名称:SparkleShare, 代码行数:101, 代码来源:SparkleStatusIcon.cs
示例16: CreateMenu
public void CreateMenu ()
{
this.menu = new NSMenu () { AutoEnablesItems = false };
this.state_item = new NSMenuItem () {
Title = Controller.StateText,
Enabled = false
};
this.folder_item = new NSMenuItem () {
Title = "SparkleShare",
Enabled = true
};
this.folder_item.Image = this.sparkleshare_image;
this.folder_item.Image.Size = new SizeF (16, 16);
this.add_item = new NSMenuItem () {
Title = "Add Hosted Project…",
Enabled = true
};
this.recent_events_item = new NSMenuItem () {
Title = "Recent Changes…",
Enabled = Controller.RecentEventsItemEnabled
};
this.link_code_item = new NSMenuItem ();
this.link_code_item.Title = "Client ID";
if (Controller.LinkCodeItemEnabled) {
this.link_code_submenu = new NSMenu ();
this.code_item = new NSMenuItem ();
this.code_item.Title = Program.Controller.CurrentUser.PublicKey.Substring (0, 20) + "...";
this.copy_item = new NSMenuItem ();
this.copy_item.Title = "Copy to Clipboard";
this.copy_item.Activated += delegate { Controller.CopyToClipboardClicked (); };
this.link_code_submenu.AddItem (this.code_item);
this.link_code_submenu.AddItem (NSMenuItem.SeparatorItem);
this.link_code_submenu.AddItem (this.copy_item);
this.link_code_item.Submenu = this.link_code_submenu;
}
this.about_item = new NSMenuItem () {
Title = "About SparkleShare",
Enabled = true
};
this.quit_item = new NSMenuItem () {
Title = "Quit",
Enabled = Controller.QuitItemEnabled
};
this.folder_menu_items = new NSMenuItem [Controller.Projects.Length];
this.try_again_menu_items = new NSMenuItem [Controller.Projects.Length];
this.pause_menu_items = new NSMenuItem [Controller.Projects.Length];
this.resume_menu_items = new NSMenuItem [Controller.Projects.Length];
this.state_menu_items = new NSMenuItem [Controller.Projects.Length];
if (Controller.Projects.Length > 0) {
int i = 0;
foreach (ProjectInfo project in Controller.Projects) {
NSMenuItem item = new NSMenuItem () { Title = project.Name };
this.folder_menu_items [i] = item;
item.Submenu = new NSMenu ();
item.Image = this.folder_image;
this.state_menu_items [i] = new NSMenuItem (project.StatusMessage);
item.Submenu.AddItem (this.state_menu_items [i]);
item.Submenu.AddItem (NSMenuItem.SeparatorItem);
if (project.IsPaused) {
if (project.UnsyncedChangesInfo.Count > 0) {
foreach (KeyValuePair<string, string> pair in project.UnsyncedChangesInfo)
item.Submenu.AddItem (new NSMenuItem (pair.Key) {
Image = NSImage.ImageNamed (pair.Value)
});
if (!string.IsNullOrEmpty (project.MoreUnsyncedChanges))
item.Submenu.AddItem (new NSMenuItem (project.MoreUnsyncedChanges));
item.Submenu.AddItem (NSMenuItem.SeparatorItem);
this.resume_menu_items [i] = new NSMenuItem ("Sync and Resume…");
} else {
this.resume_menu_items [i] = new NSMenuItem ("Resume");
}
this.resume_menu_items [i].Activated += Controller.ResumeDelegate (project.Name);
item.Submenu.AddItem (this.resume_menu_items [i]);
} else {
if (Controller.Projects [i].HasError) {
item.Image = this.caution_image;
//.........这里部分代码省略.........
开发者ID:rchicoli, 项目名称:sparkleshare, 代码行数:101, 代码来源:SparkleStatusIcon.cs
示例17: MenuWillOpen
public override void MenuWillOpen(NSMenu menu)
{
Console.WriteLine ("OPENED");
InvokeOnMainThread (delegate {
foreach (SparkleLog log in SparkleUI.OpenLogs)
log.OrderFrontRegardless ();
});
}
开发者ID:fontanon, 项目名称:SparkleShare, 代码行数:11, 代码来源:SparkleStatusIcon.cs
示例18: StatusIcon
public StatusIcon () : base ()
{
using (var a = new NSAutoreleasePool ())
{
CreateAnimationFrames ();
this.status_item = NSStatusBar.SystemStatusBar.CreateStatusItem (28);
this.status_item.HighlightMode = true;
this.status_item.Image = this.animation_frames [0];
this.status_item.Image = this.animation_frames [0];
this.status_item.Image.Size = new SizeF (16, 16);
CreateMenu ();
}
Controller.UpdateIconEvent += delegate (int icon_frame) {
using (var a = new NSAutoreleasePool ())
{
BeginInvokeOnMainThread (delegate {
if (icon_frame > -1) {
this.status_item.Image = this.animation_frames [icon_frame];
this.status_item.Image.Size = new SizeF (16, 16);
} else {
this.status_item.Image = this.error_image;
this.status_item.Image.Size = new SizeF (16, 16);
}
});
}
};
Controller.UpdateStatusItemEvent += delegate (string state_text) {
using (var a = new NSAutoreleasePool ())
{
InvokeOnMainThread (delegate {
this.state_item.Title = state_text;
});
}
};
Controller.UpdateMenuEvent += delegate {
using (var a = new NSAutoreleasePool ())
{
InvokeOnMainThread (() => CreateMenu ());
}
};
Controller.UpdateSuspendSyncFolderEvent += delegate(string reponame)
{
using (var a = new NSAutoreleasePool()){
InvokeOnMainThread(delegate {
NSMenuItem PauseItem;
if(FolderItems.TryGetValue(reponame,out PauseItem)){
setSyncItemState(PauseItem, getSyncStatus(reponame));
}
});
}
};
// TODO Need to implement this method like the COCOA way to do it
Controller.UpdateTransmissionMenuEvent += delegate
{
using (var a = new NSAutoreleasePool()) {
InvokeOnMainThread(delegate {
List<FileTransmissionEvent> transmissions = Program.Controller.ActiveTransmissions();
NSMenu transmissionmenu = new NSMenu();
foreach(FileTransmissionEvent transmission in transmissions) {
NSMenuItem transmissionItem = new TransmissionMenuItem(transmission);
transmissionmenu.AddItem(transmissionItem);
}
if(transmissions.Count > 0) {
state_item.Submenu = transmissionmenu;
state_item.Enabled = true;
}else{
state_item.Enabled = false;
}
});
}
};
}
开发者ID:j2m2, 项目名称:CmisSync, 代码行数:82, 代码来源:StatusIcon.cs
示例19: CreateMenu
public void CreateMenu ()
{
using (NSAutoreleasePool a = new NSAutoreleasePool ())
{
this.menu = new NSMenu ();
this.menu.AutoEnablesItems = false;
this.FolderItems = new Dictionary<String, NSMenuItem>();
this.state_item = new NSMenuItem () {
Title = Controller.StateText,
Enabled = false
};
this.log_item = new NSMenuItem () {
Title = CmisSync.Properties_Resources.ViewLog
};
this.log_item.Activated += delegate
{
Controller.LogClicked();
};
this.add_item = new NSMenuItem () {
Title = CmisSync.Properties_Resources.AddARemoteFolder,
Enabled = true
};
this.add_item.Activated += delegate {
Controller.AddRemoteFolderClicked ();
};
this.about_item = new NSMenuItem () {
Title = CmisSync.Properties_Resources.About,
Enabled = true
};
this.about_item.Activated += delegate {
Controller.AboutClicked ();
};
this.quit_item = new NSMenuItem () {
Title = CmisSync.Properties_Resources.Exit,
Enabled = true
};
this.quit_item.Activated += delegate {
Controller.QuitClicked ();
};
this.menu.AddItem (this.state_item);
this.menu.AddItem (NSMenuItem.SeparatorItem);
if (Controller.Folders.Length > 0) {
foreach (string folder_name in Controller.Folders) {
this.menu.AddItem(CreateFolderMenuItem(folder_name));
};
if (Controller.OverflowFolders.Length > 0)
{
NSMenuItem moreitem = new NSMenuItem();
moreitem.Title = "More Folder";
NSMenu moreitemsmenu = new NSMenu();
foreach (string folder_name in Controller.OverflowFolders) {
moreitemsmenu.AddItem(CreateFolderMenuItem(folder_name));
};
moreitem.Submenu = moreitemsmenu;
this.menu.AddItem(moreitem);
}
this.menu.AddItem (NSMenuItem.SeparatorItem);
}
this.menu.AddItem (this.add_item);
this.menu.AddItem (NSMenuItem.SeparatorItem);
this.menu.AddItem (this.log_item);
this.menu.AddItem (this.about_item);
this.menu.AddItem (NSMenuItem.SeparatorItem);
this.menu.AddItem (this.quit_item);
this.menu.Delegate = new StatusIconMenuDelegate ();
this.status_item.Menu = this.menu;
}
}
开发者ID:j2m2, 项目名称:CmisSync, 代码行数:82, 代码来源:StatusIcon.cs
示例20: CreateFolderMenuItem
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18283| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9680| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8180| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8549| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8458| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9394| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8431| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7865| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8416| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7394| 2022-11-06
请发表评论