MVC controller for the CmisSync status icon.
Ejemplo n.º 1
0
        public RepositoryMenuItem(Repository repo, StatusIconController controller) : base(repo.Name)
        {
            this.repository = repo;
            this.controller = controller;
            this.Image      = this.folderImage;
            this.Image.Size = new SizeF(16, 16);
            this.repository.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.Status))
                {
                    this.Status = this.repository.Status;
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.LastFinishedSync))
                {
                    this.changesFoundAt = this.repository.LastFinishedSync;
                    this.UpdateStatusText();
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.NumberOfChanges))
                {
                    this.changesFound = this.repository.NumberOfChanges;
                    this.UpdateStatusText();
                }
            };
            this.openLocalFolderItem = new NSMenuItem(Properties_Resources.OpenLocalFolder)
            {
                Image = this.folderImage
            };
            this.openLocalFolderItem.Image.Size = new SizeF(16, 16);

            this.openLocalFolderItem.Activated += this.OpenFolderDelegate();

            this.editItem            = new NSMenuItem(Properties_Resources.Settings);
            this.editItem.Activated += this.EditFolderDelegate();

            this.suspendItem = new NSMenuItem(Properties_Resources.PauseSync);

            this.Status = repo.Status;

            this.suspendItem.Activated += this.SuspendSyncFolderDelegate();
            this.statusItem             = new NSMenuItem(Properties_Resources.StatusSearchingForChanges)
            {
                Enabled = false
            };

            this.removeFolderFromSyncItem            = new NSMenuItem(Properties_Resources.RemoveFolderFromSync);
            this.removeFolderFromSyncItem.Activated += this.RemoveFolderFromSyncDelegate();

            var subMenu = new NSMenu();

            subMenu.AddItem(this.statusItem);
            subMenu.AddItem(NSMenuItem.SeparatorItem);
            subMenu.AddItem(this.openLocalFolderItem);
            subMenu.AddItem(this.suspendItem);
            subMenu.AddItem(this.editItem);
            subMenu.AddItem(NSMenuItem.SeparatorItem);
            subMenu.AddItem(this.removeFolderFromSyncItem);
            this.Submenu = subMenu;
        }
Ejemplo n.º 2
0
        public RepositoryMenuItem(
            Repository repo,
            StatusIconController controller,
            Control parent) : base(repo.Name)
        {
            this.repository  = repo;
            this.controller  = controller;
            this.parent      = parent;
            this.Image       = UIHelpers.GetBitmap("folder");
            this.suspendItem = new ToolStripMenuItem(Properties_Resources.PauseSync, UIHelpers.GetBitmap("media_playback_pause"));
            this.repository.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.Status))
                {
                    this.Status = this.repository.Status;
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.LastFinishedSync))
                {
                    this.changesFoundAt = this.repository.LastFinishedSync;
                    this.UpdateStatusText();
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.NumberOfChanges))
                {
                    this.changesFound = this.repository.NumberOfChanges;
                    this.UpdateStatusText();
                }
            };

            this.openLocalFolderItem = new ToolStripMenuItem(Properties_Resources.OpenLocalFolder)
            {
                Image = UIHelpers.GetBitmap("folder")
            };

            this.openLocalFolderItem.Click += this.OpenFolderDelegate();

            this.editItem        = new ToolStripMenuItem(Properties_Resources.Settings);
            this.editItem.Click += this.EditFolderDelegate();

            this.Status = repo.Status;

            this.suspendItem.Click += this.SuspendSyncFolderDelegate();
            this.statusItem         = new ToolStripMenuItem(Properties_Resources.StatusSearchingForChanges)
            {
                Enabled = false
            };

            this.removeFolderFromSyncItem        = new ToolStripMenuItem(Properties_Resources.RemoveFolderFromSync);
            this.removeFolderFromSyncItem.Click += this.RemoveFolderFromSyncDelegate();

            this.DropDownItems.Add(this.statusItem);
            this.DropDownItems.Add(new ToolStripSeparator());
            this.DropDownItems.Add(this.openLocalFolderItem);
            this.DropDownItems.Add(this.suspendItem);
            this.DropDownItems.Add(this.editItem);
            this.DropDownItems.Add(new ToolStripSeparator());
            this.DropDownItems.Add(this.removeFolderFromSyncItem);
        }
