Exemple #1
0
        public IrcView( Settings settings )
        {
            Settings = settings;
            Settings.Inject(this);

            Views = new Dictionary<IrcChannelID,Channel>();

            irc = new Irc(settings);
            irc.Listeners.Add(this);

            cursorblink = new Timer() { Interval = 500 };
            cursorblink.Tick += (o,args) => { cursor = !cursor; if ( CurrentView != null ) Invalidate( CurrentView.Input.Bounds ); };
            cursorblink.Start();

            InitializeComponent();
            InitializeShortcutsAndCommands();
            InitializeStyle();

            foreach ( var server in settings.Servers ) {
                var connection = irc.Connect(server.Uri);

                foreach ( var channel in server.Channels ) {
                    connection.Join( channel.Name );
                    if ( channel.Shortcut == Keys.None ) continue;
                    string cname = channel.Name;
                    Shortcuts.Add( channel.Shortcut, () => CurrentView = ViewOf(connection,null,cname) );
                }
            }
        }
Exemple #2
0
        static void Main()
        {
            var SettingsPath = Path.Combine( Application.UserAppDataPath, "settings.xml" );
            if (!File.Exists(SettingsPath))
            using ( var writer = File.Create(SettingsPath,Resources.DefaultSettings.Length,FileOptions.SequentialScan) )
            {
                var b = Resources.DefaultSettings;
                writer.Write(b,0,b.Length);
            }
            #if DEBUG
            Process.Start( Application.UserAppDataPath );
            var DebugSettingsPath = Path.Combine( Application.UserAppDataPath, "debug-settings.xml" );
            if ( File.Exists(DebugSettingsPath) ) SettingsPath = DebugSettingsPath;
            #endif
            Settings settings = new Settings(SettingsPath);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            using ( var view = new IrcView(settings) ) Application.Run(view);
        }
Exemple #3
0
 private void Inject( Settings settings )
 {
     foreach ( var provider in Providers ) provider.Settings = settings;
 }