|
Hi,
I was using IMultiValueConverter in my project in which I will be doing some business calculations. for this I will be using the following.
1. An DataTable
2. An XML and,
3. Some coloring logic.
I am trying to apply color for some cells in the DataGrid by performing an business calculation using the above mentioned together or any one of it. In all the cases am getting some lagging (slowness) in applying color to the deserved cell. but if I simply return color without performing an business calculation it works fine (So am sure that there is no mistake in applying or the way I integrated IMultiValueConverter) which means I was not calculating any business logics using the above mentioned things.
My Question was is there is any limitation in using IMultiValueConverter and IValueConverter in such a way that it was not overloaded with response time to the control to which it was bounded?
Note: please let me know if any one can't understand my question
_AKA_KSN_
|
|
|
|
|
_AKA_KSN_ wrote: In all the cases am getting some lagging (slowness) in applying color to the deserved cell. but if I simply return color without performing an business calculation it works fine (So am sure that there is no mistake in applying or the way I integrated IMultiValueConverter) It also proves that it's calculating the business logic that causes the slowdown.
_AKA_KSN_ wrote: My Question was is there is any limitation in using No, it's the business logic.
The UI-thread is responsible for drawing the UI, and it's a bad idea to put some BL in a presentation-layer.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
But we found a different cause for this problem, in my DataGrid we have enabled Virtualization and some common theme. when we disable those it works fine.
which mean the Ui takes long time to load the data and renders all the values in the UI. after that we don't need Convertors any more. so we planned to fix the bug in theme and have to do some enough study in enabling virtualization.
_AKA_KSN_
|
|
|
|
|
_AKA_KSN_ wrote: But we found a different cause for this problem, in my DataGrid we have enabled Virtualization Virtual Mode does not slow down the grid; on the contrary, it's used when databinding is too slow.
_AKA_KSN_ wrote: which mean the Ui takes long time The UI-thread is there to paint a UI, not to load data or do conversions.
_AKA_KSN_ wrote: have to do some enough study in enabling virtualization. There's a walkthrough here[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
It sounds to me like you are solving the wrong problem here. Rather than attempting to do business calculations in converters, you should create a ViewModel and perform your calculations in there. One of the overheads you have in a converter is that all elements are treated as objects, so you have unboxing to cope with.
|
|
|
|
|
hi, I use below code to create/consume and dispose sql connections.But as there are more than twenty methods/functions that I use it, same code block repeats. So, is it goog practice? Your valuable comments are welcomed.
private void islemKayitlariniYukle(string select)
{
using (SqlCeConnection sqlCEBaglantisi = new SqlCeConnection(Properties.Settings.Default.sqlBag))
using (SqlCeDataAdapter sqlAdaptor = new SqlCeDataAdapter(select, sqlCEBaglantisi))
using (DataTable dtTablo = new DataTable())
{
sqlCEBaglantisi.Open();
sqlAdaptor.Fill(dtTablo);
SqlCeCommand islemTipleriniAl = new SqlCeCommand("Select IslemTipi From IslemKaydi Group By IslemTipi", sqlCEBaglantisi);
using (SqlCeDataReader oku1 = islemTipleriniAl.ExecuteReader())
{
while (oku1.Read())
{ cmbIGIslemTipiSec.Items.Add(oku1.GetString(0).Trim()); }
}
|
|
|
|
|
teknolog123 wrote: same code block repeats. You could wrap some things in their own method
teknolog123 wrote: So, is it goog practice? Not if you're religious about the DRY-principle. In that case, there'd be a factory to return an IDbConnection , and the query-string would be passed to a method containing the database-connection logic.
Still, with or without the repeating code; I could work with it. If you'd use English names for your variables, I might even be able to understand it's intention
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
thanks let me explain more. I just want to dispose sqceConnection, sqlceCommand, SqlCeCommandBuilder and sqlceAdapter as soon as I finish processing the data. for example does the below code dispose the objects in that manner? I think no but wanna make sure. (note: I didn't use sqladapter and commnadbuilder below to keep the code short on purpose)
public SqlCeConnection sqlSetCon()
{
SqlCeConnection sqlCon = new SqlCeConnection();
sqlCon.ConnectionString = Properties.Settings.Default.sqlConnStr;
sqlCon.Open();
return sqlCon;
}
public DataTable returnDataTable(string selectString)
{
SqlCeDataAdapter sqlAdaptor = new SqlCeDataAdapter(selectString, sqlSetCon());
SqlCeCommandBuilder sqlKomut = new SqlCeCommandBuilder(sqlAdaptor);
DataTable dtTablo = new DataTable();
sqlAdaptor.Fill(dtTablo);
return dtTablo;
}
private void processList()
{
using (DataTable dt = returnDataTable("Select * From Customers Order By Surname"))
{
for (int i = 0; i < dt.Rows.Count; i++)
{
this.lblSurname.Text = dt.Rows[i]["surname"].ToString();
}
}
}
modified 2-Feb-14 6:38am.
|
|
|
|
|
Something similar to below; wrap the disposable's in a using-section, and they'll be disposed when they go out of scope.
public DataTable returnDataTable(string selectString)
{
using (var con = sqlSetCon())
using (SqlCeDataAdapter sqlAdaptor = new SqlCeDataAdapter(selectString, con))
{
DataTable dtTablo = new DataTable();
sqlAdaptor.Fill(dtTablo);
return dtTablo;
}
}
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
thanks Eddy, by the way, is it only those that are written in parentheses disposed or anything in curly braces?
|
|
|
|
|
teknolog123 wrote:
thanks Eddy, by the way, is it only those that
are written in parentheses disposed or anything in curly braces?
Anything that's disposable would be best in a using -clause. You can try it by putting it in a using, if it's not disposable you'll get a compiler-error saying so. Alternatively, you can check MSDN.
If you can't limit it to a scope, then you'd best dispose it from code later.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
how to use Switch Startup Project extension in visual studio 2012
|
|
|
|
|
You mean other than download it[^], install it, and follow the instructions on the page you got it from?
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Actually ive downloaded from that site only , but i.e for VS2010,
do u have any idea that is there any extension for VS2012
|
|
|
|
|
The site doesn't list any different download, but does list 2012 and 0213 in the compatibility list.
So have you enabled it? Displayed the toolbar / toolbar item?
If so, then you probably need to talk to the author: there is a Q&A tab on the page.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
What problem are you having installing, or using, it ? [^].
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
problem in using ,
i installed but i.e is not appearing on Visual Studio
NOTE:I am using Visual studio 2012,
i didnt find any where that Extension for 2012
|
|
|
|
|
Hi Dear Friends;
Want to ask a question about SqlDependency.
C # sql operation with SqlDependency in my side I want to see.
Example:
I got 2 MSSQL database,
are the first data in my database.
When you take action in the first database, Current Data I want to add my second database.
SqlDependency with the insert, update, delete, how do you find out the line?
I use the sample code I'm writing.
When you take action on this sql code can trigger windows form.
I'm asking transactions which took place in line?
I'm sorry for bad english.
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Data.SqlClient;
#endregion
namespace NotifySample
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection con;
SqlCommand cmd;
SqlDependency dep;
SqlDataAdapter da;
DataTable dt;
private void btnVeriCek_Click(object sender, EventArgs e)
{
con = new SqlConnection("data source=localhost;initial catalog=Dukkan;integrated security=SSPI");
con.Open();
cmd = new SqlCommand("Select DetayID,PersonelID,Ad,Soyad,Mail From dbo.PersonelDetay", con);
dep = new SqlDependency(cmd);
SqlDependency.Start("data source=localhost;initial catalog=Dukkan;integrated security=SSPI");
dep.OnChange+=new OnChangeEventHandler(dep_OnChange);
da = new SqlDataAdapter(cmd);
dt = new DataTable();
da.Fill(dt);
dgVeriler.DataSource = dt;
}
void dep_OnChange(object sender, SqlNotificationEventArgs e)
{
MessageBox.Show("THIS AREA SQL INSERT, UPDATE, DELETED WANT TO SEE DATA");
}
}
}
|
|
|
|
|
byerkan wrote: When you take action in the first database, Current Data I want to add my second database. Sounds like replication/synchronization to me.
byerkan wrote: SqlDependency with the insert, update, delete, how do you find out the line? You can't.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
save dynamically created chart in Extjs to perticular location , and after that getting image to specified loaction for exporting pdf document
Raju88
|
|
|
|
|
Is that a question or a statement? And given that Extjs is a Javascript product, what has this to do with C#?
Veni, vidi, abiit domum
|
|
|
|
|
Tic Tac Toe
code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Tic Tac Toe
{
public partial class Form1 : Form
{
private GameManager game_manager = new GameManager();
public Form1()
{
InitializeComponent();
}
private void Clicked(object sender, EventArgs e)
{
Button button = (Button)sender;
switch (button.Name)
{
case "button1":
game_manager.ButtonClicked(0, button, label1);
break;
case "button2":
game_manager.ButtonClicked(1, button, label1);
break;
case "button3":
game_manager.ButtonClicked(2, button, label1);
break;
case "button4":
game_manager.ButtonClicked(3, button, label1);
break;
case "button5":
game_manager.ButtonClicked(4, button, label1);
break;
case "button6":
game_manager.ButtonClicked(5, button, label1);
break;
case "button7":
game_manager.ButtonClicked(6, button, label1);
break;
case "button8":
game_manager.ButtonClicked(7, button, label1);
break;
case "button9":
game_manager.ButtonClicked(8, button, label1);
break;
}
}
private void label1_Click(object sender, EventArgs e)
{
label1.Text = "";
label2.Text = "";
}
private void resetButton_Click(object sender, EventArgs e)
{
button1.Text = "";
button2.Text = "";
button3.Text = "";
button4.Text = "";
button5.Text = "";
button6.Text = "";
button7.Text = "";
button8.Text = "";
button9.Text = "";
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
|
|
|
|
|
Write a better game manager that maintains state better that you are now??
|
|
|
|
|
just check in the switch statement that if the control already has some value then do nothing.
|
|
|
|
|
I didn't downvote, but just have to ask - you don't really want to encourage adding an if to each case. Not if there's an option to use GOTO .
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|