[Roam-commit] SF.net SVN: roam: [98] Trunk/Source
Status: Alpha
Brought to you by:
jonfroehlich
|
From: <jon...@us...> - 2007-10-13 06:57:03
|
Revision: 98
http://roam.svn.sourceforge.net/roam/?rev=98&view=rev
Author: jonfroehlich
Date: 2007-10-12 23:57:01 -0700 (Fri, 12 Oct 2007)
Log Message:
-----------
updated SqlCeConnectionManager to note use the ThreadPool
Modified Paths:
--------------
Trunk/Source/Roam.SqlCe/SqlCeConnectionManager.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs
Trunk/Source/Roam.suo
Modified: Trunk/Source/Roam.SqlCe/SqlCeConnectionManager.cs
===================================================================
--- Trunk/Source/Roam.SqlCe/SqlCeConnectionManager.cs 2007-09-19 04:32:31 UTC (rev 97)
+++ Trunk/Source/Roam.SqlCe/SqlCeConnectionManager.cs 2007-10-13 06:57:01 UTC (rev 98)
@@ -221,7 +221,7 @@
if (_connections.ContainsKey(threadCurrent))
{
_log.DebugFormat("Open : The current thread {0} has an assigned connection", threadCurrent.Name);
- return _connections[threadCurrent];
+ sqlConn = _connections[threadCurrent];
}
else if (_pooledConnections.Count > 0)
{
@@ -274,7 +274,10 @@
//check to see if we should actually close the connection
if (_pooledConnections.Count > _minPooledConnections)
{
- ThreadPool.QueueUserWorkItem(new WaitCallback(Close), sqlConn);
+ //Updated 10/10/2007. Do not rely on the thread pool to close the connection
+ //ThreadPool.QueueUserWorkItem(new WaitCallback(CloseCallback), sqlConn);
+ sqlConn.Close();
+ sqlConn.Dispose();
}
else
{
@@ -319,7 +322,7 @@
/// Called by thread.
/// </summary>
/// <param name="state"></param>
- private void Close(object state)
+ private void CloseCallback(object state)
{
SqlCeConnection sqlConn = (SqlCeConnection)state;
sqlConn.Close();
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-09-19 04:32:31 UTC (rev 97)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-10-13 06:57:01 UTC (rev 98)
@@ -698,7 +698,7 @@
<DependentUpon>SystemColorTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\TabControlTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\TabControlTest.Designer.cs">
<DependentUpon>TabControlTest.cs</DependentUpon>
Modified: Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs
===================================================================
--- Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs 2007-09-19 04:32:31 UTC (rev 97)
+++ Trunk/Source/Roam.UI/Controls/TextBoxFilteredList.cs 2007-10-13 06:57:01 UTC (rev 98)
@@ -50,6 +50,13 @@
private bool _showAddButton = true;
private bool _automaticallyUpdateNoMatchesMessage = true;
private bool _showConfirmationDialog = true;
+
+ /// <summary>
+ /// Having trouble preventing the add button from gaining focus
+ /// when UserControl first shown. This field is used to prevent the
+ /// problem
+ /// </summary>
+ private bool _allowAddButtonFocus = false;
#endregion Private Fields
/// <summary>
@@ -64,9 +71,12 @@
InitializeComponent();
_textBorder.BorderBehavior = BorderBehavior.AlwaysDrawBorder;
+ _textBorder.TabStop = true;
+ _textBorder.TabIndex = 1;
+
_textBox = (TextBox)_textBorder.Control;
- _textBox.TabStop = true;
- _textBox.TabIndex = 0;
+ //_textBox.TabStop = false;
+ //_textBox.TabIndex = 0;
_textBox.KeyUp += new KeyEventHandler(OnKeyUpTextBox);
_textBox.TextChanged += new EventHandler(OnTextChangedTextBox);
_textBox.KeyDown += new KeyEventHandler(OnKeyDownTextBox);
@@ -76,32 +86,31 @@
_addButton.Text = "Add";
_addButton.TabStop = true;
- _addButton.TabIndex = 1;
+ _addButton.TabIndex = 2;
_addButton.ButtonPressed += new EventHandler(OnAddButtonPressed);
+ //_addButton.GotFocus += new EventHandler(OnAddButtonGotFocus);
_filteredListBox.HandleNumberKeys = false;
_filteredListBox.TabStop = true;
- _filteredListBox.TabIndex = 2;
+ _filteredListBox.TabIndex = 3;
_filteredListBox.ItemClicked += new EventHandler<VisualItemEventArgs>(OnFilteredListBoxItemClicked);
_filteredListBox.KeyDown += new KeyEventHandler(OnKeyDownFilteredListBox);
_filteredListBox.KeyPress += new KeyPressEventHandler(OnKeyPressFilteredListBox);
_filteredListBox.GotFocus += new EventHandler(OnGotFocusFilteredListBox);
- this.Controls.Add(_textBorder);
this.Controls.Add(_filteredListBox);
this.Controls.Add(_addButton);
- _textBox.Focus();
+ this.Controls.Add(_textBorder);
+
+ _textBorder.TabIndex = 1;
+ _addButton.TabIndex = 2;
+ _filteredListBox.TabIndex = 3;
+
+ //_textBox.Focus();
+ //_textBorder.Focus();
UpdateNoMatchesFoundMessage();
}
- private void OnGotFocusFilteredListBox(object sender, EventArgs e)
- {
- if (FilteredListBox.Items.Count > 0 && FilteredListBox.SelectedIndex == -1)
- {
- FilteredListBox.SelectedIndex = 0;
- }
- }
-
#region Properties
/// <summary>
/// If true, prevents multiple items with the same label to be added through
@@ -208,14 +217,17 @@
public virtual void UpdateLayout()
{
- _addButton.Visible = _showAddButton;
+ if (_addButton.Visible != _showAddButton)
+ {
+ _addButton.Visible = _showAddButton;
+ }
//_textBox.Location = new Point(0, 0);
//_textBox.Width = this.Width;
_textBorder.Location = new Point(0, 0);
_textBorder.Width = this.Width;
- if (_addButton.Visible)
+ if (_showAddButton)
{
int spaceBetweenTextAndButton = 1;
@@ -239,12 +251,27 @@
#endregion Public Methods
#region Protected Methods
+
+ //protected virtual void OnAddButtonGotFocus(object sender, EventArgs e)
+ //{
+ // if (!_allowAddButtonFocus)
+ // {
+ // _textBox.Focus();
+ // }
+ //}
+
protected override void OnResize(EventArgs e)
{
UpdateLayout();
base.OnResize(e);
}
+ protected override void OnGotFocus(EventArgs e)
+ {
+ base.OnGotFocus(e);
+ _textBox.Focus();
+ }
+
protected virtual void OnFilteredListBoxItemClicked(object sender, VisualItemEventArgs e)
{
_textBox.Text = _filteredListBox.SelectedItem.ToString();
@@ -385,6 +412,8 @@
protected virtual void OnKeyDownTextBox(object sender, KeyEventArgs e)
{
+ //_allowAddButtonFocus = true;
+
//jeffixme : on the imate kjam, the TabStop & TabIndex does not seem to be working for the
//up/down key press. Thus, we will have to handle this in a custom manner (by checking
//here for an e.KeyCode of Keys.Up and Keys.Down). I'm curious how other keyboard based
@@ -441,6 +470,17 @@
_filteredListBox.NoMatchesFoundMessage = message;
}
#endregion Protected Methods
+
+ #region Private Methods
+
+ private void OnGotFocusFilteredListBox(object sender, EventArgs e)
+ {
+ if (FilteredListBox.Items.Count > 0 && FilteredListBox.SelectedIndex == -1)
+ {
+ FilteredListBox.SelectedIndex = 0;
+ }
+ }
+ #endregion
}
}
Modified: Trunk/Source/Roam.suo
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|