Exemplo n.º 1
0
        public void Fill(CalendarOptions options)
        {
            this.Rows.Clear();
            createGridHeader();
            for (int i = 0; i < PluginsManager.Instance.Modules.Length; i++)
            {
                int newRowIndex = Rows.Count;
                Rows.Insert(newRowIndex);
                var row    = Rows[newRowIndex];
                var module = PluginsManager.Instance.Modules[i];
                row.Tag = module.GlobalId;
                string text = EntryObjectLocalizationManager.Instance.GetString(module.EntryObjectType, LocalizationConstants.EntryObjectName);
                var    cell = new SourceGrid.Cells.Cell(text);
                cell.Image           = module.ModuleImage;
                this[newRowIndex, 0] = cell;

                bool isChecked = true;
                if (options.ShowIcons.ContainsKey(module.GlobalId))
                {
                    isChecked = options.ShowIcons[module.GlobalId];
                }
                cell = new SourceGrid.Cells.CheckBox(null, isChecked);
                this[newRowIndex, 1] = cell;
                isChecked            = options.GetDefaultEntry(module.GlobalId);
                cell = new SourceGrid.Cells.CheckBox(null, isChecked);
                this[newRowIndex, 2] = cell;
            }
            Columns.AutoSizeColumn(0);
        }
Exemplo n.º 2
0
        void fillModulesList(CalendarOptions options)
        {
            //for (int i = 0; i < PluginsManager.Instance.EntryObjectExtensions.Length; i++)
            //{
            //    var module = PluginsManager.Instance.EntryObjectExtensions[i];
            //    var optionItem=options.DefaultEntries.Where(x => x.ModuleId == module.GlobalId).SingleOrDefault();
            //    if(optionItem!=null)
            //    {
            //        var item = new ModuleSettingViewModel(module,optionItem);
            //        item.IsDefault = options.GetDefaultEntry(module.GlobalId);
            //        lvModulesSettings.Items.Add(item);
            //    }

            //}
            var temp = new ObservableCollection <ModuleSettingViewModel>();

            for (int i = 0; i < PluginsManager.Instance.EntryObjectExtensions.Length; i++)
            {
                var module = PluginsManager.Instance.EntryObjectExtensions[i];

                var optionItem = options.DefaultEntries.Where(x => x.ModuleId == module.GlobalId).SingleOrDefault();
                if (optionItem == null)
                {
                    optionItem = new CalendarOptionsItem(module.GlobalId, false);
                }


                ModuleSettingViewModel item = new ModuleSettingViewModel(optionItem);
                item.Value = module.GlobalId;

                item.Text         = EntryObjectLocalizationManager.Instance.GetString(module.EntryObjectType, EnumLocalizer.EntryObjectName);
                item.Image        = module.ModuleImage;
                item.IsDefault    = options.GetDefaultEntry(module.GlobalId);
                item.CanBeDefault = canBeDefault(module.EntryObjectType);
                temp.Add(item);
            }

            for (int i = 0; i < PluginsManager.Instance.CalendarDayContentsEx.Count(); i++)
            {
                var module = PluginsManager.Instance.CalendarDayContentsEx.ElementAt(i);

                var optionItem = options.DefaultEntries.Where(x => x.ModuleId == module.Value.GlobalId).SingleOrDefault();

                if (optionItem == null)
                {
                    optionItem = new CalendarOptionsItem(module.Value.GlobalId, false);
                }

                ModuleSettingViewModel item = temp.Where(x => x.Value == module.Value.GlobalId).SingleOrDefault();

                if (item == null)
                {
                    item              = new ModuleSettingViewModel(optionItem);
                    item.Value        = module.Value.GlobalId;
                    item.Text         = module.Value.Name;
                    item.Image        = module.Value.Image;
                    item.CanBeDefault = false;
                    temp.Add(item);
                }
                item.Order = options.DefaultEntries.IndexOf(optionItem);
            }
            Modules = new ObservableCollection <ModuleSettingViewModel>(temp.OrderBy(x => x.Order));
            //foreach (var calendarOptionsItem in options.DefaultEntries)
            //{
            //    var module = PluginsManager.Instance.GetEntryObjectProvider(calendarOptionsItem.ModuleId);
            //    var item = new ModuleSettingViewModel(module, calendarOptionsItem);
            //    item.IsDefault = options.GetDefaultEntry(module.GlobalId);
            //    lvModulesSettings.Items.Add(item);
            //}
        }