public void Initilize(CkernelGateway in_krnGateway) { Name = "sourcesList"; m_LastItem=0; itemsToRemove=new ArrayList(); krnGateway=in_krnGateway; krnGateway.OnNewSource+=new SourceEvent(m_InvokeOnNewSource); krnGateway.OnRefreshSources+=new RefreshEvent(m_InvokeRefreshList); Columns.Add("Name",90,false); Columns.Add("File Name",190,false); Columns.Add("Speed",60,false); Columns.Add("Status",60,false); Columns.Add("Position",60,false); Columns.Add("Downloaded",60,false); Columns.Add("Uploaded",60,false); Columns.Add("Progress",190,true); Columns.Add("Software",60,false); Columns.Add("Version",60,false); ContextMenuSources = new ContextMenu(); ContextMenuSources.MenuItems.Add("Send message",new EventHandler(OnSendMessage)); ContextMenuSources.MenuItems.Add("View files",new EventHandler(OnViewFiles)); ContextMenuSources.MenuItems.Add("Add to friends",new EventHandler(OnAddFriend)); ContextMenuSources.Popup+=new System.EventHandler(myContextMenuPopup); TheColumnSorter=new ColumnSorter(); TheColumnSorter.CurrentColumn=4; TheColumnSorter.sortOrder=1; this.ClickHeader+=new HeaderEventHandler(myColumnClick); this.DoubleClick+=new EventHandler(OnSendMessage); ContextMenu=ContextMenuSources; m_DefaultWidths=new int[] {90,190,60,60,60,60,60,190,60,60}; m_LoadWidths(); m_Globalize(); }
public void Initilize(CkernelGateway in_krnGateway) { Name = "uploadsList"; krnGateway=in_krnGateway; Columns.Add("Name",90,false); Columns.Add("File Name",190,false); Columns.Add("Speed",60,false); Columns.Add("Uploaded",60,false); Columns.Add("Downloaded",60,false); Columns.Add("Status",60,false); Columns.Add("Progress",120,true); Columns.Add("Software",60,false); Columns.Add("Version",60,false); krnGateway.OnNewUpload+=new ClientEvent(m_InvokeOnNewUpload); krnGateway.OnRefreshUploads+=new RefreshEvent(m_InvokeRefreshList); ContextMenuUploads = new ContextMenu(); ContextMenuUploads.MenuItems.Add("Send message",new EventHandler(OnSendMessage)); ContextMenuUploads.MenuItems.Add("View files",new EventHandler(OnViewFiles)); ContextMenuUploads.MenuItems.Add("Add to friends",new EventHandler(OnAddFriend)); ContextMenuUploads.Popup+=new System.EventHandler(myContextMenuPopup); ContextMenu=ContextMenuUploads; TheColumnSorter=new ColumnSorter(); this.ClickHeader+=new HeaderEventHandler(miColumnClick); this.DoubleClick+=new EventHandler(OnSendMessage); m_DefaultWidths=new int[] {90,190,60,60,60,60,190,60,60}; m_LoadWidths(); m_Globalize(); }
private void m_RefreshList(CkernelGateway in_krnGateway) { int nItem=0; itemsToRemove.Clear(); while (nItem<Items.Count) { ListViewItem Item=Items[nItem]; if (Item==null) break; InterfaceClient clientant=(InterfaceClient)Item.Tag; InterfaceClient client=in_krnGateway.GetUploadClient(clientant.ID,clientant.Port,clientant.ServerIP,clientant.UserHash); if (client==null) itemsToRemove.Add(Item);//Items.RemoveAt(nItem); else ClientToItem(client,Item); nItem++; } foreach (ListViewItem Item in itemsToRemove) { this.Items.Remove(Item); } }
public void Initilize(CkernelGateway in_krnGateway) { krnGateway=in_krnGateway; RefreshList(); labelID.Visible=false; labelID.Text="0"; buttonRemove.Text=HathiForm.Globalization["LBL_REMOVECATEGORY"]; buttonAccept.Text=HathiForm.Globalization["LBL_ACCEPT"]; buttonCancel.Text=HathiForm.Globalization["LBL_CANCEL"]; labelName.Text=HathiForm.Globalization["LBL_NAME"]+":"; labelAutoSelect.Text=HathiForm.Globalization["LBL_AUTOSELECTCAT"]+":"; label1.Text=HathiForm.Globalization["LBL_COLOR"]+":"; m_ApplySkin(); }
// private void m_RefreshList(CkernelGateway in_krnGateway) // { // if (m_strFileHash==null) return; // ReloadList(m_strFileHash); // } private void m_RefreshList(CkernelGateway in_krnGateway) { if (m_strFileHash==null) { Items.Clear(); return; } InterfaceFileNames[] files=krnGateway.GetFileNamesList(m_strFileHash); if (files==null) { Items.Clear(); return; } foreach (InterfaceFileNames fileName in files) { m_UpdateOrAddFilename(fileName); } this.ListViewItemSorter = TheColumnSorter; this.Sort(); this.ListViewItemSorter = null; //clear from list old names /*ArrayList toDelete=new ArrayList(); foreach (ListViewItem itemFileName in this.Items) { if ((uint)itemFileName.Tag!=refreshID) toDelete.Add(itemFileName); } foreach (ListViewItem itemFileName in toDelete) { this.Items.Remove(itemFileName); } toDelete.Clear();*/ }
private void m_OnRefreshShared(CkernelGateway krnGateway) { m_RefreshList(); }
public void Initilize(CkernelGateway in_krnGateway) { Name = "sharedListView"; krnGateway=in_krnGateway; krnGateway.OnRefreshShared+=new RefreshEvent(m_InvokeOnRefreshShared); krnGateway.OnNewSharedFile+=new FileEvent(m_InvokeOnNewSharedFile); krnGateway.OnRemovedSharedFile+=new FileEvent(m_InvokeOnRemovedSharedFile); Columns.Add("File Name",190,false); Columns.Add("Size",75,false); Columns.Add("Priority",60,false); Columns.Add("Progress",60,true); ContextMenuShared = new ContextMenu(); ContextMenuShared.MenuItems.Add("Open file",new EventHandler(OnOpenFile)); ContextMenuShared.MenuItems.Add("Delete file",new EventHandler(OnDeleteFile)); ContextMenuShared.MenuItems.Add("-"); ContextMenuShared.MenuItems.Add("Copy eLink to clipboard",new EventHandler(OnCopyLink)); ContextMenuShared.MenuItems.Add("Copy eLink to clipboard (HTML)", new EventHandler(OnCopyLinkHTML)); ContextMenuShared.MenuItems.Add("Copy eLink to clipboard (Sources)", new EventHandler(OnCopyLinkSources)); ContextMenuShared.MenuItems.Add("-"); PriorityMenu = new MenuItem( "&Priority"); ContextMenuShared.MenuItems.Add(PriorityMenu); PriorityMenu.MenuItems.Add("Very high Priority",new EventHandler(OnReleasePriority)); PriorityMenu.MenuItems.Add("High Priority",new EventHandler(OnHighPriority)); PriorityMenu.MenuItems.Add("Normal Priority",new EventHandler(OnNormalPriority)); PriorityMenu.MenuItems.Add("Low Priority",new EventHandler(OnLowPriority)); PriorityMenu.MenuItems.Add("Very low Priority",new EventHandler(OnVeryLowPriority)); ContextMenuShared.MenuItems.Add("-"); MenuItem MenuItemInfo=new MenuItem("Search more info"); ContextMenuShared.MenuItems.Add(MenuItemInfo); MenuInfo=new CMenuInfo(MenuItemInfo); ContextMenu=ContextMenuShared; ContextMenuShared.Popup+=new System.EventHandler(myContextMenuPopup); TheColumnSorter=new ColumnSorter(); TheColumnSorter.CurrentColumn=1; TheColumnSorter.sortOrder=-1; this.ClickHeader+=new HeaderEventHandler(myColumnClick); this.DoubleClick+=new EventHandler(OnOpenFile); this.KeyDown+=new KeyEventHandler(OnKeyDown); m_DefaultWidths=new int[] {190,75,60,60}; m_Globalize(); m_LoadWidths(); SmallImageList=HathiForm.SystemIconsList.list; SelectedIndexChanged+=new EventHandler(sharedListView_SelectedIndexChanged); ReloadList(false); }
private void m_RefreshList(CkernelGateway in_krnGateway) { if (m_strFileHash==null) { Items.Clear(); return; } InterfaceComment[] comments=krnGateway.GetComments(m_strFileHash); if (comments==null) { Items.Clear(); return; } foreach (InterfaceComment comment in comments) { if (comment!=null) m_UpdateOrAddComment(comment); } }
public FormOptions(CkernelGateway in_krnGateway) { InitializeComponent(); krnGateway = in_krnGateway; //tabPageKernel.Selected = true; tabPageKernel.Activate(); m_Globalize(); m_AddToolTip(); m_ApplySkin(); m_GetLanguageFiles(); if (Directory.Exists(Application.StartupPath + Path.DirectorySeparatorChar + "skins\\")) { string[] dirs = Directory.GetDirectories(Application.StartupPath + Path.DirectorySeparatorChar + "skins\\"); foreach (string folderName in dirs) { if (File.Exists(folderName + "\\skin.xml")) comboBoxSkin.Items.Add(Path.GetFileName(folderName)); } } DisplayPreferences(krnGateway.GetConfig()); m_DisplayInterfacePreferences(); }
private void m_OnRefreshList(CkernelGateway kernelGateway) { InterfaceServer[] servers=krnGateway.GetServerList(); if (servers==null) { Items.Clear(); return; } foreach (InterfaceServer server in servers) { if (server!=null) { UpdateOrAddServer(server); } } /*not real time sorting ListViewItemSorter = TheColumnSorter; Sort(); ListViewItemSorter = null;*/ }
public void Initilize(CkernelGateway in_krnGateway) { Name="searchListView"; krnGateway=in_krnGateway; krnGateway.OnNewServer+=new ServerEvent(OnNewServer); krnGateway.OnDeleteServer+=new IPEvent(OnDeleteServer); krnGateway.OnRefreshServers+=new RefreshEvent(m_OnRefreshList); Columns.Add("Server Name",170,false); Columns.Add("Address",100,false); Columns.Add("Failed",50,false); Columns.Add("Files",60,false); Columns.Add("Users",60,false); Columns.Add("Priority",50,false); ContextMenuServers = new ContextMenu(); ConnectMenu = new MenuItem("&Connect", new EventHandler(OnConnectServer) ); DeleteMenu = new MenuItem("&Delete", new EventHandler(DeleteServer) ); CopyLinkMenu = new MenuItem("Copy &link", new EventHandler(OnCopyLink)); CopyLinkHTMLMenu = new MenuItem("Copy link (&HTML)", new EventHandler(OnCopyLinkHTML)); PriorityMenu = new MenuItem("&Priority"); HighPriorityMenu = new MenuItem("&High priority",new EventHandler(OnHighPriority)); NormalPriorityMenu = new MenuItem("&Normal priority",new EventHandler(OnNormalPriority)); LowPriorityMenu = new MenuItem("&Low priority",new EventHandler(OnLowPriority)); ContextMenuServers.MenuItems.Add(ConnectMenu); ContextMenuServers.MenuItems.Add(DeleteMenu); ContextMenuServers.MenuItems.Add("-"); ContextMenuServers.MenuItems.Add(CopyLinkMenu); ContextMenuServers.MenuItems.Add(CopyLinkHTMLMenu); ContextMenuServers.MenuItems.Add("-"); ContextMenuServers.MenuItems.Add(PriorityMenu); PriorityMenu.MenuItems.Add(HighPriorityMenu); PriorityMenu.MenuItems.Add(NormalPriorityMenu); PriorityMenu.MenuItems.Add(LowPriorityMenu); ContextMenuServers.Popup += new EventHandler(OnContextMenuPopup); ContextMenu=ContextMenuServers; TheColumnSorter=new ServerColumnSorter(); TheColumnSorter.CurrentColumn=4; TheColumnSorter.sortOrder=1; this.ClickHeader+=new HeaderEventHandler(myColumnClick); this.DoubleClick+=new EventHandler(OnConnectServer); this.KeyDown+=new KeyEventHandler(OnKeyDown); m_DefaultWidths=new int[] {170,100,50,60,60,50}; m_Globalize(); ReloadList(); m_LoadWidths(); }
public void Connect(CkernelGateway in_krnGateway) { krnGateway=in_krnGateway; krnGateway.OnLogMessage+=new LogEvent(OnLog); serversList.Initilize(krnGateway); }
public void Connect(CkernelGateway in_krnGateway) { krnGateway = in_krnGateway; krnGateway.OnNewSearched += new SearchEvent(m_InvokeOnNewSearched); krnGateway.OnModifiedSearched += new SearchEvent(m_InvokeOnModifiedSearched); krnGateway.OnEndSearch += new EndSearchEvent(m_InvokeOnEndSearch); krnGateway.OnNewSearchTab += new SearchTabEvent(m_OnNewSearchTab); krnGateway.OnSearchProgress += new SearchProgressEvent(m_InvokeOnSearchProgress); }
public void Connect(CkernelGateway in_krnGateway) { krnGateway = in_krnGateway; uploadsList.Initilize(krnGateway); sharedListView.Initilize(krnGateway); }
public void Connect(CkernelGateway in_krnGateway) { krnGateway = in_krnGateway; krnGateway.OnNewChatMessage += new SourceEvent(m_OnNewChatMessage); krnGateway.OnStartChatSession += new ClientEvent(m_OnStartChatSession); LoadFriendsList(); }
private void m_RefreshList(CkernelGateway in_krnGateway) { //refresh 30 items each second itemsToRemove.Clear(); int nRefreshed=0; int nItem=0; bool refresh; ListViewItem Item; while (nItem<Items.Count) { Item=Items[nItem]; if (Item==null) break; InterfaceClient sourceant=(InterfaceClient)Item.Tag; refresh=false; if ((nItem>=m_LastItem)&&(nItem<=m_LastItem+30)) //only refresh not queued sources { refresh=true; } if ((sourceant.DownloadState!=2)&&(sourceant.DownloadState!=6)) refresh=true; if (refresh) { nRefreshed++; InterfaceClient source=in_krnGateway.GetDownloadClient(sourceant.ID,sourceant.Port,sourceant.ServerIP,sourceant.UserHash,strFileHash); if (source==null) itemsToRemove.Add(Item); else SourceToItem(source,Item); } nItem++; } m_LastItem+=30; if (m_LastItem>=Items.Count) m_LastItem=0; foreach (ListViewItem ItemRemove in itemsToRemove) { this.Items.Remove(ItemRemove); } //Debug.WriteLine("Refreshed: "+ nRefreshed.ToString() +" : "+m_LastItem.ToString()); }
public void Initilize(CkernelGateway in_krnGateway) { krnGateway=in_krnGateway; Columns.Add("Name",90,false); Columns.Add("File Name",190,false); Columns.Add("Uploaded",60,false); Columns.Add("Downloaded",60,false); Columns.Add("Status",60,false); Columns.Add("Progress",120,false); Columns.Add("Software",60,false); Columns.Add("Version",60,false); ContextMenuUploads = new ContextMenu(); ContextMenuUploads.MenuItems.Add("Send message",new EventHandler(OnSendMessage)); ContextMenuUploads.MenuItems.Add("View files",new EventHandler(OnViewFiles)); ContextMenuUploads.MenuItems.Add("Add to friends",new EventHandler(OnAddFriend)); ContextMenu=ContextMenuUploads; TheColumnSorter=new ColumnSorter(); this.ClickHeader+=new HeaderEventHandler(miColumnClick); m_DefaultWidths=new int[] {90,190,60,60,60,190,60,60}; }
public void Initilize(CkernelGateway in_krnGateway) { Name="listViewQueue"; AlreadyDownloadingItemColor=Color.Red; AlreadyDownloadedItemColor=Color.Green; try { Font=new Font("Microsoft Sans Serif",8.25F,GraphicsUnit.Point); } catch { Font=(Font)this.Parent.Font.Clone(); } krnGateway=in_krnGateway; Columns.Add("File Name",400,true); Columns.Add("Size",80,true); Columns.Add("Sources",60,true); Columns.Add("Codec",60,false); Columns.Add("Length",60,false); Columns.Add("Bitrate",60,false); Columns.Add("File type",90,false); ContextMenuSearch = new ContextMenu(); ContextMenuSearch.MenuItems.Add("Download",new EventHandler(OnDownloadFile)); ContextMenuSearch.MenuItems.Add("Download (Stopped)",new EventHandler(OnDownloadFileStopped)); ContextMenuSearch.MenuItems.Add("-"); ContextMenuSearch.MenuItems.Add("Copy eLink to clipboard", new EventHandler(OnCopyLink)); ContextMenuSearch.MenuItems.Add("Copy eLink to clipboard (HTML)", new EventHandler(OnCopyLinkHTML)); ContextMenuSearch.MenuItems.Add("-"); MenuItem MenuItemInfo=new MenuItem("Search more info"); ContextMenuSearch.MenuItems.Add(MenuItemInfo); MenuInfo=new CMenuInfo(MenuItemInfo); ContextMenu=ContextMenuSearch; ContextMenuSearch.Popup+=new System.EventHandler(myContextMenuPopup); TheColumnSorter=new SearchColumnSorter(); TheColumnSorter.CurrentColumn=1; TheColumnSorter.sortOrder=-1; this.ClickHeader+=new HeaderEventHandler(myColumnClick); this.DoubleClick+=new EventHandler(OnDownloadFile); this.KeyDown+=new KeyEventHandler(OnKeyDown); m_DefaultWidths=new int[] {400,80,60,60,60,60,90}; m_Globalize(); m_LoadWidths(); this.SelectedIndexChanged+=new EventHandler(searchListView_SelectedIndexChanged); }
public void Initialize(CkernelGateway in_krnGateway) { Name = "listViewComments"; krnGateway=in_krnGateway; Columns.Add("User",100,false); Columns.Add("Rating",60,false); Columns.Add("Comment",220,false); krnGateway.OnRefreshFileComments+=new RefreshEvent(m_InvokeRefreshList); TheColumnSorter=new ColumnSorter(); TheColumnSorter.CurrentColumn=1; TheColumnSorter.sortOrder=-1; this.ClickHeader+=new HeaderEventHandler(myColumnClick); m_DefaultWidths=new int[] {100,60,220}; m_Globalize(); m_LoadWidths(); }
private void m_InvokeOnRefreshStatus(CkernelGateway in_krnGateway) { try { this.Invoke(new RefreshEvent(m_OnRefreshStatus),new object[] {in_krnGateway}); } catch {} }
private void m_InvokeOnRefreshShared(CkernelGateway krnGateway) { this.BeginInvoke(new RefreshEvent(m_OnRefreshShared),new object[] {krnGateway}); }
private void m_OnRefreshStatus(CkernelGateway in_krnGateway) { GlobalStatus status=krnGateway.GetGlobalStatus(); byte IconNumber; labelStatusUPSpeed.Text=Globalization["LBL_UP"]+status.UploadSpeed.ToString("###0.#"); labelStatusDOSpeed.Text=Globalization["LBL_DO"]+status.DowloadSpeed.ToString("###0.#"); labelStatusAvgDOSpeed.Text=Globalization["LBL_AVGDO"]+status.AvgDownSpeed.ToString(); labelSessionUP.Text=Globalization["LBL_UPLOADED"]+":"+HathiListView.SizeToString(status.SessionUpload); labelSessionDO.Text=Globalization["LBL_DOWNLOADED"]+":"+HathiListView.SizeToString(status.SessionDownload); notifyIcon1.Text=labelStatusUPSpeed.Text+" "+labelStatusDOSpeed.Text+" "+labelStatusAvgDOSpeed.Text; this.Text= String.Format("Hathi v{0} ( {1} )", in_krnGateway.Version, notifyIcon1.Text); #if DEBUG labelStatusServer.Text="Cnx: "+ status.ActiveConnections.ToString()+" "; labelStatusServer.Text+=status.ServerName; #else labelStatusServer.Text=status.ServerName; #endif toolTipMain.SetToolTip(labelStatusServer,Globalization["LBL_USERS"]+":"+status.ServerUsers+" - "+Globalization["LBL_FILES"]+":"+status.ServerFiles.ToString()+" - ID:" + status.UserID.ToString()); graphics.AddValue(status.DowloadSpeed,status.UploadSpeed); if (status.UserID==0) IconNumber = 1; else { if (status.IsHighID) IconNumber = 0; else IconNumber = 2; } if (m_LastIcon!=IconNumber) { m_UpdateStatusIcon(imageListIcons.Images[IconNumber]); m_LastIcon=IconNumber; } if (notifyIcon1.Visible) { m_DrawNotifyIcon(imageListIcons.Images[IconNumber],status.DowloadSpeed/m_Preferences.maxDownloadRate,status.UploadSpeed/m_Preferences.maxUploadRate); } if (status.UserID!=0) HathiButtonConnect.ImageList=this.imageListServerDiscon; else HathiButtonConnect.ImageList=this.imageListServerCon; }
private void m_InvokeRefreshList(CkernelGateway in_krnGateway) { this.BeginInvoke(new RefreshEvent(m_RefreshList),new object[] {in_krnGateway}); }
private void m_StartKernel() { if (!m_KernelLoaded) { FDownloads.Show(); m_KernelLoaded=true; if (m_remoteGateway==null) krnGateway=new CkernelGateway(); else krnGateway=new CkernelGateway(m_remoteGateway); Connect(); if (m_link!=null) krnGateway.DownloadElink(m_link,false); } }
public void Initialize(CkernelGateway in_krnGateway) { Name = "listViewNames"; krnGateway=in_krnGateway; Columns.Add("File Name",190,false); Columns.Add("Sources",60,false); krnGateway.OnRefreshFileNames+=new RefreshEvent(m_InvokeRefreshList); TheColumnSorter=new ColumnSorter(); TheColumnSorter.CurrentColumn=1; TheColumnSorter.sortOrder=-1; sortColumn=1; sortOrder=-1; this.ClickHeader+=new HeaderEventHandler(myColumnClick); m_DefaultWidths=new int[] {190,60}; m_Globalize(); m_LoadWidths(); }
public void Connect(CkernelGateway in_krnGateway) { krnGateway = in_krnGateway; krnGateway.OnSummaryFilterChanged += new EventHandler(downloadList_OnSummaryFilterChanged); krnGateway.OnCategoryListChanged += new EventHandler(krnGateway_OnCategoryListChanged); downloadList.Initilize(krnGateway); sourcesList.Initilize(krnGateway); listViewNames.Initialize(krnGateway); listViewComments.Initialize(krnGateway); m_UpdateCategoryLabels(); }