Skip to content

Instantly share code, notes, and snippets.

Created September 27, 2012 04:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anonymous/3792112 to your computer and use it in GitHub Desktop.
Example
private void SectionViewerActualize()
{
FilesViewer.Items.Clear();
SectionViewer.Nodes.Clear();
if (!String.IsNullOrEmpty(actualArea))
SectionViewer.Nodes.AddRange(new SpravaGascripe().CreateNodesArray(actualArea));
}
private void CreateSection()
{
if (!String.IsNullOrEmpty(actualArea))
{
var cesta = (String.IsNullOrEmpty(actualPath) || SectionViewer.SelectedNode == null || MessageBox.Show("Chceš vytvořit podsekci (ano), či novou hlavní sekci (ne)?", "Ověření", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No) ?
actualArea : actualPath;
var doc = Interaction.InputBox("Zadej jméno nové sekce.", "Section Name Dialog", "NewSection");
if (!String.IsNullOrEmpty(doc))
{
new DirectoryInfo(NoExistName(String.IsNullOrEmpty(doc) ? cesta + @"\NewSection" : cesta + @"\" + doc)).Create();
SectionViewerActualize();
}
}
else
MessageBox.Show("Není vybrána žádná oblast!", "Kam s ní?");
}
private void EditSectionName()
{
if (SectionViewer.SelectedNode != null)
{
var doc = Interaction.InputBox("Zadej nové jméno sekce.", "Change Name Dialog", Path.GetFileName(actualPath));
var di = new DirectoryInfo(actualPath);
if (!String.IsNullOrEmpty(doc))
{
var act = di.Parent.FullName + @"\" + doc;
if (act != actualPath + @"\" + doc)
di.MoveTo(NoExistName(act));
}
SectionViewerActualize();
}
}
private void RemoveSection()
{
if (SectionViewer.SelectedNode != null)
{
if (MessageBox.Show("Opravdu chceš sekci '" + Path.GetFileName(actualPath) + "' smazat?", "Potvrzení smazání", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
new DirectoryInfo(actualPath).Delete(true);
actualPath = null;
FilesViewer.Items.Clear();
SectionViewerActualize();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment