home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
My TVSeries
User edited fields not working as expected
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="ltfearme" data-source="post: 1133996" data-attributes="member: 52219"><p>It makes a new database field called Genre_USEREDIT__ and inserts the genre in there. You can see in the configuration the row turns blue in colour. Now if you restart the config, you can see it shows you Genre instead of Genre_USEREDIT__.</p><p></p><p>I can see how it got broken:</p><p></p><p>[code]</p><p>private void AddPropertyBindingSource(string FieldPrettyName, string FieldName, string FieldValue, bool CanModify, DataGridViewContentAlignment TextAlign)</p><p> {</p><p> int id = -1;</p><p> bool userEdited = false;</p><p> // are we a user_edited item? if so replace the orig entry</p><p> if (FieldName.EndsWith(DBTable.cUserEditPostFix))</p><p> {</p><p> // except if the content is empty, then we just dont display it</p><p> if (string.IsNullOrEmpty(FieldValue)) return;</p><p> string origFieldName = FieldName.Replace(DBTable.cUserEditPostFix, "");</p><p> for (int i = 0; i < dataGridView1.Rows.Count; i++)</p><p> {</p><p> if (dataGridView1.Rows[i].Cells[1].Tag as string == origFieldName)</p><p> {</p><p> id = i;</p><p> userEdited = true;</p><p> break;</p><p> }</p><p></p><p> }</p><p> }</p><p></p><p> if (id < 0)</p><p> {</p><p> DataGridViewRow dataGridDetailRow = new DataGridViewRow();</p><p> DataGridViewTextBoxCell cFieldName;</p><p></p><p> if ((FieldName == DBOnlineSeries.cLanguage) && (DBOption.GetOptions(DBOption.cOverrideLanguage)))</p><p> {</p><p> dataGridDetailRow = new DataGridViewRow();</p><p> cFieldName = new DataGridViewTextBoxCell();</p><p> DataGridViewComboBoxCell cbCell = new DataGridViewComboBoxCell();</p><p></p><p> // First Column (Name)</p><p> cFieldName.Value = FieldPrettyName;</p><p> cFieldName.Style.BackColor = System.Drawing.SystemColors.Control;</p><p> dataGridDetailRow.Cells.Add(cFieldName);</p><p> cFieldName.ReadOnly = true;</p><p></p><p> // Second Column (Value)</p><p> if (onlineLanguages.Count == 0)</p><p> {</p><p> onlineLanguages.AddRange(new GetLanguages().languages);</p><p> }</p><p></p><p> foreach (Language lang in onlineLanguages)</p><p> {</p><p> cbCell.Items.Add(lang.language);</p><p> }</p><p></p><p> Language selectedLang = onlineLanguages.Find(x => x.abbreviation.Contains(FieldValue));</p><p> for (int i = 0; i < cbCell.Items.Count; i++)</p><p> {</p><p> string s = cbCell.Items[i].ToString();</p><p> if (cbCell.Items[i].ToString() == selectedLang.language)</p><p> {</p><p> cbCell.Value = cbCell.Items[i];</p><p> }</p><p> }</p><p></p><p> cbCell.Tag = FieldName;</p><p></p><p> dataGridDetailRow.Cells.Add(cbCell);</p><p> cbCell.ReadOnly = false;</p><p></p><p> // Add the row to the DataGridView</p><p> dataGridView1.Rows.Add(dataGridDetailRow);</p><p> }</p><p> else</p><p> {</p><p> cFieldName = new DataGridViewTextBoxCell();</p><p> DataGridViewTextBoxCell cFieldValue = new DataGridViewTextBoxCell();</p><p></p><p> if (FieldName == DBEpisode.cAudioLanguage)</p><p> FieldPrettyName = GetAudioLanguageDisplayName(FieldValue);</p><p></p><p> // First Column (Name)</p><p> cFieldName.Value = FieldPrettyName;</p><p> cFieldName.Style.BackColor = System.Drawing.SystemColors.Control;</p><p> dataGridDetailRow.Cells.Add(cFieldName);</p><p> cFieldName.ReadOnly = true;</p><p></p><p> cFieldValue.Value = FieldValue;</p><p> cFieldValue.Tag = FieldName;</p><p></p><p> dataGridDetailRow.Cells.Add(cFieldValue);</p><p></p><p> if (!CanModify)</p><p> {</p><p> cFieldValue.ReadOnly = true;</p><p> cFieldValue.Style.BackColor = System.Drawing.SystemColors.Control;</p><p> }</p><p></p><p> if (userEdited)</p><p> {</p><p> cFieldValue.Style.ForeColor = System.Drawing.SystemColors.HotTrack;</p><p></p><p> }</p><p></p><p> cFieldValue.Style.Alignment = TextAlign;</p><p></p><p> // Add the rows to the DataGridView</p><p> dataGridView1.Rows.Add(dataGridDetailRow);</p><p> }</p><p> }</p><p> }</p><p>[/code]</p><p></p><p>When there is a user edit, the id is > 0, therefore it gets to the condition "if (id < 0)" and then exits the method.</p></blockquote><p></p>
[QUOTE="ltfearme, post: 1133996, member: 52219"] It makes a new database field called Genre_USEREDIT__ and inserts the genre in there. You can see in the configuration the row turns blue in colour. Now if you restart the config, you can see it shows you Genre instead of Genre_USEREDIT__. I can see how it got broken: [code] private void AddPropertyBindingSource(string FieldPrettyName, string FieldName, string FieldValue, bool CanModify, DataGridViewContentAlignment TextAlign) { int id = -1; bool userEdited = false; // are we a user_edited item? if so replace the orig entry if (FieldName.EndsWith(DBTable.cUserEditPostFix)) { // except if the content is empty, then we just dont display it if (string.IsNullOrEmpty(FieldValue)) return; string origFieldName = FieldName.Replace(DBTable.cUserEditPostFix, ""); for (int i = 0; i < dataGridView1.Rows.Count; i++) { if (dataGridView1.Rows[i].Cells[1].Tag as string == origFieldName) { id = i; userEdited = true; break; } } } if (id < 0) { DataGridViewRow dataGridDetailRow = new DataGridViewRow(); DataGridViewTextBoxCell cFieldName; if ((FieldName == DBOnlineSeries.cLanguage) && (DBOption.GetOptions(DBOption.cOverrideLanguage))) { dataGridDetailRow = new DataGridViewRow(); cFieldName = new DataGridViewTextBoxCell(); DataGridViewComboBoxCell cbCell = new DataGridViewComboBoxCell(); // First Column (Name) cFieldName.Value = FieldPrettyName; cFieldName.Style.BackColor = System.Drawing.SystemColors.Control; dataGridDetailRow.Cells.Add(cFieldName); cFieldName.ReadOnly = true; // Second Column (Value) if (onlineLanguages.Count == 0) { onlineLanguages.AddRange(new GetLanguages().languages); } foreach (Language lang in onlineLanguages) { cbCell.Items.Add(lang.language); } Language selectedLang = onlineLanguages.Find(x => x.abbreviation.Contains(FieldValue)); for (int i = 0; i < cbCell.Items.Count; i++) { string s = cbCell.Items[i].ToString(); if (cbCell.Items[i].ToString() == selectedLang.language) { cbCell.Value = cbCell.Items[i]; } } cbCell.Tag = FieldName; dataGridDetailRow.Cells.Add(cbCell); cbCell.ReadOnly = false; // Add the row to the DataGridView dataGridView1.Rows.Add(dataGridDetailRow); } else { cFieldName = new DataGridViewTextBoxCell(); DataGridViewTextBoxCell cFieldValue = new DataGridViewTextBoxCell(); if (FieldName == DBEpisode.cAudioLanguage) FieldPrettyName = GetAudioLanguageDisplayName(FieldValue); // First Column (Name) cFieldName.Value = FieldPrettyName; cFieldName.Style.BackColor = System.Drawing.SystemColors.Control; dataGridDetailRow.Cells.Add(cFieldName); cFieldName.ReadOnly = true; cFieldValue.Value = FieldValue; cFieldValue.Tag = FieldName; dataGridDetailRow.Cells.Add(cFieldValue); if (!CanModify) { cFieldValue.ReadOnly = true; cFieldValue.Style.BackColor = System.Drawing.SystemColors.Control; } if (userEdited) { cFieldValue.Style.ForeColor = System.Drawing.SystemColors.HotTrack; } cFieldValue.Style.Alignment = TextAlign; // Add the rows to the DataGridView dataGridView1.Rows.Add(dataGridDetailRow); } } } [/code] When there is a user edit, the id is > 0, therefore it gets to the condition "if (id < 0)" and then exits the method. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
My TVSeries
User edited fields not working as expected
Contact us
RSS
Top
Bottom