private void loadConfig() { int i; rootKey = Microsoft.Win32.Registry.CurrentUser; softwareKey = rootKey.CreateSubKey(@"SOFTWARE\Mono.mLedMatrix\lines"); i = 0; foreach (string key in softwareKey.GetSubKeyNames()) { string name, code, rss; bool active, loop; int num, time; RegistryKey tempkey; tempkey = rootKey.CreateSubKey(@"SOFTWARE\Mono.mLedMatrix\lines\" + key); num = (int)tempkey.GetValue("num", 0); time = (int)tempkey.GetValue("time", 0); loop = (string)tempkey.GetValue("loop", "True") == "True"; name = (string)tempkey.GetValue("name", ""); code = (string)tempkey.GetValue("code", ""); rss = (string)tempkey.GetValue("rss", ""); active = (string)tempkey.GetValue("active", "True") == "True"; user_lines.Add(new userLine(name, active, code, rss, num, loop, time)); Console.WriteLine(key); i++; } if (i == 0) { user_lines.Add(new userLine("Spiegel.de", false, "%c%r%8%h:%m:%s%n%g%-%R" , "http://www.spiegel.de/index.rss", user_lines.Count + 1, true, 10)); user_lines.Add(new userLine("kicker.de", false, "%c%r%8%h:%m:%s%n%g%-%R" , "http://rss.kicker.de/live/bundesliga", user_lines.Count + 1, true, 10)); user_lines.Add(new userLine("Uhrzeit", true, "%2%+%+%c%r%h:%m:%s" , "", user_lines.Count + 1, true, 10)); user_lines.Add(new userLine("Wetter", false, "%c%r%8%h:%m:%s%n%g%-%R" , "http://wetter.bjoern-b.de/daten.xml", user_lines.Count + 1, true, 10)); user_lines.Add(new userLine("Weihnachten", false, "%+%+%g%2%T%1%c%+%-%-%-%-%rFrohe%2 %g%+%+%+%T%n%r%1%c%-%-%-%-Weihnachten" , "", user_lines.Count + 1, false, 10)); } user_lines.Sort(); softwareKey = rootKey.CreateSubKey(@"SOFTWARE\Mono.mLedMatrix"); led_matrix_address = (string)softwareKey.GetValue("ip_address", "192.168.0.222"); led_matrix.setAddress(led_matrix_address); winamp.winamp_address = (string)softwareKey.GetValue("winamp_address", "localhost"); winamp.winamp_port = (int)softwareKey.GetValue("winamp_port", 4800); winamp.winamp_pass = (string)softwareKey.GetValue("winamp_pass", "pass"); entry_winamp_address.Text = winamp.winamp_address; entry_winamp_port.Text = winamp.winamp_port.ToString(); entry_winamp_pass.Text = winamp.winamp_pass; entry_address.Text = led_matrix_address; led_matrix.scroll_speed = (int)softwareKey.GetValue("scroll_speed", 10); hscale_shift_speed.Value = led_matrix.scroll_speed; //entry_static_text.Text = (string)softwareKey.GetValue("static_text") }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build(); entry_address.ModifyBase(StateType.Normal, new Gdk.Color(255, 0, 0)); led_matrix = new LedMatrix("0.0.0.0"); led_matrix_thread = new Thread(led_matrix.Runner); winamp = new Winamp_httpQ(); rss = new RssPlugin(); no_tray_icon = false; IPEndPoint mpc_endpoint; led_matrix.rss = rss; mpc_plugin = new Mpc(); mpd_timer = new System.Timers.Timer(); mpd_timer.Elapsed += new ElapsedEventHandler(mpd_timer_elapsed); mpd_timer.Interval = 1000; //1s mpd_timer.Start(); try { tray_icon = new StatusIcon(new Gdk.Pixbuf("icon.png")); } catch (Exception) { no_tray_icon = true; } if (no_tray_icon == false) { tray_icon.Visible = true; tray_icon.Tooltip = "LedMatrix Control"; tray_icon.Activate += delegate { this.Visible = !this.Visible; }; } loadConfig(); led_matrix.connection_status_changed_handler += led_matrix_connection_changed; led_matrix_thread.Start(); winamp.title_changed_handler += led_matrix.setWinampPlaylisttitle; winamp.connection_changed_handler += winamp_connection_changed; try { //mpc_endpoint = new IPEndPoint(Dns.GetHostAddresses("dockstar-bo-hdd")[0], 6600); mpc_endpoint = new IPEndPoint(Dns.GetHostAddresses(entry_mpd.Text)[0], 6600); mpc_con = new MpcConnection(mpc_endpoint); mpc_plugin.Connection = mpc_con; mpc_plugin.Connection.AutoConnect = true; } catch (Exception) { } user_lines_table = new userLinesTable(ref treeview2, ref led_matrix); }
public MainWindow() : base(Gtk.WindowType.Toplevel) { Build (); entry_address.ModifyBase(StateType.Normal, new Gdk.Color(255,0,0)); led_matrix = new LedMatrix("0.0.0.0"); led_matrix_thread = new Thread(led_matrix.Runner); winamp = new Winamp_httpQ(); rss = new RssPlugin(); no_tray_icon = false; IPEndPoint mpc_endpoint; led_matrix.rss = rss; mpc_plugin = new Mpc(); mpd_timer = new System.Timers.Timer(); mpd_timer.Elapsed += new ElapsedEventHandler(mpd_timer_elapsed); mpd_timer.Interval = 1000; //1s mpd_timer.Start(); try { tray_icon = new StatusIcon(new Gdk.Pixbuf("icon.png")); } catch(Exception) { no_tray_icon = true; } if(no_tray_icon == false) { tray_icon.Visible = true; tray_icon.Tooltip = "LedMatrix Control"; tray_icon.Activate += delegate { this.Visible = !this.Visible; }; } loadConfig(); led_matrix.connection_status_changed_handler += led_matrix_connection_changed; led_matrix_thread.Start(); winamp.title_changed_handler += led_matrix.setWinampPlaylisttitle; winamp.connection_changed_handler += winamp_connection_changed; try { //mpc_endpoint = new IPEndPoint(Dns.GetHostAddresses("dockstar-bo-hdd")[0], 6600); mpc_endpoint = new IPEndPoint(Dns.GetHostAddresses(entry_mpd.Text)[0], 6600); mpc_con = new MpcConnection(mpc_endpoint); mpc_plugin.Connection = mpc_con; mpc_plugin.Connection.AutoConnect = true; } catch(Exception) { } user_lines_table = new userLinesTable(ref treeview2, ref led_matrix); }
private void loadConfig() { int i; rootKey = Microsoft.Win32.Registry.CurrentUser; softwareKey = rootKey.CreateSubKey (@"SOFTWARE\Mono.mLedMatrix\lines"); i=0; foreach(string key in softwareKey.GetSubKeyNames()) { string name,code,rss; bool active,loop; int num, time; RegistryKey tempkey; tempkey = rootKey.CreateSubKey (@"SOFTWARE\Mono.mLedMatrix\lines\"+key); num = (int)tempkey.GetValue("num",0); time = (int)tempkey.GetValue("time",0); loop = (string)tempkey.GetValue("loop","True") == "True"; name = (string)tempkey.GetValue("name",""); code = (string)tempkey.GetValue("code",""); rss = (string)tempkey.GetValue("rss",""); active = (string)tempkey.GetValue("active","True") == "True"; user_lines.Add(new userLine(name,active,code,rss,num,loop,time)); Console.WriteLine(key); i++; } if(i==0) { user_lines.Add(new userLine("Spiegel.de",false,"%c%r%8%h:%m:%s%n%g%-%R" ,"http://www.spiegel.de/index.rss",user_lines.Count+1,true,10)); user_lines.Add(new userLine("kicker.de",false,"%c%r%8%h:%m:%s%n%g%-%R" ,"http://rss.kicker.de/live/bundesliga",user_lines.Count+1,true,10)); user_lines.Add(new userLine("Uhrzeit",true,"%2%+%+%c%r%h:%m:%s" ,"",user_lines.Count+1,true,10)); user_lines.Add(new userLine("Wetter",false,"%c%r%8%h:%m:%s%n%g%-%R" ,"http://wetter.bjoern-b.de/daten.xml",user_lines.Count+1,true,10)); user_lines.Add(new userLine("Weihnachten",false,"%+%+%g%2%T%1%c%+%-%-%-%-%rFrohe%2 %g%+%+%+%T%n%r%1%c%-%-%-%-Weihnachten" ,"",user_lines.Count+1,false,10)); } user_lines.Sort(); softwareKey = rootKey.CreateSubKey (@"SOFTWARE\Mono.mLedMatrix"); led_matrix_address = (string)softwareKey.GetValue("ip_address","192.168.0.222"); led_matrix.setAddress(led_matrix_address); winamp.winamp_address = (string)softwareKey.GetValue("winamp_address","localhost"); winamp.winamp_port = (int)softwareKey.GetValue("winamp_port",4800); winamp.winamp_pass = (string)softwareKey.GetValue("winamp_pass","pass"); entry_winamp_address.Text = winamp.winamp_address; entry_winamp_port.Text = winamp.winamp_port.ToString(); entry_winamp_pass.Text = winamp.winamp_pass; entry_address.Text = led_matrix_address; led_matrix.scroll_speed = (int)softwareKey.GetValue("scroll_speed",10); hscale_shift_speed.Value = led_matrix.scroll_speed; //entry_static_text.Text = (string)softwareKey.GetValue("static_text") }