public SkypeBot(Main mainWindow, SBProperties sbproperties) { main = mainWindow; //will this work backwords. If I change an aspect of main, will mainwindow be changed? I don't see why it would... //but it does, so yay I guess. //TODO: Ask Andre why. skype = new Skype(); bool isrunning = false; do { if (skype.Client.IsRunning) { skype.Attach(8, false);//TODO: skype attach causes hanging on consecutive runs, no idea why isrunning = true; } } while (isrunning == false); skype.MessageStatus += new _ISkypeEvents_MessageStatusEventHandler(skype_MessageStatus); sbprop = sbproperties; nick = sbprop._Account; //loads default value. #region commands List<string> com = new List<string>(); com.Add("help"); //0 com.Add("google"); //1 com.Add("lmgtfy"); //2 com.Add("date"); //3 com.Add("time"); //4 com.Add("coin"); //5 com.Add("8ball"); //6 com.Add("prgm"); //7 com.Add("del"); //8 com.Add("src"); //9 com.Add("say"); //10 com.Add("quote"); //11 com.Add("wolfram"); //12 com.Add("alpha"); //13 com.Add("block"); //14 com.Add("unblock"); //15 com.Add("steam"); //16 com.Add("bot"); //17 com.Add("call"); //18 commands = com.ToArray(); #endregion instantiatePersonality("bot"); refreshBlacklist(); }
public Main() { InitializeComponent(); SBProperties.parent = this; sbprop = new SBProperties(); if (sbprop._Minimized == true) { this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; this.notifyIcon1.Visible = true; } AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.UnhandledException += new UnhandledExceptionEventHandler(unhandledEvent); //TODO: how does current domain work, does domain = class, or application...? System.Threading.Thread background = new System.Threading.Thread( new System.Threading.ParameterizedThreadStart(backgroundJob)) { IsBackground = true }; //restarts the program once every hour //seems to cause crashes, possibly due to size of timer? //commented out, using inefficient for loop thread //TODO: find a good way of getting this to work /*hourTimer = new System.Timers.Timer(4000000); hourTimer.Elapsed += new System.Timers.ElapsedEventHandler(restart); hourTimer.Interval = 3600000; hourTimer.Enabled = true;*/ //basically A into B which is in A. //Because it is /in/ A, not instantiating A, it doesn't cause recursive errors. //TODO: Talk to andre about this line. //TODO: create hierarchal tree plot of the program, this shit is getting complex for me. //TODO: consider optimal organization of Main, Skype, and Properties. //currently, A holds B and C, B uses A and C as arguments for the constructor for "proper" communication. SkypeBot sb = new SkypeBot(this, sbprop); }