Login | Register
My pages Projects Community openCollabNet

Discussions > commits > svn commit: r268 - trunk/SVN_Notifier

svnnotifier
Discussion topic

Back to topic list

svn commit: r268 - trunk/SVN_Notifier

Reply

Author aleksejs
Full name Aleksejs V.
Date 2009-03-03 06:05:25 PST
Message Author: aleksejs
Date: 2009-03-03 06:05:24-0800
New Revision: 268

Added:
   trunk/SVN_Notifier/M​ainForm.Tools.cs
Modified:
   trunk/SVN_Notifier/MainForm.cs
   trunk/SVN_Notifier/S​VN_Notifier.csproj

Log:
Exclude some function from MainForm.cs to MainForm.Tools.cs

Added: trunk/SVN_Notifier/M​ainForm.Tools.cs
Url: http://svnnotifier.t​igris.org/source/bro​wse/svnnotifier/trun​k/SVN_Notifier/MainF​orm.Tools.cs?view=ma​rkup&pathrev​&8
====================​====================​====================​=================---​ (empty file)
+++ trunk/SVN_Notifier/M​ainForm.Tools.cs 2009-03-03 06:05:24-0800
@@ -0,0 +1,194 @@
+using System.Diagnostics;
+using System.Drawing;
+using System.IO;
+using System.Windows.Forms;
+
+namespace CHD.SVN_Notifier
+{
+ partial class MainForm
+ {
+ private readonly Icon trayIcon_NeedUpdate = Properties.Resources​.TrayIcon_NeedUpdate​;
+ private readonly Icon trayIcon_UpToDate = Properties.Resources​.TrayIcon_UpToDate;
+ private readonly Icon trayIcon_Unknown = Properties.Resources​.TrayIcon_Unknown;
+ private readonly Icon trayIcon_Error = Properties.Resources​.TrayIcon_Error;
+
+ private SvnFolderCollection folders = new SvnFolderCollection ();
+
+
+ private int GetFoldersCommonPartLength ()
+ {
+ if (folders.Count < 2) return 0;
+
+ string path0 = folders[0].Path;
+
+ int len = 0;
+ for (int i = 0; i < path0.Length; i++)
+ for (int f = 1; f < folders.Count; f++)
+ {
+ string path = folders[f].Path;
+ if (i == path.Length - 1) return len;
+ if (path0[i] != path[i]) return len;
+ if (path0[i] == '\\') len = i + 1;
+ }
+ return len;
+ }
+
+
+ private void UpdateListViewFolderNames ()
+ {
+ int i = GetFoldersCommonPartLength ();
+
+ for (int f = 0; f < folders.Count; f++)
+ {
+ folders[f].VisiblePath = (i > 0 ? "\u2026" : "") + folders[f].Path.Substring (i);
+ listViewFolders.Items[f].Tag = folders[f];
+ listViewFolders.Items[f].Text = folders[f].VisiblePath;
+ }
+ }
+
+ ////////////////////​////////////////////​////////////////////​//////////////////
+
+ private const int imageIndex_UpToDate = 0;
+ private const int imageIndex_NeedUpdate = 1;
+ private const int imageIndex_Bad = 2;
+ private const int imageIndex_Unknown = 3;
+ private const int imageIndex_UpToDate_Modified = 4;
+ private const int imageIndex_NeedUpdate_Modified = 5;
+
+ private static int GetFolderStatusImageIndex (SvnFolderStatus folderStatus)
+ {
+ switch (folderStatus)
+ {
+ case SvnFolderStatus.Need​Update_Modified:
+ return imageIndex_NeedUpdate_Modified;
+
+ case SvnFolderStatus.UpTo​Date_Modified:
+ return imageIndex_UpToDate_Modified;
+
+ case SvnFolderStatus.UpToDate:
+ return imageIndex_UpToDate;
+
+ case SvnFolderStatus.NeedUpdate:
+ return imageIndex_NeedUpdate;
+
+ case SvnFolderStatus.Error:
+ return imageIndex_Bad;
+
+ default:
+ return imageIndex_Unknown;
+ }
+ }
+
+ ////////////////////​////////////////////​////////////////////​//////////////////
+
+ private void UpdateFolder ()
+ {
+ if (listViewFolders.Sel​ectedIndices.Count == 0)
+ return;
+
+ int selectedIndex = listViewFolders.Sele​ctedIndices[0];
+ SvnFolder folder = folders[selectedIndex];
+
+ if (Config.ChangeLogBeforeUpdate && (folder.reviewedRevision < SvnTools.GetReposito​ryHeadRevision (folder)))
+ {
+ MessageBox.Show ("You need to see ChangeLog first!", "SVN Notifier", MessageBoxButtons.OK, MessageBoxIcon.Stop);
+ return;
+ }
+
+ btnUpdate.Enabled = updateToolStripMenuItem.Enabled = checkNowToolStripMen​uItem.Enabled = false;
+ folder.Status = SvnFolderStatus.Unknown;
+ listViewFolders.Item​s[selectedIndex].Ima​geIndex = imageIndex_Unknown;
+ newNonUpdatedFolders.Clear ();
+
+ statusStrip.Items[0].Text = "Updating '" + folder.Path + "'...";
+ UpdateTray (true);
+ Refresh (); // Show "Unknown" folder status during updating
+
+ updateNotInProgress.Reset ();
+ BeginUpdateFolderStatuses ();
+
+ SvnTools.Update (folder, false);
+
+ forcedFolders.Enqueue (folder);
+
+ updateNotInProgress.Set ();
+ }
+
+
+ private void CommitFolder ()
+ {
+ if (listViewFolders.Sel​ectedIndices.Count == 0)
+ return;
+
+ int selectedIndex = listViewFolders.Sele​ctedIndices[0];
+ SvnTools.Commit (folders[selectedIndex]);
+ }
+
+
+ private void UpdateAll ()
+ {
+ newNonUpdatedFolders.Clear ();
+ statusStrip.Items[0].Text = "Updating all...";
+ UpdateTray (true);
+
+ BeginUpdateFolderStatuses ();
+
+ btnUpdate.Enabled = updateToolStripMenuItem.Enabled = checkNowToolStripMen​uItem.Enabled = menuItem_UpdateAll.Enabled = false;
+
+ foreach (SvnFolder folder in folders)
+ if ((folder.Status == SvnFolderStatus.NeedUpdate) || (folder.Status == SvnFolderStatus.Need​Update_Modified))
+ {
+ folder.Status = SvnFolderStatus.Unknown;
+ listViewFolders.Item​s[folders.IndexOf (folder)].ImageIndex = imageIndex_Unknown;
+
+ if (Config.UpdateAllSilently)
+ SvnTools.BeginUpdateSilently (folder);
+ else
+ {
+ updateNotInProgress.Reset ();
+ SvnTools.Update (folder, true);
+ forcedFolders.Enqueue (folder);
+ updateNotInProgress.Set ();
+ }
+ }
+ UpdateTray (true);
+ }
+
+
+ private void OpenFolder ()
+ {
+ var selectedIndex = listViewFolders.Sele​ctedIndices[0];
+ var folder = folders[selectedIndex].Path;
+
+ if (File.Exists (folders[selectedIndex].Path))
+ folder = Path.GetDirectoryName (folder);
+
+ Process.Start (folder + @"\"); // Open folder or folder of the file
+ }
+
+
+ private void ShowChangeLog ()
+ {
+ int selectedIndex = listViewFolders.Sele​ctedIndices[0];
+ SvnTools.OpenChangeLogWindow (folders[selectedIndex], true);
+ }
+
+
+ private void ShowFullLog ()
+ {
+ int selectedIndex = listViewFolders.Sele​ctedIndices[0];
+ SvnTools.OpenLogWindow (folders[selectedIndex].Path);
+ }
+
+
+ private void SelectFolder (string path)
+ {
+ foreach (ListViewItem item in listViewFolders.Items)
+ if (item.Text == path)
+ {
+ item.Selected = true;
+ break;
+ }
+ }
+ }
+}
\ No newline at end of file

Modified: trunk/SVN_Notifier/MainForm.cs
Url: http://svnnotifier.t​igris.org/source/bro​wse/svnnotifier/trun​k/SVN_Notifier/MainF​orm.cs?view=diff​&pathrev&8&r​1&7&r2&8​
====================​====================​====================​=================---​ trunk/SVN_Notifier/MainForm.cs (original)
+++ trunk/SVN_Notifier/MainForm.cs 2009-03-03 06:05:24-0800
@@ -39,12 +39,6 @@
         [DllImport("psapi")]
         private static extern int EmptyWorkingSet(IntPtr handle);

- private readonly Icon trayIcon_NeedUpdate = Properties.Resources​.TrayIcon_NeedUpdate​;
- private readonly Icon trayIcon_UpToDate = Properties.Resources​.TrayIcon_UpToDate;
- private readonly Icon trayIcon_Unknown = Properties.Resources​.TrayIcon_Unknown;
- private readonly Icon trayIcon_Error = Properties.Resources​.TrayIcon_Error;
-
- private SvnFolderCollection folders = new SvnFolderCollection();
         private readonly Hashtable errorLog = new Hashtable();
         private bool reupdateStatus;
         private readonly ManualResetEvent updateNotInProgress = new ManualResetEvent (true);
@@ -111,73 +105,6 @@

         ////////////////////​////////////////////​////////////////////​//////////////////

- private int GetFoldersCommonPartLength()
- {
- if (folders.Count < 2) return 0;
-
- string path0 = folders[0].Path;
-
- int len = 0;
- for (int i = 0; i < path0.Length; i++)
- for (int f = 1; f < folders.Count; f++)
- {
- string path = folders[f].Path;
- if (i == path.Length - 1) return len;
- if (path0[i] != path[i]) return len;
- if (path0[i] == '\\') len = i + 1;
- }
- return len;
- }
-
-
- private void UpdateListViewFolderNames()
- {
- int i = GetFoldersCommonPartLength();
-
- for (int f = 0; f < folders.Count; f++)
- {
- folders[f].VisiblePath = (i > 0 ? "\u2026" : "") + folders[f].Path.Substring (i);
- listViewFolders.Items[f].Tag = folders[f];
- listViewFolders.Items[f].Text = folders[f].VisiblePath;
- }
- }
-
- ////////////////////​////////////////////​////////////////////​//////////////////
-
- private const int imageIndex_UpToDate = 0;
- private const int imageIndex_NeedUpdate = 1;
- private const int imageIndex_Bad = 2;
- private const int imageIndex_Unknown = 3;
- private const int imageIndex_UpToDate_Modified = 4;
- private const int imageIndex_NeedUpdate_Modified = 5;
-
- private static int GetFolderStatusImageIndex (SvnFolderStatus folderStatus)
- {
- switch (folderStatus)
- {
- case SvnFolderStatus.Need​Update_Modified:
- return imageIndex_NeedUpdate_Modified;
-
- case SvnFolderStatus.UpTo​Date_Modified:
- return imageIndex_UpToDate_Modified;
-
- case SvnFolderStatus.UpToDate:
- return imageIndex_UpToDate;
-
- case SvnFolderStatus.NeedUpdate:
- return imageIndex_NeedUpdate;
-
- case SvnFolderStatus.Error:
- return imageIndex_Bad;
-
- default:
- return imageIndex_Unknown;
- }
- }
-
-
- ////////////////////​////////////////////​////////////////////​//////////////////
-
         #region Main menu handlers


@@ -760,117 +687,6 @@

         ////////////////////​////////////////////​////////////////////​////////////////////​////

- private void UpdateFolder()
- {
- if (listViewFolders.Sel​ectedIndices.Count == 0)
- return;
-
- int selectedIndex = listViewFolders.Sele​ctedIndices[0];
- SvnFolder folder = folders[selectedIndex];
-
- if (Config.ChangeLogBeforeUpdate && (folder.reviewedRevision < SvnTools.GetReposito​ryHeadRevision (folder)))
- {
- MessageBox.Show ("You need to see ChangeLog first!", "SVN Notifier", MessageBoxButtons.OK, MessageBoxIcon.Stop);
- return;
- }
-
- btnUpdate.Enabled = updateToolStripMenuItem.Enabled = checkNowToolStripMen​uItem.Enabled = false;
- folder.Status = SvnFolderStatus.Unknown;
- listViewFolders.Item​s[selectedIndex].Ima​geIndex = imageIndex_Unknown;
- newNonUpdatedFolders.Clear();
-
- statusStrip.Items[0].Text = "Updating '" + folder.Path + "'...";
- UpdateTray (true);
- Refresh(); // Show "Unknown" folder status during updating
-
- updateNotInProgress.Reset();
- BeginUpdateFolderStatuses();
-
- SvnTools.Update (folder, false);
-
- forcedFolders.Enqueue (folder);
-
- updateNotInProgress.Set();
- }
-
-
- private void CommitFolder()
- {
- if (listViewFolders.Sel​ectedIndices.Count == 0)
- return;
-
- int selectedIndex = listViewFolders.Sele​ctedIndices[0];
- SvnTools.Commit (folders[selectedIndex]);
- }
-
-
- private void UpdateAll()
- {
- newNonUpdatedFolders.Clear();
- statusStrip.Items[0].Text = "Updating all...";
- UpdateTray (true);
-
- BeginUpdateFolderStatuses();
-
- btnUpdate.Enabled = updateToolStripMenuItem.Enabled = checkNowToolStripMen​uItem.Enabled = menuItem_UpdateAll.Enabled = false;
-
- foreach (SvnFolder folder in folders)
- if ((folder.Status == SvnFolderStatus.NeedUpdate) || (folder.Status == SvnFolderStatus.Need​Update_Modified))
- {
- folder.Status = SvnFolderStatus.Unknown;
- listViewFolders.Item​s[folders.IndexOf (folder)].ImageIndex = imageIndex_Unknown;
-
- if (Config.UpdateAllSilently)
- SvnTools.BeginUpdateSilently (folder);
- else
- {
- updateNotInProgress.Reset();
- SvnTools.Update (folder, true);
- forcedFolders.Enqueue (folder);
- updateNotInProgress.Set();
- }
- }
- UpdateTray (true);
- }
-
-
- private void OpenFolder()
- {
- var selectedIndex = listViewFolders.Sele​ctedIndices[0];
- var folder = folders[selectedIndex].Path;
-
- if (File.Exists (folders[selectedIndex].Path))
- folder = Path.GetDirectoryName (folder);
-
- Process.Start (folder + @"\"); // Open folder or folder of the file
- }
-
-
- private void ShowChangeLog()
- {
- int selectedIndex = listViewFolders.Sele​ctedIndices[0];
- SvnTools.OpenChangeLogWindow (folders[selectedIndex], true);
- }
-
-
- private void ShowFullLog()
- {
- int selectedIndex = listViewFolders.Sele​ctedIndices[0];
- SvnTools.OpenLogWindow (folders[selectedIndex].Path);
- }
-
-
- private void SelectFolder (string path)
- {
- foreach (ListViewItem item in listViewFolders.Items)
- if (item.Text == path)
- {
- item.Selected = true;
- break;
- }
- }
-
-
         private void ShowFolderList()
         {
             Show();
@@ -879,7 +695,6 @@
             Activate();
         }

-
         ////////////////////​////////////////////​////////////////////​////////////////////​////

         private readonly SvnFolderCollection newNonUpdatedFolders = new SvnFolderCollection();

Modified: trunk/SVN_Notifier/S​VN_Notifier.csproj
Url: http://svnnotifier.t​igris.org/source/bro​wse/svnnotifier/trun​k/SVN_Notifier/SVN_N​otifier.csproj?view=​diff&pathrev​&8&r1&7&​r2&8
====================​====================​====================​=================---​ trunk/SVN_Notifier/S​VN_Notifier.csproj (original)
+++ trunk/SVN_Notifier/S​VN_Notifier.csproj 2009-03-03 06:05:24-0800
@@ -118,6 +118,9 @@
     <Compile Include="MainForm.De​signer.cs">
       <DependentUpon​>MainForm.cs</Dep​endentUpon>
     </Compile>
+ <Compile Include="MainForm.Tools.cs">
+ <DependentUpon​>MainForm.cs</Dep​endentUpon>
+ </Compile>
     <Compile Include="Properties​Resources.Designer.​cs">
       <AutoGen>True​</AutoGen>
       <DesignTime>Tr​ue</DesignTime​>
@@ -206,4 +209,4 @@
     <PostBuildEvent>
     </PostBuildEvent>
   </PropertyGroup>
-</Project>
\ No newline at end of file
+</Project>

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

svn commit: r268 - trunk/SVN_Notifier aleksejs Aleksejs V. 2009-03-03 06:05:25 PST
Messages per page: