aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/AddressBook.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-28 20:01:04 -0400
committerMichael <[email protected]>2017-04-28 20:01:04 -0400
commit712d38a2be53b415c2635b86e1f539faec0ace19 (patch)
treef600fea9f8f98a715216a98100f047846b693faa /ShiftOS.WinForms/Applications/AddressBook.cs
parente1b3ecc57d42a961c780114e4e582a875e8f3b96 (diff)
downloadshiftos_thereturn-712d38a2be53b415c2635b86e1f539faec0ace19.tar.gz
shiftos_thereturn-712d38a2be53b415c2635b86e1f539faec0ace19.tar.bz2
shiftos_thereturn-712d38a2be53b415c2635b86e1f539faec0ace19.zip
Final Beta 2.3 adjustments.
Diffstat (limited to 'ShiftOS.WinForms/Applications/AddressBook.cs')
-rw-r--r--ShiftOS.WinForms/Applications/AddressBook.cs48
1 files changed, 48 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/AddressBook.cs b/ShiftOS.WinForms/Applications/AddressBook.cs
index 0347669..9a4ce51 100644
--- a/ShiftOS.WinForms/Applications/AddressBook.cs
+++ b/ShiftOS.WinForms/Applications/AddressBook.cs
@@ -27,12 +27,20 @@ namespace ShiftOS.WinForms.Applications
string data_dir = Paths.GetPath("data") + "/address_book";
public void OnLoad()
{
+ removeToolStripMenuItem.Visible = false;
if (!DirectoryExists(data_dir))
CreateDirectory(data_dir);
tvcontacts.Nodes.RemoveByKey("userdefined");
var userDefined = new TreeNode();
userDefined.Name = "userdefined";
userDefined.Text = "User-defined";
+ tvcontacts.Click += (o, a) =>
+ {
+ if (tvcontacts.SelectedNode == userDefined)
+ {
+ removeToolStripMenuItem.Visible = false;
+ }
+ };
foreach(var f in GetFiles(data_dir))
{
try
@@ -42,6 +50,20 @@ namespace ShiftOS.WinForms.Applications
node.Text = contact.UserName + "@" + contact.SystemName;
node.Tag = contact;
userDefined.Nodes.Add(node);
+ tvcontacts.Click += (o, a) =>
+ {
+ if(tvcontacts.SelectedNode == node)
+ {
+ lbtitle.Text = contact.Name;
+ txtbody.Text = $@"Username: {contact.UserName}
+System Name: {contact.SystemName}
+
+Description:
+{contact.Description}";
+ removeToolStripMenuItem.Visible = true;
+ SelectedContact = contact;
+ }
+ };
}
catch { }
}
@@ -49,6 +71,8 @@ namespace ShiftOS.WinForms.Applications
userDefined.Expand();
}
+ public Contact SelectedContact = null;
+
public void OnSkinLoad()
{
}
@@ -110,6 +134,30 @@ namespace ShiftOS.WinForms.Applications
}
});
}
+
+ private void AddressBook_Load(object sender, EventArgs e)
+ {
+
+ }
+
+ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if(SelectedContact != null)
+ {
+ string file = data_dir + "/" + SelectedContact.Name;
+ if (FileExists(file))
+ {
+ Infobox.PromptYesNo("Remove contact", $"Are you sure you want to remove {SelectedContact.Name} from your Address Book?", (result) =>
+ {
+ if (result == true)
+ {
+ Delete(file);
+ OnLoad();
+ }
+ });
+ }
+ }
+ }
}
public class Contact