public MainWindow(string tp, string dp, string ep, StatusIcon si) : base(Gtk.WindowType.Toplevel) { Build (); this.tp = tp; this.dp = dp; this.si = si; this.ep = ep; dhtpath = ep+ "/dht.data"; fastResumePath = ep+"/FastResume.Data"; EngineSettings es = new EngineSettings (); es.PreferEncryption = false; es.AllowedEncryption = EncryptionTypes.All; managers = new List<TorrentManager>(); engine = new MonoTorrent.Client.ClientEngine (es); engine.StatsUpdate += UpdateAll; nodeview2.NodeStore = new NodeStore (typeof(TorrentInfoRow)); nodeview2.AppendColumn ("Status", new Gtk.CellRendererText (), "text", 0); nodeview2.AppendColumn ("Progress", new CellRendererProgressBar(), "value", 4); nodeview2.AppendColumn ("Ds" + "(КБ/с)", new Gtk.CellRendererText (), "text", 2); nodeview2.AppendColumn ("Us" + "(КБ/с)", new Gtk.CellRendererText (), "text", 3); nodeview2.AppendColumn ("Seeds", new Gtk.CellRendererText (), "text", 5); jBox = new Gtk.Menu (); Gtk.MenuItem MenuItem1 = new MenuItem ("Запустить"); MenuItem1.ButtonReleaseEvent += HandleMenuItem1ButtonReleaseEvent; jBox.Add (MenuItem1); Gtk.MenuItem MenuItem4 = new MenuItem ("Пауза"); MenuItem4.ButtonReleaseEvent += HandleMenuItem4ButtonReleaseEvent; Gtk.MenuItem MenuItem2 = new MenuItem ("Остановить"); MenuItem2.ButtonReleaseEvent += HandleMenuItem2ButtonReleaseEvent; jBox.Add (MenuItem2); Gtk.MenuItem MenuItem5 = new MenuItem ("Открыть Папку..."); MenuItem5.ButtonReleaseEvent += HandleMenuItem5ButtonReleaseEvent; jBox.Add (MenuItem5); MenuItem3 = new MenuItem ("Открыть Файл"); MenuItem3.Sensitive = false; MenuItem3.ButtonReleaseEvent += HandleMenuItem3ButtonReleaseEvent; jBox.Add (MenuItem3); Gtk.MenuItem MenuItem6 = new MenuItem ("Удалить торрент"); MenuItem6.ButtonReleaseEvent += HandleMenuItem6ButtonReleaseEvent;; jBox.Add (MenuItem6); Gtk.MenuItem MenuItem7 = new MenuItem ("Удалить торрент и файлы"); MenuItem7.ButtonReleaseEvent += HandleMenuItem7ButtonReleaseEvent;; jBox.Add (MenuItem7); foreach (string file in Directory.GetFiles (tp)) { if (file.EndsWith (".torrent")) { try { LoadTorrent (file); } catch (Exception e) { File.WriteAllText(ep+"/Error.txt","Couldn't decode: "+file); XenoTorrent.TorrentError ts = new XenoTorrent.TorrentError (e.Message,file); ts.Show (); continue; } } } //engine.StopAll(); LoadFastResume(managers); newTorrents = new int[managers.Count]; StartDht (22334); // Working only with Gtk.Window object! (except [GLib.ConnectBeforeAttribute] attribute is defined on callback method) nodeview2.ButtonPressEvent += HandleNodeview2ButtonPressEvent; nodeview2.ShowAll (); engine.LocalPeerSearchEnabled = true; engine.StartAll (); }