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; } }
/// <summary> /// Create the UI elements of the menu. /// </summary> private void CreateMenu() { // Reset existing items. this.traymenu.Items.Clear(); // Create the state menu item. this.stateItem = new ToolStripMenuItem() { Text = Utils.Ellipsis(Controller.StateText, 32), Enabled = false }; if (Controller.StateText.Length > 32) { this.stateItem.ToolTipText = Utils.WordWrap(Controller.StateText, 63); } this.traymenu.Items.Add(stateItem); this.trayicon.Text = Utils.Ellipsis(Properties_Resources.Oris4Sync + "\n" + Controller.StateText, 63); // Create a menu item per synchronized folder. if (Controller.Folders.Length > 0) { foreach (string folderName in Controller.Folders) { // Main item. ToolStripMenuItem subfolderItem = new ToolStripMenuItem() { Text = folderName, Name = "tsmi" + folderName, Image = UIHelpers.GetBitmap("folder"), }; // Sub-item: open locally. ToolStripMenuItem openLocalFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.OpenLocalFolder, Name = "openLocal", Image = UIHelpers.GetBitmap("folder"), }; openLocalFolderItem.Click += OpenLocalFolderDelegate(folderName); // Sub-item: open remotely. ToolStripMenuItem openRemoteFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.BrowseRemoteFolder, Name = "openRemote", Image = UIHelpers.GetBitmap("classic_folder_web"), }; openRemoteFolderItem.Click += OpenRemoteFolderDelegate(folderName); // Sub-item: suspend sync. ToolStripMenuItem suspendFolderItem = new ToolStripMenuItem() { Name = "pause", }; suspendFolderItem.Click += SuspendSyncFolderDelegate(folderName); // Sub-item: remove folder from sync ToolStripMenuItem removeFolderFromSyncItem = new ToolStripMenuItem() { Text = Properties_Resources.RemoveFolderFromSync, Name = "remove", Image = UIHelpers.GetBitmap("disconnect"), }; removeFolderFromSyncItem.Click += RemoveFolderFromSyncDelegate(folderName); // Sub-item: manual sync ToolStripMenuItem manualSyncItem = new ToolStripMenuItem() { Text = Properties_Resources.ManualSync, Name = "sync", Image = UIHelpers.GetBitmap("media_playback_refresh"), }; manualSyncItem.Click += ManualSyncDelegate(folderName); // Sub-item: settings dialog ToolStripMenuItem settingsItem = new ToolStripMenuItem() { Text = Properties_Resources.Settings, Name = "settings", }; settingsItem.Click += SettingsDelegate(folderName); setSyncItemState(suspendFolderItem, manualSyncItem, SyncStatus.Idle); foreach (RepoBase aRepo in Program.Controller.Repositories) { if (aRepo.Name.Equals(folderName)) { setSyncItemState(suspendFolderItem, manualSyncItem, aRepo.Status); break; } } // Add the sub-items. subfolderItem.DropDownItems.Add(openLocalFolderItem); subfolderItem.DropDownItems.Add(openRemoteFolderItem); subfolderItem.DropDownItems.Add(new ToolStripSeparator()); subfolderItem.DropDownItems.Add(suspendFolderItem); subfolderItem.DropDownItems.Add(manualSyncItem); subfolderItem.DropDownItems.Add(new ToolStripSeparator()); subfolderItem.DropDownItems.Add(removeFolderFromSyncItem); subfolderItem.DropDownItems.Add(new ToolStripSeparator()); subfolderItem.DropDownItems.Add(settingsItem); // Add the main item. this.traymenu.Items.Add(subfolderItem); } } this.traymenu.Items.Add(new ToolStripSeparator()); // Create the menu item that lets the user add a new synchronized folder. ToolStripMenuItem addFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.AddARemoteFolder, Name = "add", Image = UIHelpers.GetBitmap("connect"), }; if (ConfigManager.CurrentConfig.SingleRepository && ConfigManager.CurrentConfig.Folder.Count > 0) { //Configured for single repository and repository count 1 or more so disable menu item. addFolderItem.Enabled = false; } addFolderItem.Click += delegate { Controller.AddRemoteFolderClicked(); }; this.traymenu.Items.Add(addFolderItem); this.traymenu.Items.Add(new ToolStripSeparator()); // Create the menu item that lets the user view the log. ToolStripMenuItem log_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ViewLog, Name = "log", }; log_item.Click += delegate { Controller.LogClicked(); }; //Removed for Oris4 //this.traymenu.Items.Add(log_item); // Create the About menu. ToolStripMenuItem about_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.About, Name = "about", }; about_item.Click += delegate { Controller.AboutClicked(); }; this.traymenu.Items.Add(about_item); // Create the exit menu. this.exitItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.Exit, Name = "exit", }; this.exitItem.Click += delegate { this.trayicon.Dispose(); Controller.QuitClicked(); }; this.traymenu.Items.Add(this.exitItem); }
public void CreateMenu() { this.menu = new Menu(); // State Menu this.state_item = new MenuItem(Controller.StateText) { Sensitive = false }; this.menu.Add(this.state_item); this.menu.Add(new SeparatorMenuItem()); // Folders Menu if (Controller.Folders.Length > 0) { foreach (string folder_name in Controller.Folders) { Menu submenu = new Menu(); ImageMenuItem subfolder_item = new CmisSyncMenuItem(folder_name) { Image = new Image(UIHelpers.GetIcon("dataspacesync-folder", 16)), Submenu = submenu, RepoName = folder_name }; ImageMenuItem open_localfolder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.OpenLocalFolder) { Image = new Image(UIHelpers.GetIcon("dataspacesync-folder", 16)) }; open_localfolder_item.Activated += OpenFolderDelegate(folder_name); ImageMenuItem edit_folder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.EditTitle); edit_folder_item.Activated += EditFolderDelegate(folder_name); ImageMenuItem suspend_folder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.PauseSync) { RepoName = folder_name }; foreach (Repository aRepo in Program.Controller.Repositories) { if (aRepo.Name.Equals(folder_name)) { setSyncItemState(suspend_folder_item, aRepo.Status); break; } } suspend_folder_item.Activated += SuspendSyncFolderDelegate(folder_name); ImageMenuItem remove_folder_from_sync_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.RemoveFolderFromSync) { Image = new Image(UIHelpers.GetIcon("dataspacesync-deleted", 12)) }; remove_folder_from_sync_item.Activated += RemoveFolderFromSyncDelegate(folder_name); submenu.Add(open_localfolder_item); submenu.Add(suspend_folder_item); // GUI workaround to remove ignore folder {{ //submenu.Add(edit_folder_item); // GUI workaround to remove ignore folder }} submenu.Add(new SeparatorMenuItem()); submenu.Add(remove_folder_from_sync_item); this.menu.Add(subfolder_item); } this.menu.Add(new SeparatorMenuItem()); } // Add Menu MenuItem add_item = new MenuItem( CmisSync.Properties_Resources.AddARemoteFolder); add_item.Activated += delegate { Controller.AddRemoteFolderClicked(); }; this.menu.Add(add_item); this.menu.Add(new SeparatorMenuItem()); // Log Menu MenuItem log_item = new MenuItem( CmisSync.Properties_Resources.ViewLog); log_item.Activated += delegate { Controller.LogClicked(); }; this.menu.Add(log_item); // About Menu MenuItem about_item = new MenuItem( String.Format(CmisSync.Properties_Resources.About, Properties_Resources.ApplicationName)); about_item.Activated += delegate { Controller.AboutClicked(); }; this.menu.Add(about_item); this.quit_item = new MenuItem( CmisSync.Properties_Resources.Exit) { Sensitive = true }; this.quit_item.Activated += delegate { Controller.QuitClicked(); }; this.menu.Add(this.quit_item); this.menu.ShowAll(); #if HAVE_APP_INDICATOR this.indicator.Menu = this.menu; #endif this.IsHandleCreated = true; }
/// <summary> /// Create the UI elements of the menu. /// </summary> private void CreateMenu() { // Reset existing items. this.traymenu.Items.Clear(); this.repoItems = new List <RepositoryMenuItem>(); this.trayicon.Text = string.Format("{0}\n{1}", Properties_Resources.ApplicationName, Controller.StateText); // Create a menu item per synchronized folder. if (Controller.Folders.Length > 0) { foreach (var repo in Program.Controller.Repositories) { var repoItem = new RepositoryMenuItem(repo, this.Controller, this); this.repoItems.Add(repoItem); this.traymenu.Items.Add(repoItem); } this.traymenu.Items.Add(new ToolStripSeparator()); } // Create the menu item that lets the user add a new synchronized folder. ToolStripMenuItem addFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.AddARemoteFolder }; addFolderItem.Click += delegate { Controller.AddRemoteFolderClicked(); }; this.traymenu.Items.Add(addFolderItem); this.traymenu.Items.Add(new ToolStripSeparator()); // Create the menu item that lets the user view setting. ToolStripMenuItem setting_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.Settings }; setting_item.Click += delegate { Controller.SettingClicked(); }; this.traymenu.Items.Add(setting_item); // Create the menu item that lets the uer view transmission. ToolStripMenuItem transmission_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.Transmission }; transmission_item.Click += delegate { Controller.TransmissionClicked(); }; this.traymenu.Items.Add(transmission_item); // Create the menu item that lets the user view the log. ToolStripMenuItem log_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ViewLog }; log_item.Click += delegate { Controller.LogClicked(); }; this.traymenu.Items.Add(log_item); // Create the About menu. ToolStripMenuItem about_item = new ToolStripMenuItem() { Text = String.Format(Properties_Resources.About, Properties_Resources.ApplicationName) }; about_item.Click += delegate { Controller.AboutClicked(); }; this.traymenu.Items.Add(about_item); // Create the exit menu. this.exitItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.Exit }; this.exitItem.Click += delegate { this.trayicon.Dispose(); Controller.QuitClicked(); }; this.traymenu.Items.Add(this.exitItem); }
public void CreateMenu() { this.menu = new Menu(); // State Menu this.state_item = new MenuItem(Controller.StateText) { Sensitive = false }; this.menu.Add(this.state_item); this.menu.Add(new SeparatorMenuItem()); // Folders Menu if (Controller.Folders.Length > 0) { foreach (string folder_name in Controller.Folders) { Menu submenu = new Menu(); ImageMenuItem subfolder_item = new CmisSyncMenuItem(folder_name) { Image = new Image(UIHelpers.GetIcon("folder-cmissync", 16)), Submenu = submenu }; ImageMenuItem open_localfolder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.ResourceManager.GetString("OpenLocalFolder", CultureInfo.CurrentCulture)) { Image = new Image(UIHelpers.GetIcon("folder-cmissync", 16)) }; open_localfolder_item.Activated += OpenFolderDelegate(folder_name); ImageMenuItem browse_remotefolder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.ResourceManager.GetString("BrowseRemoteFolder", CultureInfo.CurrentCulture)) { Image = new Image(UIHelpers.GetIcon("folder-cmissync", 16)) }; browse_remotefolder_item.Activated += OpenRemoteFolderDelegate(folder_name); ImageMenuItem suspend_folder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.ResourceManager.GetString("PauseSync", CultureInfo.CurrentCulture)) { Image = new Image(UIHelpers.GetIcon("media_playback_pause", 16)) }; suspend_folder_item.Activated += SuspendSyncFolderDelegate(folder_name); submenu.Add(open_localfolder_item); submenu.Add(browse_remotefolder_item); submenu.Add(suspend_folder_item); this.menu.Add(subfolder_item); } this.menu.Add(new SeparatorMenuItem()); } // Add Menu MenuItem add_item = new MenuItem( CmisSync.Properties_Resources.ResourceManager.GetString("AddARemoteFolder", CultureInfo.CurrentCulture)); add_item.Activated += delegate { Controller.AddRemoteFolderClicked(); }; this.menu.Add(add_item); this.menu.Add(new SeparatorMenuItem()); // Log Menu MenuItem log_item = new MenuItem( CmisSync.Properties_Resources.ResourceManager.GetString("ViewLog", CultureInfo.CurrentCulture)); log_item.Activated += delegate { Controller.LogClicked(); }; this.menu.Add(log_item); // About Menu MenuItem about_item = new MenuItem( CmisSync.Properties_Resources.ResourceManager.GetString("About", CultureInfo.CurrentCulture)); about_item.Activated += delegate { Controller.AboutClicked(); }; this.menu.Add(about_item); this.quit_item = new MenuItem( CmisSync.Properties_Resources.ResourceManager.GetString("Exit", CultureInfo.CurrentCulture)) { Sensitive = true }; this.quit_item.Activated += delegate { Controller.QuitClicked(); }; this.menu.Add(this.quit_item); this.menu.ShowAll(); #if HAVE_APP_INDICATOR this.indicator.Menu = this.menu; #endif }
/// <summary> /// Create the GUI elements of the menu. /// </summary> public void CreateMenu() { this.menu = new Menu(); // State Menu this.state_item = new MenuItem(Controller.StateText) { Sensitive = false }; this.menu.Add(this.state_item); this.menu.Add(new SeparatorMenuItem()); // Folders Menu if (Controller.Folders.Length > 0) { foreach (string folder_name in Controller.Folders) { Menu submenu = new Menu(); ImageMenuItem subfolder_item = new CmisSyncMenuItem(folder_name) { Image = new Image(UIHelpers.GetIcon("folder-cmissync", 16)), Submenu = submenu, RepoName = folder_name }; // Sub-item: open locally. ImageMenuItem open_localfolder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.OpenLocalFolder) { Image = new Image(UIHelpers.GetIcon("folder-cmissync", 16)) }; open_localfolder_item.Activated += OpenFolderDelegate(folder_name); /* * // Sub-item: open remotely. * ImageMenuItem browse_remotefolder_item = new CmisSyncMenuItem( * CmisSync.Properties_Resources.BrowseRemoteFolder) { * Image = new Image (UIHelpers.GetIcon ("folder-cmissync", 16)) * }; * browse_remotefolder_item.Activated += OpenRemoteFolderDelegate(folder_name); */ ImageMenuItem edit_folder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.EditTitle); edit_folder_item.Activated += EditFolderDelegate(folder_name); // Sub-item: suspend sync. ImageMenuItem suspend_folder_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.PauseSync) { RepoName = folder_name }; foreach (RepoBase aRepo in Program.Controller.Repositories) { if (aRepo.Name.Equals(folder_name)) { setSyncItemState(suspend_folder_item, aRepo.Status); break; } } suspend_folder_item.Activated += SuspendSyncFolderDelegate(folder_name); // Sub-item: remove folder from sync ImageMenuItem remove_folder_from_sync_item = new CmisSyncMenuItem( CmisSync.Properties_Resources.RemoveFolderFromSync) { Image = new Image(UIHelpers.GetIcon("document-deleted", 12)) }; remove_folder_from_sync_item.Activated += RemoveFolderFromSyncDelegate(folder_name); // Add the sub-items. submenu.Add(open_localfolder_item); //submenu.Add(browse_remotefolder_item); submenu.Add(suspend_folder_item); submenu.Add(edit_folder_item); submenu.Add(new SeparatorMenuItem()); submenu.Add(remove_folder_from_sync_item); // Add the main item. this.menu.Add(subfolder_item); } this.menu.Add(new SeparatorMenuItem()); } // Add Menu MenuItem add_item = new MenuItem( CmisSync.Properties_Resources.AddARemoteFolder); add_item.Activated += delegate { Controller.AddRemoteFolderClicked(); }; this.menu.Add(add_item); this.menu.Add(new SeparatorMenuItem()); // Log Menu MenuItem log_item = new MenuItem( CmisSync.Properties_Resources.ViewLog); log_item.Activated += delegate { Controller.LogClicked(); }; this.menu.Add(log_item); // About Menu MenuItem about_item = new MenuItem( CmisSync.Properties_Resources.About); about_item.Activated += delegate { Controller.AboutClicked(); }; this.menu.Add(about_item); this.quit_item = new MenuItem( CmisSync.Properties_Resources.Exit) { Sensitive = true }; this.quit_item.Activated += delegate { Controller.QuitClicked(); }; this.menu.Add(this.quit_item); this.menu.ShowAll(); #if HAVE_APP_INDICATOR this.indicator.Menu = this.menu; #endif this.IsHandleCreated = true; }
/// <summary> /// Create the UI elements of the menu. /// </summary> private void CreateMenu() { // Reset existing items. this.traymenu.Items.Clear(); // Create the state menu item. this.stateItem = new ToolStripMenuItem() { Text = Controller.StateText, Enabled = false }; this.traymenu.Items.Add(stateItem); this.trayicon.Text = String.Format("{0}\n{1}", Properties_Resources.ApplicationName, Controller.StateText); this.traymenu.Items.Add(new ToolStripSeparator()); /*this.transmissionItem = new ToolStripMenuItem() * { * Text = "No active transmissions", * Enabled = false * }; * this.traymenu.Items.Add(transmissionItem); */ // Create a menu item per synchronized folder. if (Controller.Folders.Length > 0) { foreach (string folderName in Controller.Folders) { // Main item. ToolStripMenuItem subfolderItem = new ToolStripMenuItem() { Text = folderName, Name = "tsmi" + folderName, Image = UIHelpers.GetBitmap("folder") }; // Sub-item: open locally. ToolStripMenuItem openLocalFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.OpenLocalFolder, Image = UIHelpers.GetBitmap("folder") }; openLocalFolderItem.Click += OpenLocalFolderDelegate(folderName); // Sub-item: edit ignore folder. ToolStripMenuItem editFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.Settings }; editFolderItem.Click += EditFolderDelegate(folderName); // Sub-item: suspend sync. ToolStripMenuItem suspendFolderItem = new ToolStripMenuItem(); setSyncItemState(suspendFolderItem, SyncStatus.Idle); foreach (Repository aRepo in Program.Controller.Repositories) { if (aRepo.Name.Equals(folderName)) { setSyncItemState(suspendFolderItem, aRepo.Status); break; } } suspendFolderItem.Click += SuspendSyncFolderDelegate(folderName); // Sub-item: remove folder from sync ToolStripMenuItem removeFolderFromSyncItem = new ToolStripMenuItem() { Text = Properties_Resources.RemoveFolderFromSync, Tag = "remove", }; removeFolderFromSyncItem.Click += RemoveFolderFromSyncDelegate(folderName); // Add the sub-items. subfolderItem.DropDownItems.Add(openLocalFolderItem); //subfolderItem.DropDownItems.Add(openRemoteFolderItem); subfolderItem.DropDownItems.Add(new ToolStripSeparator()); subfolderItem.DropDownItems.Add(suspendFolderItem); subfolderItem.DropDownItems.Add(new ToolStripSeparator()); subfolderItem.DropDownItems.Add(editFolderItem); subfolderItem.DropDownItems.Add(new ToolStripSeparator()); subfolderItem.DropDownItems.Add(removeFolderFromSyncItem); // Add the main item. this.traymenu.Items.Add(subfolderItem); } this.traymenu.Items.Add(new ToolStripSeparator()); } // Create the menu item that lets the user add a new synchronized folder. ToolStripMenuItem addFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.AddARemoteFolder }; addFolderItem.Click += delegate { Controller.AddRemoteFolderClicked(); }; this.traymenu.Items.Add(addFolderItem); this.traymenu.Items.Add(new ToolStripSeparator()); // Create the menu item that lets the user view setting. ToolStripMenuItem setting_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.Settings }; setting_item.Click += delegate { Controller.SettingClicked(); }; this.traymenu.Items.Add(setting_item); // Create the menu item that lets the user view the log. ToolStripMenuItem log_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ViewLog }; log_item.Click += delegate { Controller.LogClicked(); }; this.traymenu.Items.Add(log_item); // Create the About menu. ToolStripMenuItem about_item = new ToolStripMenuItem() { Text = String.Format(Properties_Resources.About, Properties_Resources.ApplicationName) }; about_item.Click += delegate { Controller.AboutClicked(); }; this.traymenu.Items.Add(about_item); // Create the exit menu. this.exitItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.Exit }; this.exitItem.Click += delegate { this.trayicon.Dispose(); Controller.QuitClicked(); }; this.traymenu.Items.Add(this.exitItem); }
/// <summary> /// Create the UI elements of the menu. /// </summary> private void CreateMenu() { // Reset existing items. this.traymenu.Items.Clear(); // Create the state menu item. this.stateItem = new ToolStripMenuItem() { Text = Controller.StateText, Enabled = false }; this.traymenu.Items.Add(stateItem); this.trayicon.Text = "CmisSync\n" + Controller.StateText; // Create a menu item per synchronized folder. if (Controller.Folders.Length > 0) { foreach (string folderName in Controller.Folders) { // Main item. ToolStripMenuItem subfolderItem = new ToolStripMenuItem() { Text = folderName, Name = "tsmi" + folderName, Image = UIHelpers.GetBitmap("folder") }; // Sub-item: open locally. ToolStripMenuItem openLocalFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ResourceManager.GetString("OpenLocalFolder", CultureInfo.CurrentCulture), Image = UIHelpers.GetBitmap("folder") }; openLocalFolderItem.Click += OpenLocalFolderDelegate(folderName); // Sub-item: open remotely. ToolStripMenuItem openRemoteFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ResourceManager.GetString("BrowseRemoteFolder", CultureInfo.CurrentCulture), Image = UIHelpers.GetBitmap("classic_folder_web") }; openRemoteFolderItem.Click += OpenRemoteFolderDelegate(folderName); // Sub-item: suspend sync. ToolStripMenuItem suspendFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ResourceManager.GetString("PauseSync", CultureInfo.CurrentCulture), Tag = "pause", Image = UIHelpers.GetBitmap("media_playback_pause") }; suspendFolderItem.Click += SuspendSyncFolderDelegate(folderName); // Add the sub-items. subfolderItem.DropDownItems.Add(openLocalFolderItem); subfolderItem.DropDownItems.Add(openRemoteFolderItem); subfolderItem.DropDownItems.Add(new ToolStripSeparator()); subfolderItem.DropDownItems.Add(suspendFolderItem); // Add the main item. this.traymenu.Items.Add(subfolderItem); } } this.traymenu.Items.Add(new ToolStripSeparator()); // Create the menu item that lets the user add a new synchronized folder. ToolStripMenuItem addFolderItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ResourceManager.GetString("AddARemoteFolder", CultureInfo.CurrentCulture) }; addFolderItem.Click += delegate { Controller.AddRemoteFolderClicked(); }; this.traymenu.Items.Add(addFolderItem); this.traymenu.Items.Add(new ToolStripSeparator()); // Create the menu item that lets the user view the log. ToolStripMenuItem log_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ResourceManager.GetString("ViewLog", CultureInfo.CurrentCulture) }; log_item.Click += delegate { Controller.LogClicked(); }; this.traymenu.Items.Add(log_item); // Create the About menu. ToolStripMenuItem about_item = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ResourceManager.GetString("About", CultureInfo.CurrentCulture) }; about_item.Click += delegate { Controller.AboutClicked(); }; this.traymenu.Items.Add(about_item); // Create the exit menu. this.exitItem = new ToolStripMenuItem() { Text = CmisSync.Properties_Resources.ResourceManager.GetString("Exit", CultureInfo.CurrentCulture) }; this.exitItem.Click += delegate { this.trayicon.Dispose(); Controller.QuitClicked(); }; this.traymenu.Items.Add(this.exitItem); }