//Main initialisation block
        //----------Incomplete--------//
        public MainWindow()
        {
            InitializeComponent();
            LoadTrayIcon();
            this.Hide();

            Dispatcher.ShutdownStarted += UnloadTrayIcon;

            if (!System.IO.Directory.Exists(CONFIGDIR))
                System.IO.Directory.CreateDirectory(CONFIGDIR);
            Environment.CurrentDirectory = CONFIGDIR;

            if (!(File.Exists("DownloadDir") && File.Exists("Login") && File.Exists("CourseList")))
            {
                Setup = new SetupWindow();
                Setup.ShowDialog();
                if (Setup.Successful == false)
                {
                    this.Close();
                }
            }

            //Load configuration                                                                          //////////////////
            //Load notifications                                                                          /////////////////

            Logger = new Translator.LoggingClass();
            Logger.OnNotify += new Translator.LoggingClass.NotifyHandler(Update_Notifications);

            Schedule_Sync = new System.Threading.Timer(Sync_Callback, 0, 0, 3 * 60 * 60 * 1000);
        }
        //Handles tray icon and context menu clicks
        //----------Incomplete--------//
        private void Tray_Icon_Click(object sender, EventArgs e)
        {
            ProcessStartInfo procStartInfo = new ProcessStartInfo();
            Process procExecuting = new Process();

            switch (sender.ToString())
            {
                case "System.Windows.Forms.NotifyIcon":
                    if (this.IsVisible)
                        this.Hide();
                    else
                        this.Show();
                    break;
                case "Pause":
                    Schedule_Sync.Dispose();
                    _tray_pause.Text = "Resume";
                    break;
                case "Resume":
                    Schedule_Sync = new System.Threading.Timer(Sync_Callback, 0, 0, 3 * 60 * 60 * 1000);
                    _tray_pause.Text = "Pause";
                    break;
                case "Sync Now":
                    RunSync(-1);
                    break;
                case "Open Moodle Site":
                    Process.Start("http://moodle.iitb.ac.in/");
                    break;
                case "Open Moodle Folder":
                    MessageBox.Show("Clicked");
                    procStartInfo = new ProcessStartInfo();
                    procExecuting = new Process();

                    procStartInfo.UseShellExecute = true;
                    procStartInfo.WorkingDirectory = CONFIGDIR;
                    procStartInfo.WindowStyle = ProcessWindowStyle.Normal;
                    procStartInfo.FileName = "explorer.exe";
                    procStartInfo.Arguments = File.ReadAllText("DownloadDir");

                    procExecuting = Process.Start(procStartInfo);
                    break;
                case "Setup":
                    Setup = new SetupWindow();
                    Setup.ShowDialog();
                    Schedule_Sync.Change(0, 3 * 60 * 60 * 1000);
                    break;
                case "View Log":
                    procStartInfo = new ProcessStartInfo();
                    procExecuting = new Process();

                    procStartInfo.UseShellExecute = true;
                    procStartInfo.WorkingDirectory = CONFIGDIR;
                    procStartInfo.WindowStyle = ProcessWindowStyle.Normal;
                    procStartInfo.FileName = "notepad.exe";
                    procStartInfo.Arguments = "MoodleSyncCallback.log";

                    procExecuting = Process.Start(procStartInfo);
                    break;
                case "Help":
                    Process.Start(System.Web.HttpUtility.UrlPathEncode("file:///" + System.AppDomain.CurrentDomain.BaseDirectory + "docs\\index.html").Replace("\\","/"));
                    break;
                case "About":
                    AboutDialog About = new AboutDialog();
                    About.Show();
                    break;
                case "Exit":
                    _tray.Visible = false;
                    this.Close();
                    break;
                default:
                    if ((New_Material > 0) || (New_Posts > 0))
                    {
                        this.Show();
                        MessageBox.Show("Notifications");                                   /////////////////
                    }
                    break;
            }
        }