Ejemplo n.º 3
0
        public RepositoryMenuItem(Repository repo, StatusIconController controller) : base(repo.Name) {
            this.SetProperty("always-show-image", new GLib.Value(true));
            this.repository = repo;
            this.controller = controller;
            this.Image = new Image(UIHelpers.GetIcon("dataspacesync-folder", 16));
            this.repository.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.Status)) {
                    this.Status = this.repository.Status;
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.LastFinishedSync)) {
                    this.changesFoundAt = this.repository.LastFinishedSync;
                    this.UpdateStatusText();
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.NumberOfChanges)) {
                    this.changesFound = this.repository.NumberOfChanges;
                    this.UpdateStatusText();
                }
            };

            this.openLocalFolderItem = new CmisSyncMenuItem(
                CmisSync.Properties_Resources.OpenLocalFolder) {
                Image = new Image(UIHelpers.GetIcon("dataspacesync-folder", 16))
            };

            this.openLocalFolderItem.Activated += this.OpenFolderDelegate();

            this.editItem = new CmisSyncMenuItem(CmisSync.Properties_Resources.Settings);
            this.editItem.Activated += this.EditFolderDelegate();

            this.suspendItem = new CmisSyncMenuItem(Properties_Resources.PauseSync);

            this.Status = this.repository.Status;

            this.suspendItem.Activated += this.SuspendSyncFolderDelegate();
            this.statusItem = new MenuItem(Properties_Resources.StatusSearchingForChanges) {
                Sensitive = false
            };

            this.removeFolderFromSyncItem = new CmisSyncMenuItem(
                CmisSync.Properties_Resources.RemoveFolderFromSync) {
                Image = new Image(UIHelpers.GetIcon("dataspacesync-deleted", 12))
            };
            this.removeFolderFromSyncItem.Activated += this.RemoveFolderFromSyncDelegate();
            this.separator1 = new SeparatorMenuItem();
            this.separator2 = new SeparatorMenuItem();

            var subMenu = new Menu();
            subMenu.Add(this.statusItem);
            subMenu.Add(this.separator1);
            subMenu.Add(this.openLocalFolderItem);
            subMenu.Add(this.suspendItem);
            subMenu.Add(this.editItem);
            subMenu.Add(this.separator2);
            subMenu.Add(this.removeFolderFromSyncItem);
            this.Submenu = subMenu;
        }
Ejemplo n.º 4
0
        public RepositoryMenuItem(
            Repository repo,
            StatusIconController controller,
            Control parent) : base(repo.Name)
        {
            this.repository = repo;
            this.controller = controller;
            this.parent = parent;
            this.Image = UIHelpers.GetBitmap("folder");
            this.suspendItem = new ToolStripMenuItem(Properties_Resources.PauseSync, UIHelpers.GetBitmap("media_playback_pause"));
            this.repository.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.Status)) {
                    this.Status = this.repository.Status;
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.LastFinishedSync)) {
                    this.changesFoundAt = this.repository.LastFinishedSync;
                    this.UpdateStatusText();
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.NumberOfChanges)) {
                    this.changesFound = this.repository.NumberOfChanges;
                    this.UpdateStatusText();
                }
            };

            this.openLocalFolderItem = new ToolStripMenuItem(Properties_Resources.OpenLocalFolder) {
                Image = UIHelpers.GetBitmap("folder")
            };

            this.openLocalFolderItem.Click += this.OpenFolderDelegate();

            this.editItem = new ToolStripMenuItem(Properties_Resources.Settings);
            this.editItem.Click += this.EditFolderDelegate();

            this.Status = repo.Status;

            this.suspendItem.Click += this.SuspendSyncFolderDelegate();
            this.statusItem = new ToolStripMenuItem(Properties_Resources.StatusSearchingForChanges) {
                Enabled = false
            };

            this.removeFolderFromSyncItem = new ToolStripMenuItem(Properties_Resources.RemoveFolderFromSync);
            this.removeFolderFromSyncItem.Click += this.RemoveFolderFromSyncDelegate();

            this.DropDownItems.Add(this.statusItem);
            this.DropDownItems.Add(new ToolStripSeparator());
            this.DropDownItems.Add(this.openLocalFolderItem);
            this.DropDownItems.Add(this.suspendItem);
            this.DropDownItems.Add(this.editItem);
            this.DropDownItems.Add(new ToolStripSeparator());
            this.DropDownItems.Add(this.removeFolderFromSyncItem);
        }
