コード例 #1
0
 void missingItem_RemoveFromTaskbar(MissingTaskbarItem source)
 {
     missingTasks.Remove(source.UniqueName);
     taskbar.removeItem(source);
     source.Dispose();
     taskbar.layout();
 }
コード例 #2
0
        public void loadPinnedTasks(ConfigFile configFile)
        {
            ConfigSection        taskbarSection       = configFile.createOrRetrieveConfigSection(TASKBAR_ALIGNMENT_SECTION);
            PinnedTaskSerializer pinnedTaskSerializer = new PinnedTaskSerializer(taskbarSection);

            String taskbarAlignmentString = taskbarSection.getValue("MainTaskbarAlignment", taskbar.Alignment.ToString());

            try
            {
                taskbar.Alignment = (TaskbarAlignment)Enum.Parse(typeof(TaskbarAlignment), taskbarAlignmentString);
            }
            catch (Exception)
            {
                Log.Warning("Could not parse the taskbar alignment {0}. Using default.", taskbarAlignmentString);
            }

            ConfigIterator configIterator = pinnedTaskSerializer.Tasks;

            while (configIterator.hasNext())
            {
                String uniqueName = configIterator.next();
                Task   item       = taskController.getTask(uniqueName);
                if (item != null)
                {
                    addPinnedTaskbarItem(item, -1);
                }
                else
                {
                    MissingTaskbarItem missingItem = new MissingTaskbarItem(uniqueName);
                    missingItem.RemoveFromTaskbar += missingItem_RemoveFromTaskbar;
                    taskbar.addItem(missingItem, -1);
                    missingTasks.Add(uniqueName, missingItem);
                }
            }
        }
コード例 #3
0
        void taskController_TaskRemoved(Task task, bool willReload)
        {
            TaskTaskbarItem item;

            if (taskbarItems.TryGetValue(task, out item))
            {
                if (willReload)
                {
                    int index = taskbar.getIndexForTaskItem(item);
                    MissingTaskbarItem missingItem = new MissingTaskbarItem(task.UniqueName);
                    missingItem.RemoveFromTaskbar += missingItem_RemoveFromTaskbar;
                    taskbar.addItem(missingItem, index);
                    missingTasks.Add(task.UniqueName, missingItem);
                }

                taskbarItems.Remove(task);
                taskbar.removeItem(item);
                item.Dispose();

                taskbar.layout();
            }
        }