Ejemplo n.º 1
0
		private void toolStripMenuItemImport_Click(object sender, EventArgs e)
		{
			using (var d = new FolderBrowserDialog())
			{
				d.SelectedPath = (string)Common.Instance.Parameters[Consts.s_importDir];
				if (d.ShowDialog() == DialogResult.OK)
				{
					var selectedItem = listBoxSessions.SelectedItem;

					Cursor.Current = Cursors.WaitCursor;
					try
					{
						var session = new Session(Path.GetFileName(d.SelectedPath));
                        if (session.Load(d.SelectedPath, (uint)Common.Instance.Parameters[Consts.s_importMinSize]))
						{
							listBoxSessions.SelectedItems.Clear();
							listBoxSessions.Items.Add(session);
							selectedItem = session;
						}

						foreach (string folder in Directory.GetDirectories(d.SelectedPath, "*", SearchOption.AllDirectories))
						{
							session = new Session(Path.GetFileName(folder));
                            if (session.Load(folder, (uint)Common.Instance.Parameters[Consts.s_importMinSize]))
							{
								listBoxSessions.SelectedItems.Clear();
								listBoxSessions.Items.Add(session);
								selectedItem = session;
							}
						}
					}
					finally
					{
						Cursor.Current = Cursors.Default;
					}

					if (selectedItem != null)
						listBoxSessions.SelectedItem = selectedItem;
				}
			}
		}
Ejemplo n.º 2
0
		private void toolStripMenuItemCut_Click(object sender, EventArgs e)
		{
			Cursor.Current = Cursors.WaitCursor;
			try
			{
				var name = string.Format("Cut {0:yyyy-MM-dd HH.mm.ss}", DateTime.Now);
				if (!NameQuery(ref name))
					return;

				var session = new Session(name);
				if (session.Load(selected, Session.Inheritance.Cut))
				{
					listBoxSessions.SelectedItems.Clear();
					listBoxSessions.Items.Add(session);
					listBoxSessions.SelectedItem = session;
				}
			}
			finally
			{
				Cursor.Current = Cursors.Default;
			}
		}