Ejemplo n.º 5
0
        public RepositoryMenuItem(Repository repo, StatusIconController controller) : base(repo.Name) {
            this.repository = repo;
            this.controller = controller;
            this.Image = this.folderImage;
            this.Image.Size = new SizeF(16, 16);
            this.repository.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.Status)) {
                    this.Status = this.repository.Status;
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.LastFinishedSync)) {
                    this.changesFoundAt = this.repository.LastFinishedSync;
                    this.UpdateStatusText();
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.NumberOfChanges)) {
                    this.changesFound = this.repository.NumberOfChanges;
                    this.UpdateStatusText();
                }
            };
            this.openLocalFolderItem = new NSMenuItem(Properties_Resources.OpenLocalFolder) {
                Image = this.folderImage
            };
            this.openLocalFolderItem.Image.Size = new SizeF(16, 16);

            this.openLocalFolderItem.Activated += this.OpenFolderDelegate();

            this.editItem = new NSMenuItem(Properties_Resources.Settings);
            this.editItem.Activated += this.EditFolderDelegate();

            this.suspendItem = new NSMenuItem(Properties_Resources.PauseSync);

            this.Status = repo.Status;

            this.suspendItem.Activated += this.SuspendSyncFolderDelegate();
            this.statusItem = new NSMenuItem(Properties_Resources.StatusSearchingForChanges) {
                Enabled = false
            };

            this.removeFolderFromSyncItem = new NSMenuItem(Properties_Resources.RemoveFolderFromSync);
            this.removeFolderFromSyncItem.Activated += this.RemoveFolderFromSyncDelegate();

            var subMenu = new NSMenu();
            subMenu.AddItem(this.statusItem);
            subMenu.AddItem(NSMenuItem.SeparatorItem);
            subMenu.AddItem(this.openLocalFolderItem);
            subMenu.AddItem(this.suspendItem);
            subMenu.AddItem(this.editItem);
            subMenu.AddItem(NSMenuItem.SeparatorItem);
            subMenu.AddItem(this.removeFolderFromSyncItem);
            this.Submenu = subMenu;
        }
Ejemplo n.º 6
0
        public RepositoryMenuItem(Repository repo, StatusIconController controller) : base(repo.Name)
        {
            this.SetProperty("always-show-image", new GLib.Value(true));
            this.repository = repo;
            this.controller = controller;
            this.Image      = new Image(UIHelpers.GetIcon("dataspacesync-folder", 16));
            this.repository.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.Status))
                {
                    this.Status = this.repository.Status;
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.LastFinishedSync))
                {
                    this.changesFoundAt = this.repository.LastFinishedSync;
                    this.UpdateStatusText();
                }

                if (e.PropertyName == CmisSync.Lib.Utils.NameOf((Repository r) => r.NumberOfChanges))
                {
                    this.changesFound = this.repository.NumberOfChanges;
                    this.UpdateStatusText();
                }
            };

            this.openLocalFolderItem = new CmisSyncMenuItem(
                CmisSync.Properties_Resources.OpenLocalFolder)
            {
                Image = new Image(UIHelpers.GetIcon("dataspacesync-folder", 16))
            };

            this.openLocalFolderItem.Activated += this.OpenFolderDelegate();

            this.editItem            = new CmisSyncMenuItem(CmisSync.Properties_Resources.Settings);
            this.editItem.Activated += this.EditFolderDelegate();

            this.suspendItem = new CmisSyncMenuItem(Properties_Resources.PauseSync);

            this.Status = this.repository.Status;

            this.suspendItem.Activated += this.SuspendSyncFolderDelegate();
            this.statusItem             = new MenuItem(Properties_Resources.StatusSearchingForChanges)
            {
                Sensitive = false
            };

            this.removeFolderFromSyncItem = new CmisSyncMenuItem(
                CmisSync.Properties_Resources.RemoveFolderFromSync)
            {
                Image = new Image(UIHelpers.GetIcon("dataspacesync-deleted", 12))
            };
            this.removeFolderFromSyncItem.Activated += this.RemoveFolderFromSyncDelegate();
            this.separator1 = new SeparatorMenuItem();
            this.separator2 = new SeparatorMenuItem();

            var subMenu = new Menu();

            subMenu.Add(this.statusItem);
            subMenu.Add(this.separator1);
            subMenu.Add(this.openLocalFolderItem);
            subMenu.Add(this.suspendItem);
            subMenu.Add(this.editItem);
            subMenu.Add(this.separator2);
            subMenu.Add(this.removeFolderFromSyncItem);
            this.Submenu = subMenu;
        }