Пример #1
0
        void OnContentSwitched(object obj, EventArgs e)
        {
            TreeIter iter;

            if (switcherCombo.GetActiveIter(out iter))
            {
                if (sw.Children.Length > 0)
                {
                    sw.Remove(sw.Children[0]);
                }
                ITaskListView view = (ITaskListView)switcherCombo.Model.GetValue(iter, 1);
                sw.Add(view.Content);

                if (activeView != null && activeView.ToolBarItems != null && activeView.ToolBarItems.Length > 0)
                {
                    foreach (Widget w in activeView.ToolBarItems)
                    {
                        toolbar.Remove(w);
                    }
                    toolbar.Remove(separator);
                }

                if (view != null && view.ToolBarItems != null && view.ToolBarItems.Length > 0)
                {
                    toolbar.Add(separator);
                    foreach (Widget w in view.ToolBarItems)
                    {
                        toolbar.Add(w);
                    }
                }
                if (toolbar != null)
                {
                    toolbar.ShowAll();
                }

                activeView = view;
                control.ShowAll();

                string className = (string)switcherCombo.Model.GetValue(iter, 2);
                PropertyService.Set("Monodevelop.TaskList.ActiveView", className);
            }
        }
Пример #2
0
        public ToDoController(
            IConfigService configService,
            TaskList taskList,
            string archiveFilePath,
            IDictionary <string, ITodoCommand> commands,
            ITaskListView taskListView)
        {
            _configService   = configService;
            _commands        = commands;
            _taskListView    = taskListView;
            _archiveFilePath = archiveFilePath;

            _context = new CommandContext()
            {
                TaskList    = taskList,
                DebugLevel  = Int32.Parse(configService.GetValue("debug_level")),
                GroupByType = DotNetExtensions.ParseEnum <GroupByType>(configService.GetValue(ConfigService.GROUP_BY_TYPE_KEY), GroupByType.None),
                SortType    = DotNetExtensions.ParseEnum <SortType>(configService.GetValue(ConfigService.SORT_TYPE_KEY), SortType.Project),
                Filter      = new TaskFilter(configService.GetValue(ConfigService.FILTER_TEXT_KEY)),
            };

            Console.WriteLine($"Command context: DebugLevel: {_context.DebugLevel}, GroupByType: {_context.GroupByType.ToString()}, SortType: {_context.SortType.ToString()}, Filter: {_context.Filter}");

            bool listOnStart;

            if (Boolean.TryParse(configService.GetValue("list_on_start"), out listOnStart))
            {
                _context.ListOnStart = listOnStart;
            }

            bool listAfterCommand;

            if (Boolean.TryParse(configService.GetValue("list_after_command"), out listAfterCommand))
            {
                _context.ListAfterCommand = listAfterCommand;
            }
        }
		void OnContentSwitched (object obj, EventArgs e)
		{
			TreeIter iter;
			if (switcherCombo.GetActiveIter (out iter))
			{
				if (sw.Children.Length > 0)
					sw.Remove (sw.Children[0]);
				ITaskListView view = (ITaskListView)switcherCombo.Model.GetValue (iter, 1);
				sw.Add (view.Content);
				
				if (activeView != null && activeView.ToolBarItems != null && activeView.ToolBarItems.Length > 0)
				{
					foreach (Widget w in activeView.ToolBarItems)
						toolbar.Remove (w);
					toolbar.Remove (separator);
				}
				
				if (view != null && view.ToolBarItems != null && view.ToolBarItems.Length > 0)
				{
					toolbar.Add (separator);
					foreach (Widget w in view.ToolBarItems)
						toolbar.Add (w);
				}
				if (toolbar != null)
					toolbar.ShowAll ();
				
				activeView = view;
				control.ShowAll ();
				
				string className = (string)switcherCombo.Model.GetValue (iter, 2);
				PropertyService.Set ("Monodevelop.TaskList.ActiveView", className);
			}
		}