public frmCategoryList() { InitializeComponent(); olvCategory.AddDecoration(new EditingCellBorderDecoration(true)); TypedObjectListView <Category> tlist = new TypedObjectListView <Category>(olvCategory); tlist.GenerateAspectGetters(); colCat.AspectGetter = delegate(object x) { return(((Category)x).LABEL.ToString()); }; }
private bool LoadAddandDelete(List <CRSelectFunction> lstCRFunction, ObjectListView blv, ComboBox cboDataSet, ComboBox cboEndPointGroup, ComboBox cboView, bool isDel) { try { blv.SetObjects(lstCRFunction); TypedObjectListView <CRSelectFunction> tlist = new TypedObjectListView <CRSelectFunction>(blv); tlist.GenerateAspectGetters(); blv.TileSize = new Size(120, 90); Tools.IncidenceBusinessCardRenderer blvRender = new Tools.IncidenceBusinessCardRenderer(); blv.ItemRenderer = blvRender; blv.OwnerDraw = true; cboView.SelectedIndex = 0; List <CRSelectFunction> lstAvailable = (List <CRSelectFunction>)blv.Objects; Dictionary <string, int> DicFilterDataSet = new Dictionary <string, int>(); DicFilterDataSet.Add("", -1); var query = from a in lstAvailable select new { a.BenMAPHealthImpactFunction.DataSetName, a.BenMAPHealthImpactFunction.DataSetID }; if (query != null && query.Count() > 0) { List <KeyValuePair <string, int> > lstFilterDataSet = DicFilterDataSet.ToList(); lstFilterDataSet.AddRange(query.Distinct().ToDictionary(p => p.DataSetName, p => p.DataSetID)); DicFilterDataSet = lstFilterDataSet.ToDictionary(p => p.Key, p => p.Value); } BindingSource bs = new BindingSource(); bs.DataSource = DicFilterDataSet; cboDataSet.DataSource = bs; cboDataSet.DisplayMember = "Key"; cboDataSet.ValueMember = "Value"; Dictionary <string, int> DicFilterGroup = new Dictionary <string, int>(); DicFilterGroup.Add("", -1); var queryGroup = from a in lstAvailable select new { a.BenMAPHealthImpactFunction.EndPointGroup, a.BenMAPHealthImpactFunction.EndPointGroupID }; if (queryGroup != null && queryGroup.Count() > 0) { List <KeyValuePair <string, int> > lstGroup = DicFilterGroup.ToList(); lstGroup.AddRange(queryGroup.Distinct().ToDictionary(p => p.EndPointGroup, p => p.EndPointGroupID)); DicFilterGroup = lstGroup.ToDictionary(p => p.Key, p => p.Value); } BindingSource bsqueryGroup = new BindingSource(); bsqueryGroup.DataSource = DicFilterGroup; cboEndPointGroup.DataSource = bsqueryGroup; cboEndPointGroup.DisplayMember = "Key"; cboEndPointGroup.ValueMember = "Value"; return(true); } catch (Exception ex) { Logger.LogError(ex); return(false); } }
private void InitializeColumns() { TypedObjectListView <Task> tlist = new TypedObjectListView <Task>(this.objectListView1); tlist.GenerateAspectGetters(); // Status Column (Checked Box) this.StatusColumn.GroupKeyGetter = delegate(object rowObject) { Task nTask = (Task)rowObject; return(nTask.Status); }; this.StatusColumn.GroupKeyToTitleConverter = delegate(object groupKey) { return(((Task.STATUS_TYPES)groupKey).ToString()); }; this.StatusColumn.ImageGetter = delegate(object rowObject) { Task nTask = (Task)rowObject; if (nTask.Status == Task.STATUS_TYPES.COMPLETED) { return("checked"); } else { return("unchecked"); } }; // Task Column (NIL) // Deadline Column this.DeadlineColumn.AspectToStringConverter = delegate(object aspect) { if (Parameters.Deadline_P == Parameters.DEADLINE_DISPLAY.DATE) { return(((DateTime)aspect).Date.ToShortDateString()); } else { TimeSpan nSpan = ((DateTime)aspect).Date.Subtract(DateTime.Today); return(nSpan.TotalDays.ToString() + " Days"); } }; // Priority Column this.PriorityColumn.Renderer = new PriorityColumnRender("tick", 3, 0, 4); }
private void SetupFasterAspectGetters() { // The following line makes getting aspect about 10x faster. Since getting the aspect is // the slowest part of building the ListView, it is worthwhile BUT NOT NECESSARY to do. TypedObjectListView <Person> tlist = new TypedObjectListView <Person>(this.olvComplex); tlist.GenerateAspectGetters(); /* * The line above the equivalent to typing the following: */ // tlist.GetColumn(0).AspectGetter = delegate(Person x) { return x.Name; }; // tlist.GetColumn(1).AspectGetter = delegate(Person x) { return x.Occupation; }; // tlist.GetColumn(2).AspectGetter = delegate(Person x) { return x.CulinaryRating; }; // tlist.GetColumn(3).AspectGetter = delegate(Person x) { return x.YearOfBirth; }; // tlist.GetColumn(4).AspectGetter = delegate(Person x) { return x.BirthDate; }; // tlist.GetColumn(5).AspectGetter = delegate(Person x) { return x.GetRate(); }; // tlist.GetColumn(6).AspectGetter = delegate(Person x) { return x.Comments; }; }
public frmReportList() { InitializeComponent(); olvReport.AddDecoration(new EditingCellBorderDecoration(true)); TypedObjectListView <Category> tlist = new TypedObjectListView <Category>(olvReport); tlist.GenerateAspectGetters(); colCat.AspectGetter = delegate(object x) { return(((Definition)x).CATEGORY.ToString()); }; colRep.AspectGetter = delegate(object x) { return(((Definition)x).LABEL.ToString()); }; colAva.AspectGetter = delegate(object x) { return(((Definition)x).AVAILABLE); }; colAva.Renderer = new MappedImageRenderer(new Object[] { true, imageList.Images[0], false, imageList.Images[1] }); }
private void InitializeColumns() { TypedObjectListView <Guest> tlist = new TypedObjectListView <Guest>(this.objectListView1); tlist.GenerateAspectGetters(); this.CategoryColumn.GroupKeyGetter = delegate(object rowObject) { Guest nGuest = (Guest)rowObject; return(nGuest.Category); }; this.TableColumn.GroupKeyGetter = delegate(object rowObject) { Guest nGuest = (Guest)rowObject; return("ID " + nGuest.Table); }; this.CheckinColumn.ImageGetter = delegate(object rowObject) { return(((Guest)rowObject).CheckIn ? "check" : "uncheck"); }; }
// Initalize the Format of the ObjectListView private void InitModel() { if (ObjectListView.IsVistaOrLater) { this.Font = new Font("msyh", 8); } this.folvAnime.AddDecoration(new EditingCellBorderDecoration(true)); TypedObjectListView <Anime> tolv = new TypedObjectListView <Anime>(this.folvAnime); tolv.GenerateAspectGetters(); // Name of Anime TypedColumn <Anime> tc = new TypedColumn <Anime>(this.olvColName); tc.AspectPutter = (Anime a, object opn) => { a.Name = opn.ToString(); }; // Schedule of Anime tc = new TypedColumn <Anime>(this.olvColSchedule); tc.GroupKeyGetter = (Anime a) => a.Year; // Type of Anime tc = new TypedColumn <Anime>(this.olvColType); tc.AspectPutter = (Anime a, object opt) => { a.Type = (MediaType)opt; }; tc.ImageGetter = (Anime a) => { switch (a.Format) { case MergeFormat.MKV: return(Properties.Resources.MKV); case MergeFormat.MP4: return(Properties.Resources.MP4); case MergeFormat.AVI: return(Properties.Resources.AVI); case MergeFormat.WMV: return(Properties.Resources.WMV); case MergeFormat.M2TS: return(Properties.Resources.M2TS); default: return(-1); } }; // Format of Anime #region //this.olvColFormat.Renderer = new MappedImageRenderer(new object[] { // MergeFormat.MKV, Properties.Resources.MKV, // MergeFormat.MP4, Properties.Resources.MP4, // MergeFormat.AVI, Properties.Resources.AVI, // MergeFormat.WMV, Properties.Resources.WMV, // MergeFormat.M2TS, Properties.Resources.M2TS //}); //tc = new TypedColumn<Anime>(this.olvColFormat); //tc.AspectPutter = delegate(Anime a, object opf) { a.Format = (MergeFormat)opf; }; #endregion // SubTeam of Anime tc = new TypedColumn <Anime>(this.olvColSubTeam); tc.AspectPutter = (Anime a, object opp) => { a.SubTeam = opp.ToString(); }; tc.ImageGetter = (Anime a) => { switch (a.SubStyle) { case SubStyles.External: return(Properties.Resources.External); case SubStyles.Sealed: return(Properties.Resources.Sealed); case SubStyles.Embedded: return(Properties.Resources.Embedded); default: return(-1); } }; // SubStyle of Anime #region //this.olvColSubStyle.Renderer = new MappedImageRenderer(new object[] { // SubStyles.External, Properties.Resources.External, // SubStyles.Sealed, Properties.Resources.Sealed, // SubStyles.Embedded, Properties.Resources.Embedded //}); //tc = new TypedColumn<Anime>(this.olvColSubStyle); //tc.AspectPutter = delegate(Anime a, object ops) { a.SubStyle = (SubStyles)ops; }; #endregion // Size of Anime this.olvColSize.AspectToStringConverter = ots => { long ls = (long)ots; if (ls == 0L) { return("-"); } else if (ls >= 1000000000L) { return(String.Format("{0:#,##0.#0} G", ls / 1073741824D)); } else { return(String.Format("{0:#,##0.#0} M", ls / 1048576D)); } }; this.olvColSize.MakeGroupies( new long[] { 5368709120L, 10737418240L }, new string[] { "0~5 GB", "5~10 GB", ">10 GB" } ); // Store of Anime tc = new TypedColumn <Anime>(this.olvColStore); tc.AspectPutter = (Anime a, object opg) => { a.Store = (bool)opg; }; this.olvColStore.Renderer = new MappedImageRenderer(true, Properties.Resources.Accept, false, Properties.Resources.Alert); // Enjoy of Anime tc = new TypedColumn <Anime>(this.olvColEnjoy); tc.AspectPutter = (Anime a, object opv) => { a.Enjoy = (bool)opv; }; this.olvColEnjoy.Renderer = new MappedImageRenderer(true, Properties.Resources.Smile, false, Properties.Resources.Sad); // Grade of Anime tc = new TypedColumn <Anime>(this.olvColGrade); tc.AspectPutter = (Anime a, object opr) => { int onr = (int)opr; a.Grade = onr; //onr < 1 ? 1 : onr; }; this.olvColGrade.Renderer = new MultiImageRenderer(Properties.Resources.Diamond, 3, 0, 4); this.olvColGrade.MakeGroupies( new int[] { 1, 2 }, new string[] { "Normal", "Nice", "Good" } ); // Note of Anime this.olvColNote.AspectToStringConverter = otn => otn.ToString().Replace('\u0002', '\u0020'); //RowBorderDecoration rbd = new RowBorderDecoration(); //rbd.BorderPen = new Pen(Color.Orchid, 1); //rbd.FillBrush = null; //rbd.CornerRounding = 4.0f; //HotItemStyle hotItemStyle = new HotItemStyle(); //hotItemStyle.Decoration = rbd; //hotItemStyle.Overlay = new AnimeViewOverlay(); //this.folvAnime.HotItemStyle = hotItemStyle; this.folvAnime.UseTranslucentHotItem = true; this.folvAnime.UseTranslucentSelection = true; this.folvAnime.HotItemStyle.Overlay = new AnimeViewOverlay(); this.folvAnime.HotItemStyle = this.folvAnime.HotItemStyle; this.folvAnime.PrimarySortColumn = this.olvColTitle; this.folvAnime.PrimarySortOrder = SortOrder.Ascending; }
/// <summary> /// Initializes the lstGames Control. /// </summary> private void InitializeLstGames() { tlstGames = new TypedObjectListView<GameInfo>(this.lstGames); //Aspect Getters tlstGames.GenerateAspectGetters(); colGameID.AspectToStringConverter = delegate(object obj) { int id = (int)obj; return (id < 0) ? GlobalStrings.MainForm_External : id.ToString(); }; colCategories.AspectGetter = delegate(Object g) { return ((GameInfo)g).GetCatString(GlobalStrings.MainForm_Uncategorized); }; colFavorite.AspectGetter = delegate(Object g) { return ((GameInfo)g).IsFavorite() ? "X" : String.Empty; }; colHidden.AspectGetter = delegate(Object g) { return ((GameInfo)g).Hidden ? "X" : String.Empty; }; colGenres.AspectGetter = delegate(Object g) { int id = ((GameInfo)g).Id; if (Program.GameDB.Games.ContainsKey(id) && Program.GameDB.Games[id].Genres != null) return string.Join(", ", Program.GameDB.Games[id].Genres); return GlobalStrings.MainForm_NoGenres; }; colFlags.AspectGetter = delegate(Object g) { int id = ((GameInfo)g).Id; if (Program.GameDB.Games.ContainsKey(id) && Program.GameDB.Games[id].Flags != null) return string.Join(", ", Program.GameDB.Games[id].Flags); return GlobalStrings.MainForm_NoFlags; }; colTags.AspectGetter = delegate(Object g) { int id = ((GameInfo)g).Id; if (Program.GameDB.Games.ContainsKey(id) && Program.GameDB.Games[id].Tags != null) return string.Join(", ", Program.GameDB.Games[id].Tags); return GlobalStrings.MainForm_NoTags; }; colYear.AspectGetter = delegate(object g) { int id = ((GameInfo)g).Id; DateTime releaseDate; if (Program.GameDB.Games.ContainsKey(id) && DateTime.TryParse(Program.GameDB.Games[id].SteamReleaseDate, out releaseDate)) return releaseDate.Year.ToString(); return GlobalStrings.MainForm_Unknown; }; colAchievements.AspectGetter = delegate(object g) { int id = ((GameInfo)g).Id; return Program.GameDB.Games.ContainsKey(id) ? Program.GameDB.Games[id].Achievements : 0; }; colPlatforms.AspectGetter = delegate(Object g) { return Program.GameDB.Games[((GameInfo)g).Id].Platforms.ToString(); }; colDevelopers.AspectGetter = delegate(Object g) { int id = ((GameInfo)g).Id; if (Program.GameDB.Games.ContainsKey(id) && Program.GameDB.Games[id].Developers != null) return string.Join(", ", Program.GameDB.Games[id].Developers); return GlobalStrings.MainForm_Unknown; }; colPublishers.AspectGetter = delegate(Object g) { int id = ((GameInfo)g).Id; if (Program.GameDB.Games.ContainsKey(id) && Program.GameDB.Games[id].Publishers != null) return string.Join(", ", Program.GameDB.Games[id].Publishers); return GlobalStrings.MainForm_Unknown; }; colNumberOfReviews.AspectGetter = delegate(object g) { int id = ((GameInfo)g).Id; return Program.GameDB.Games.ContainsKey(id) ? Program.GameDB.Games[id].ReviewTotal : 0; }; colReviewScore.AspectGetter = delegate(object g) { int id = ((GameInfo)g).Id; return Program.GameDB.Games.ContainsKey(id) ? Program.GameDB.Games[id].ReviewPositivePercentage : 0; }; colReviewLabel.AspectGetter = delegate(object g) { int id = ((GameInfo)g).Id; if (Program.GameDB.Games.ContainsKey(id)) { int reviewTotal = Program.GameDB.Games[id].ReviewTotal; int reviewPositivePercentage = Program.GameDB.Games[id].ReviewPositivePercentage; if (reviewTotal <= 0) return -1; if (reviewPositivePercentage >= 95 && reviewTotal >= 500) return 9; else if (reviewPositivePercentage >= 85 && reviewTotal >= 50) return 8; else if (reviewPositivePercentage >= 80) return 7; else if (reviewPositivePercentage >= 70) return 6; else if (reviewPositivePercentage >= 40) return 5; else if (reviewPositivePercentage >= 20) return 4; else if (reviewTotal >= 500) return 3; else if (reviewTotal >= 50) return 2; else return 1; } return 0; }; colHltbMain.AspectGetter = delegate(object g) { int id = ((GameInfo)g).Id; return Program.GameDB.Games.ContainsKey(id) ? Program.GameDB.Games[id].HltbMain : 0; }; colHltbExtras.AspectGetter = delegate(object g) { int id = ((GameInfo)g).Id; return Program.GameDB.Games.ContainsKey(id) ? Program.GameDB.Games[id].HltbExtras : 0; }; colHltbCompletionist.AspectGetter = delegate(object g) { int id = ((GameInfo)g).Id; return Program.GameDB.Games.ContainsKey(id) ? Program.GameDB.Games[id].HltbCompletionist : 0; }; //Aspect to String Converters colNumberOfReviews.AspectToStringConverter = delegate(object obj) { int reviewTotal = (int)obj; return (reviewTotal <= 0) ? "0" : reviewTotal.ToString(); }; colReviewScore.AspectToStringConverter = delegate(object obj) { int reviewScore = (int)obj; return (reviewScore <= 0) ? GlobalStrings.MainForm_Unknown : reviewScore.ToString() + '%'; }; colReviewLabel.AspectToStringConverter = delegate(object obj) { int index = (int)obj; Dictionary<int, String> reviewLabels = new Dictionary<int, String> { {9, "Overwhelmingly Positive"}, {8, "Very Positive"}, {7, "Positive"}, {6, "Mostly Positive"}, {5, "Mixed"}, {4, "Mostly Negative"}, {3, "Negative"}, {2, "Very Negative"}, {1, "Overwhelmingly Negative"}, }; return reviewLabels.ContainsKey(index) ? reviewLabels[index] : GlobalStrings.MainForm_Unknown; }; AspectToStringConverterDelegate hltb = delegate(object obj) { int time = (int)obj; if (time <= 0) return GlobalStrings.MainForm_NoHltbTime; if (time < 60) return time + "m"; int hours = time / 60; int mins = time % 60; if (mins == 0) return hours + "h"; return hours + "h " + mins + "m"; }; colHltbMain.AspectToStringConverter = delegate(object obj) { int time = (int)obj; if (time <= 0) return GlobalStrings.MainForm_NoHltbTime; if (time < 60) return time + "m"; int hours = time / 60; int mins = time % 60; if (mins == 0) return hours + "h"; return hours + "h " + mins + "m"; }; colHltbExtras.AspectToStringConverter = hltb; colHltbCompletionist.AspectToStringConverter = hltb; //Filtering colCategories.ClusteringStrategy = new CommaClusteringStrategy(); colGenres.ClusteringStrategy = new CommaClusteringStrategy(); colFlags.ClusteringStrategy = new CommaClusteringStrategy(); colTags.ClusteringStrategy = new CommaClusteringStrategy(); colPlatforms.ClusteringStrategy = new CommaClusteringStrategy(); //Formating lstGames.RowFormatter = delegate(OLVListItem lvi) { if (((GameInfo)lvi.RowObject).Id < 0) lvi.Font = new Font(lvi.Font, lvi.Font.Style | FontStyle.Italic); }; lstGames.PrimarySortColumn = colTitle; lstGames.RestoreState(Convert.FromBase64String(Settings.Instance.LstGamesState)); }
private void IncidencePoolingandAggregation_Load(object sender, EventArgs e) { try { if (CommonClass.BaseControlCRSelectFunctionCalculateValue != null && CommonClass.BaseControlCRSelectFunctionCalculateValue.lstCRSelectFunctionCalculateValue != null) { this.olvAvailable.SetObjects(CommonClass.BaseControlCRSelectFunctionCalculateValue.lstCRSelectFunctionCalculateValue); TypedObjectListView <CRSelectFunctionCalculateValue> tlist = new TypedObjectListView <CRSelectFunctionCalculateValue>(this.olvAvailable); tlist.GenerateAspectGetters(); this.olvAvailable.TileSize = new Size(300, 130); this.olvAvailable.ItemRenderer = new Tools.BusinessCardRenderer(); this.olvAvailable.ItemRenderer = new Tools.BusinessCardRenderer(); olvAvailable.OwnerDraw = true; } else { List <CRSelectFunctionCalculateValue> lst = new List <CRSelectFunctionCalculateValue>(); CRSelectFunctionCalculateValue cfcv = new CRSelectFunctionCalculateValue(); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(21); lst.Add(cfcv); CRSelectFunctionCalculateValue cfcv2 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv3 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv4 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv5 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv6 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv7 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv8 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv9 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv10 = new CRSelectFunctionCalculateValue(); CRSelectFunctionCalculateValue cfcv11 = new CRSelectFunctionCalculateValue(); cfcv2.CRSelectFunction = new CRSelectFunction(); cfcv2.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(22); lst.Add(cfcv2); cfcv3.CRSelectFunction = new CRSelectFunction(); cfcv3.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(40); lst.Add(cfcv3); cfcv4.CRSelectFunction = new CRSelectFunction(); cfcv4.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(41); lst.Add(cfcv4); cfcv5.CRSelectFunction = new CRSelectFunction(); cfcv5.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(62); lst.Add(cfcv5); cfcv6.CRSelectFunction = new CRSelectFunction(); cfcv6.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(63); lst.Add(cfcv6); cfcv7.CRSelectFunction = new CRSelectFunction(); cfcv7.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(64); lst.Add(cfcv7); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); cfcv.CRSelectFunction = new CRSelectFunction(); cfcv.CRSelectFunction.BenMAPHealthImpactFunction = Configuration.ConfigurationCommonClass.getBenMAPHealthImpactFunctionFromID(56); lst.Add(cfcv); this.olvAvailable.SetObjects(lst); TypedObjectListView <CRSelectFunctionCalculateValue> tlist = new TypedObjectListView <CRSelectFunctionCalculateValue>(this.olvAvailable); tlist.GenerateAspectGetters(); this.olvAvailable.TileSize = new Size(300, 130); this.olvAvailable.ItemRenderer = new Tools.BusinessCardRenderer(); olvAvailable.OwnerDraw = true; } this.olvSelected.CheckBoxes = false; List <CRSelectFunctionCalculateValue> lstAvailable = (List <CRSelectFunctionCalculateValue>) this.olvAvailable.Objects; Dictionary <string, int> DicFilterDataSet = new Dictionary <string, int>(); DicFilterDataSet.Add("", -1); var query = from a in lstAvailable select new { a.CRSelectFunction.BenMAPHealthImpactFunction.DataSetName, a.CRSelectFunction.BenMAPHealthImpactFunction.DataSetID }; if (query != null && query.Count() > 0) { List <KeyValuePair <string, int> > lstFilterDataSet = DicFilterDataSet.ToList(); lstFilterDataSet.AddRange(query.Distinct().ToDictionary(p => p.DataSetName, p => p.DataSetID)); DicFilterDataSet = lstFilterDataSet.ToDictionary(p => p.Key, p => p.Value); } BindingSource bs = new BindingSource(); bs.DataSource = DicFilterDataSet; this.cbDataSet.DataSource = bs; cbDataSet.DisplayMember = "Key"; cbDataSet.ValueMember = "Value"; Dictionary <string, int> DicFilterGroup = new Dictionary <string, int>(); DicFilterGroup.Add("", -1); var queryGroup = from a in lstAvailable select new { a.CRSelectFunction.BenMAPHealthImpactFunction.EndPointGroup, a.CRSelectFunction.BenMAPHealthImpactFunction.EndPointGroupID }; if (queryGroup != null && queryGroup.Count() > 0) { List <KeyValuePair <string, int> > lstGroup = DicFilterGroup.ToList(); lstGroup.AddRange(queryGroup.Distinct().ToDictionary(p => p.EndPointGroup, p => p.EndPointGroupID)); DicFilterGroup = lstGroup.ToDictionary(p => p.Key, p => p.Value); } BindingSource bsqueryGroup = new BindingSource(); bsqueryGroup.DataSource = DicFilterGroup; cbEndPointGroup.DataSource = bsqueryGroup; cbEndPointGroup.DisplayMember = "Key"; cbEndPointGroup.ValueMember = "Value"; this.cboPoolingMethod.DataSource = Enum.GetNames(typeof(PoolingMethodTypeEnum)); if (CommonClass.GBenMAPGrid != null) { this.txtTargetGridType.Text = CommonClass.GBenMAPGrid.GridDefinitionName; } } catch (Exception ex) { } }
// Initalize the Format of the ObjectListView private void InitModel() { this.olvAnime.AddDecoration(new EditingCellBorderDecoration(true)); TypedObjectListView <Anime> tolv = new TypedObjectListView <Anime>(this.olvAnime); tolv.GenerateAspectGetters(); // Name of Anime TypedColumn <Anime> tc = new TypedColumn <Anime>(this.olvColName); tc.AspectPutter = (Anime a, object opn) => { a.Name = opn.ToString(); }; // Schedule of Anime tc = new TypedColumn <Anime>(this.olvColAirdate); tc.GroupKeyGetter = (Anime a) => a.Year; // Type of Anime tc = new TypedColumn <Anime>(this.olvColType); tc.AspectPutter = (Anime a, object opt) => { a.Type = (MediaType)opt; }; tc.ImageGetter = (Anime a) => { switch (a.Format) { case MergeFormat.MKV: return(Properties.Resources.MKV); case MergeFormat.MP4: return(Properties.Resources.MP4); case MergeFormat.AVI: return(Properties.Resources.AVI); case MergeFormat.WMV: return(Properties.Resources.WMV); case MergeFormat.M2TS: return(Properties.Resources.M2TS); default: return(-1); } }; // SubTeam of Anime tc = new TypedColumn <Anime>(this.olvColSubTeam); tc.AspectPutter = (Anime a, object opp) => { a.SubTeam = opp.ToString(); }; tc.ImageGetter = (Anime a) => { switch (a.SubStyle) { case SubStyle.External: return(Properties.Resources.External); case SubStyle.Sealed: return(Properties.Resources.Sealed); case SubStyle.Embedded: return(Properties.Resources.Embedded); default: return(-1); } }; // Size of Anime this.olvColSize.AspectToStringConverter = ots => { long ls = (long)ots; if (ls == 0L) { return("-"); } else if (ls >= 1000L * 1024L * 1024L) // 1000M -> 0.9765625G { return(String.Format("{0:#,##0.#0} G", (double)ls / (1024 * 1024 * 1024))); } else { return(String.Format("{0:#,##0.#0} M", (double)ls / (1024 * 1024))); } }; this.olvColSize.MakeGroupies( new long[] { 1024L * 1024L * 1024L * 5L, 1024L * 1024L * 1024L * 10L }, new string[] { "0~5 GB", "5~10 GB", ">10 GB" } ); // Store of Anime tc = new TypedColumn <Anime>(this.olvColStore); //tc.AspectPutter = (Anime a, object opg) => { a.Store = (bool)opg; }; //this.olvColStore.Renderer = new MappedImageRenderer(true, Properties.Resources.Accept, false, Properties.Resources.Alert); tc.AspectPutter = (Anime a, object ops) => { a.Store = (StoreState)ops; }; this.olvColStore.Renderer = new MappedImageRenderer(new object[] { StoreState.Ignore, null, StoreState.Cont, Properties.Resources.Alert, StoreState.Fin, Properties.Resources.Accept }); // Enjoy of Anime tc = new TypedColumn <Anime>(this.olvColEnjoy); //tc.AspectPutter = (Anime a, object opv) => { a.Enjoy = (bool)opv; }; //this.olvColEnjoy.Renderer = new MappedImageRenderer(true, Properties.Resources.Smile, false, Properties.Resources.Sad); tc.AspectPutter = (Anime a, object ope) => { a.Enjoy = (EnjoyState)ope; }; this.olvColEnjoy.Renderer = new MappedImageRenderer(new object[] { EnjoyState.Ignore, null, EnjoyState.NotYet, Properties.Resources.Sad, EnjoyState.Done, Properties.Resources.Smile }); // Grade of Anime tc = new TypedColumn <Anime>(this.olvColGrade); tc.AspectPutter = (Anime a, object opr) => { int onr = (int)opr; a.Grade = onr; //onr < 1 ? 1 : onr; }; this.olvColGrade.Renderer = new MultiImageRenderer(Properties.Resources.Diamond, 3, 0, 4); this.olvColGrade.MakeGroupies( new int[] { 1, 2 }, new string[] { "Normal", "Nice", "Good" } ); // Note of Anime this.olvColNote.AspectToStringConverter = otn => otn.ToString().Replace('\u0002', '\u0020'); // this.olvAnime.UseHotItem auto true this.olvAnime.UseTranslucentHotItem = true; this.olvAnime.UseTranslucentSelection = true; this.olvAnime.HotItemStyle.Overlay = new AnimeViewOverlay(); this.olvAnime.HotItemStyle = this.olvAnime.HotItemStyle; this.olvAnime.PrimarySortColumn = this.olvColTitle; this.olvAnime.PrimarySortOrder = SortOrder.Ascending; }