상속: MonoMac.AppKit.NSMenuItem
예제 #1
0
        /// <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);
        }
예제 #2
0
        public void CreateMenu() {
            this.menu = new Menu();
            if (this.repoItems != null) {
                foreach(var repoItem in this.repoItems) {
                    repoItem.Dispose();
                }
            }
            this.repoItems.Clear();

            // Folders Menu
            if (this.Controller.Folders.Length > 0) {
                foreach (var repo in Program.Controller.Repositories) {
                    var repoItem = new RepositoryMenuItem(repo, this.Controller);
                    this.repoItems.Add(repoItem);
                    this.menu.Add(repoItem);
                }

                this.menu.Add(new SeparatorMenuItem());
            }

            // Add Menu
            MenuItem add_item = new MenuItem(CmisSync.Properties_Resources.AddARemoteFolder);
            add_item.Activated += delegate {
                this.Controller.AddRemoteFolderClicked();
            };
            this.menu.Add(add_item);

            this.menu.Add(new SeparatorMenuItem());

            MenuItem settingsItem = new MenuItem(
                Properties_Resources.Settings);
            settingsItem.Activated += delegate {
                this.Controller.SettingClicked();
            };
            this.menu.Add(settingsItem);
            MenuItem transmissionsItem = new MenuItem(
                Properties_Resources.Transmission);
            transmissionsItem.Activated += delegate {
                this.Controller.TransmissionClicked();
            };
            this.menu.Add(transmissionsItem);

            // Log Menu
            MenuItem log_item = new MenuItem(
                    CmisSync.Properties_Resources.ViewLog);
            log_item.Activated += delegate {
                this.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 {
                this.Controller.AboutClicked();
            };
            this.menu.Add(about_item);
            this.menu.Add(new SeparatorMenuItem());
            this.quitItem = new MenuItem(
                    CmisSync.Properties_Resources.Exit) {
                Sensitive = true
            };

            this.quitItem.Activated += delegate {
                this.Controller.QuitClicked();
            };

            this.menu.Add(this.quitItem);
            this.menu.ShowAll();

#if HAVE_APP_INDICATOR
            this.indicator.Menu = this.menu;
#endif
            this.isHandleCreated = true;
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        public void CreateMenu() {
            using (NSAutoreleasePool a = new NSAutoreleasePool()) {
                this.repoItems = new List<RepositoryMenuItem>();
                this.menu = new NSMenu();
                this.menu.AutoEnablesItems = false;

                this.general_settings_item = new NSMenuItem() {
                    Title = Properties_Resources.EditTitle
                };

                this.general_settings_item.Activated += delegate {
                    this.Controller.SettingClicked();
                };

                this.transmission_item = new NSMenuItem() {
                    Title = Properties_Resources.Transmission
                };

                this.transmission_item.Activated += delegate {
                    this.Controller.TransmissionClicked();
                };

                this.log_item = new NSMenuItem() {
                    Title = Properties_Resources.ViewLog
                };

                this.log_item.Activated += delegate {
                    this.Controller.LogClicked();
                };

                this.add_item = new NSMenuItem() {
                    Title   = Properties_Resources.AddARemoteFolder,
                    Enabled = true
                };

                this.add_item.Activated += delegate {
                    this.Controller.AddRemoteFolderClicked();
                };

                this.about_item = new NSMenuItem() {
                    Title   = string.Format(Properties_Resources.About, Properties_Resources.ApplicationName),
                    Enabled = true
                };

                this.about_item.Activated += delegate {
                    Controller.AboutClicked ();
                };

                this.quit_item = new NSMenuItem() {
                    Title   = Properties_Resources.Exit,
                    Enabled = true
                };

                this.quit_item.Activated += delegate {
                    Controller.QuitClicked();
                };

                var repos = Program.Controller.Repositories;
                if (repos.Length > 0) {
                    foreach (var repo in repos) {
                        var repoItem = new RepositoryMenuItem(repo, this.Controller);
                        this.repoItems.Add(repoItem);
                        this.menu.AddItem(repoItem);
                    };
                    this.menu.AddItem(NSMenuItem.SeparatorItem);
                }

                this.menu.AddItem(this.add_item);
                this.menu.AddItem(NSMenuItem.SeparatorItem);
                this.menu.AddItem(this.general_settings_item);
                this.menu.AddItem(this.transmission_item);
                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;
            }
        }
예제 #5
0
        public void CreateMenu()
        {
            using (NSAutoreleasePool a = new NSAutoreleasePool()) {
                this.repoItems             = new List <RepositoryMenuItem>();
                this.menu                  = new NSMenu();
                this.menu.AutoEnablesItems = false;

                this.general_settings_item = new NSMenuItem()
                {
                    Title = Properties_Resources.EditTitle
                };

                this.general_settings_item.Activated += delegate {
                    this.Controller.SettingClicked();
                };

                this.transmission_item = new NSMenuItem()
                {
                    Title = Properties_Resources.Transmission
                };

                this.transmission_item.Activated += delegate {
                    this.Controller.TransmissionClicked();
                };

                this.log_item = new NSMenuItem()
                {
                    Title = Properties_Resources.ViewLog
                };

                this.log_item.Activated += delegate {
                    this.Controller.LogClicked();
                };

                this.add_item = new NSMenuItem()
                {
                    Title   = Properties_Resources.AddARemoteFolder,
                    Enabled = true
                };

                this.add_item.Activated += delegate {
                    this.Controller.AddRemoteFolderClicked();
                };

                this.about_item = new NSMenuItem()
                {
                    Title   = string.Format(Properties_Resources.About, Properties_Resources.ApplicationName),
                    Enabled = true
                };

                this.about_item.Activated += delegate {
                    Controller.AboutClicked();
                };

                this.quit_item = new NSMenuItem()
                {
                    Title   = Properties_Resources.Exit,
                    Enabled = true
                };

                this.quit_item.Activated += delegate {
                    Controller.QuitClicked();
                };

                var repos = Program.Controller.Repositories;
                if (repos.Length > 0)
                {
                    foreach (var repo in repos)
                    {
                        var repoItem = new RepositoryMenuItem(repo, this.Controller);
                        this.repoItems.Add(repoItem);
                        this.menu.AddItem(repoItem);
                    }
                    ;
                    this.menu.AddItem(NSMenuItem.SeparatorItem);
                }

                this.menu.AddItem(this.add_item);
                this.menu.AddItem(NSMenuItem.SeparatorItem);
                this.menu.AddItem(this.general_settings_item);
                this.menu.AddItem(this.transmission_item);
                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;
            }
        }
예제 #6
0
        public void CreateMenu()
        {
            this.menu = new Menu();
            if (this.repoItems != null)
            {
                foreach (var repoItem in this.repoItems)
                {
                    repoItem.Dispose();
                }
            }
            this.repoItems.Clear();

            // Folders Menu
            if (this.Controller.Folders.Length > 0)
            {
                foreach (var repo in Program.Controller.Repositories)
                {
                    var repoItem = new RepositoryMenuItem(repo, this.Controller);
                    this.repoItems.Add(repoItem);
                    this.menu.Add(repoItem);
                }

                this.menu.Add(new SeparatorMenuItem());
            }

            // Add Menu
            MenuItem add_item = new MenuItem(CmisSync.Properties_Resources.AddARemoteFolder);

            add_item.Activated += delegate {
                this.Controller.AddRemoteFolderClicked();
            };
            this.menu.Add(add_item);

            this.menu.Add(new SeparatorMenuItem());

            MenuItem settingsItem = new MenuItem(
                Properties_Resources.Settings);

            settingsItem.Activated += delegate {
                this.Controller.SettingClicked();
            };
            this.menu.Add(settingsItem);
            MenuItem transmissionsItem = new MenuItem(
                Properties_Resources.Transmission);

            transmissionsItem.Activated += delegate {
                this.Controller.TransmissionClicked();
            };
            this.menu.Add(transmissionsItem);

            // Log Menu
            MenuItem log_item = new MenuItem(
                CmisSync.Properties_Resources.ViewLog);

            log_item.Activated += delegate {
                this.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 {
                this.Controller.AboutClicked();
            };
            this.menu.Add(about_item);
            this.menu.Add(new SeparatorMenuItem());
            this.quitItem = new MenuItem(
                CmisSync.Properties_Resources.Exit)
            {
                Sensitive = true
            };

            this.quitItem.Activated += delegate {
                this.Controller.QuitClicked();
            };

            this.menu.Add(this.quitItem);
            this.menu.ShowAll();

#if HAVE_APP_INDICATOR
            this.indicator.Menu = this.menu;
#endif
            this.isHandleCreated = true;
        }