Sat Nov 08, 2008 1:30 am
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Collections.Specialized;
namespace smiley_sender
{
public partial class Form1 : Form
{
About.AboutBox box = new About.AboutBox("Skype smiley sender");
string[] sm ={ ":)", ":(", ":D", "8)", ":O", ";)", ";
(", "(sweat)", ":|", ":*", ":P", "(blush)", ":^)", "|-)", "|-(", "(inlove)", "]:)", "(talk)", "(yawn)", "(puke)",
"(doh)", ":@", "(wasntme)", "(party)",
":s", "(mm)", "8-|", ":x", "(hi)", "(call)",
"(devil)", "(angel)", "(envy)", "(wait)", "(hug)",
"(makeup)", "(chuckle)", "(clap)", "(think)",
"(bow)","(rofl)","(whew)","(happy)","(smirk)",
"(nod)","(shake)","(punch)","(emo)","(y)", "(n)", "(handshake)",
"(skype)", "(h)", "(u)", "(e)", "(F)", "(rain)", "(sun)", "(o)",
"(music)", "(~)", "(mp)", "(coffee)", "(pi)", "(cash)", "(flex)",
"(^)", "(beer)", "(d)", "(dance)", "(ninja)", "(*)",
"(mooning)", "(finger)", "(bandit)", "(drunk)", "(smoke)",
"(toivo)", "(rock)", "(headbang)","(poolparty)","(swear)","(bug)","(fubar)","(tmi)" };
public Form1()
{
InitializeComponent();
this.comboBox1.SelectedIndex = 0;
box.programname = "Skype smiley sender";
box.Paint += new PaintEventHandler(box_Paint);
}
void box_Paint(object sender, PaintEventArgs e)
{
System.Drawing.Drawing2D.LinearGradientBrush br = new System.Drawing.Drawing2D.LinearGradientBrush
(e.ClipRectangle, Color.FromArgb(135, 206, 235), Color.FromArgb(0, 191, 255),
System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal);
e.Graphics.FillRectangle(br, e.ClipRectangle);
br.Dispose();
}
private void axSkypeContactList1_CustomEvent(object sender, AxSKYPECONTACTSLib._DSkypeContactListEvents_CustomEventEvent e)
{
send();
}
private void comboBox1_SelectedValueChanged(object sender, EventArgs e)
{
System.Resources.ResourceManager rm = new
System.Resources.ResourceManager("smiley_sender.Properties.Resources",
System.Reflection.Assembly.GetExecutingAssembly());
pictureBox1.Image = (Bitmap)rm.GetObject("_"+
(this.comboBox1.SelectedIndex+100).ToString(),System.Globalization.CultureInfo.CurrentCulture);
}
private void button1_Click(object sender, EventArgs e)
{
send();
}
private string duplicate(string smileycode, int smileynumber)
{
StringCollection codes = new StringCollection();
StringBuilder duplicatedcode = new StringBuilder(smileycode.Length * smileynumber,smileycode.Length*smileynumber+1);
StringBuilder smiley = new StringBuilder(smileycode);
while (smileynumber > 0)
{
if (smileynumber % 2 == 1)
{
codes.Add(smiley.ToString());
}
smileynumber = smileynumber / 2;
smiley.Append(smiley);
}
for (int i = 0; i < codes.Count; i++)
{
duplicatedcode.Append(codes[i]);
}
return duplicatedcode.ToString();
}
private void send()
{
string kl = duplicate(sm[this.comboBox1.SelectedIndex], int.Parse(this.textBox1.Text));
SKYPE4COMLib.Chat ch = axSkypeContactList1.OpenChat(kl);
this.button1.Enabled = false;
Thread.Sleep(1000);
this.button1.Enabled = true;
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != e.Handled = true;
}
private void axSkypeContactList1_SelectionChange(object sender, AxSKYPECONTACTSLib._DSkypeContactListEvents_SelectionChangeEvent e)
{
if (e.users.Count == 0) this.button1.Enabled = false;
else this.button1.Enabled = this.textBox1.Text != "";
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (this.textBox1.Text == "") this.button1.Enabled = false;
else this.button1.Enabled = this.axSkypeContactList1.Selection.Count != 0;
}
private void Form1_Resize(object sender, EventArgs e)
{
if (this.WindowState==FormWindowState.Minimized)
{
this.Hide();
}
}
private void notifyIcon1_Click(object sender, EventArgs e)
{
if (this.WindowState==FormWindowState.Minimized)
{
this.Show();
this.WindowState = FormWindowState.Normal;
this.Focus();
return;
}
if (this.WindowState==FormWindowState.Normal)
{
this.WindowState = FormWindowState.Minimized;
}
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
box.ShowDialog();
}
}
}
Mon Jan 21, 2013 12:52 am
|
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.