Skip to content

Commit

Permalink
version 1.1
Browse files Browse the repository at this point in the history
small enhancements
  • Loading branch information
bujocek committed Sep 10, 2014
1 parent 81d0497 commit f9336f5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
39 changes: 20 additions & 19 deletions LyncIMLocalHistory/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace LyncIMLocalHistory
class Program : System.Windows.Forms.Form
{
public string welcomeText =
@"LyncIMLocalHistory ver. 1.0
@"LyncIMLocalHistory ver. 1.1
===========================
Simple IM conversation tracker for people who want to keep the conversation
history and can not use lync for it directly (i.e. it may be disabled by corp).
Expand All @@ -31,6 +31,7 @@ Jonas Bujok
{

InitializeComponent();
this.Resize += Form_Resize;
this.textBox1.Text = welcomeText;
connectAndPrepare();
}
Expand All @@ -51,6 +52,7 @@ Jonas Bujok

static Program ProgramRef;
private NotifyIcon notifyIcon;
private System.ComponentModel.IContainer components;
private const int BALOON_POPUP_TIMEOUT = 3000;

static void Main(string[] args)
Expand All @@ -71,7 +73,7 @@ void consoleWriteLine(String text = "")
}
else
{
this.consoleBox.Text += text + System.Environment.NewLine;
this.consoleBox.AppendText(text + System.Environment.NewLine);
}
}

Expand Down Expand Up @@ -131,7 +133,7 @@ void ConversationManager_ConversationAdded(object sender, Microsoft.Lync.Model.C
ActiveConversations.Add(e.Conversation, newcontainer);
e.Conversation.ParticipantAdded += Conversation_ParticipantAdded;
e.Conversation.ParticipantRemoved += Conversation_ParticipantRemoved;
String s = String.Format("Conversation {0} started.", newcontainer.m_convId);
String s = String.Format("Conversation #{0} started.", newcontainer.m_convId);
consoleWriteLine(s);
if (WindowState == FormWindowState.Minimized)
{
Expand All @@ -144,18 +146,18 @@ void Conversation_ParticipantRemoved(object sender, Microsoft.Lync.Model.Convers
{
(args.Participant.Modalities[ModalityTypes.InstantMessage] as InstantMessageModality).InstantMessageReceived -= InstantMessageModality_InstantMessageReceived;
if (args.Participant.Contact == myself.Contact)
consoleWriteLine("You removed.");
consoleWriteLine("You were removed.");
else
consoleWriteLine("Participant removed: " + args.Participant.Contact.GetContactInformation(ContactInformationType.DisplayName));
consoleWriteLine("Participant was removed: " + args.Participant.Contact.GetContactInformation(ContactInformationType.DisplayName));
}

void Conversation_ParticipantAdded(object sender, Microsoft.Lync.Model.Conversation.ParticipantCollectionChangedEventArgs args)
{
(args.Participant.Modalities[ModalityTypes.InstantMessage] as InstantMessageModality).InstantMessageReceived += InstantMessageModality_InstantMessageReceived;
if (args.Participant.Contact == myself.Contact)
consoleWriteLine("You added.");
consoleWriteLine("You were added.");
else
consoleWriteLine("Participant added: " + args.Participant.Contact.GetContactInformation(ContactInformationType.DisplayName));
consoleWriteLine("Participant was added: " + args.Participant.Contact.GetContactInformation(ContactInformationType.DisplayName));
}

void InstantMessageModality_InstantMessageReceived(object sender, Microsoft.Lync.Model.Conversation.MessageSentEventArgs args)
Expand Down Expand Up @@ -199,11 +201,10 @@ void ConversationManager_ConversationRemoved(object sender, Microsoft.Lync.Model
{
ConversationContainer container = ActiveConversations[e.Conversation];
TimeSpan conversationLength = DateTime.Now.Subtract(container.ConversationCreated);
consoleWriteLine(String.Format("Conversation {0} lasted {1} seconds", container.m_convId, conversationLength));
consoleWriteLine(String.Format("Conversation #{0} ended. It lasted {1} seconds", container.m_convId, conversationLength.ToString(@"hh\:mm\:ss")));
ActiveConversations.Remove(e.Conversation);

String s = String.Format("Conversation {0} ended.", container.m_convId);
consoleWriteLine(s);
String s = String.Format("Conversation #{0} ended.", container.m_convId);
if (WindowState == FormWindowState.Minimized)
{
this.notifyIcon.BalloonTipText = s;
Expand All @@ -214,14 +215,16 @@ void ConversationManager_ConversationRemoved(object sender, Microsoft.Lync.Model

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Program));
this.textBox1 = new System.Windows.Forms.TextBox();
this.consoleBox = new System.Windows.Forms.TextBox();
this.notifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(12, 12);
this.textBox1.MinimumSize = new System.Drawing.Size(100, 50);
Expand All @@ -235,8 +238,8 @@ private void InitializeComponent()
//
// consoleBox
//
this.consoleBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.consoleBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.consoleBox.Location = new System.Drawing.Point(12, 220);
this.consoleBox.Multiline = true;
Expand All @@ -254,17 +257,15 @@ private void InitializeComponent()
this.Controls.Add(this.textBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "Program";

this.notifyIcon = new NotifyIcon();
this.Text = "Lync IM Local History";
//
// notifyIcon
//
this.notifyIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info; //Shows the info icon so the user doesn't thing there is an error.
this.notifyIcon.BalloonTipText = "Lync history minimized";
this.notifyIcon.BalloonTipTitle = "Lync history";
this.notifyIcon.Icon = this.Icon; //The tray icon to use

this.notifyIcon.Text = "Lync history recorder";

this.Resize += Form_Resize;

this.notifyIcon.DoubleClick += notifyIcon_MouseDoubleClick;

this.ResumeLayout(false);
Expand Down
3 changes: 3 additions & 0 deletions LyncIMLocalHistory/Program.resx
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="notifyIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
4 changes: 2 additions & 2 deletions LyncIMLocalHistory/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

0 comments on commit f9336f5

Please sign in to comment.