mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-12 07:58:51 +01:00
warehouse update
This commit is contained in:
parent
d7ce515e62
commit
64ba30a811
@ -115,6 +115,7 @@ func (self *WareHouse) GetAria2DownloadingPercent(url string) int {
|
||||
}
|
||||
func (self *WareHouse) UpdateProcessInterval(ms int) {
|
||||
dirty := false
|
||||
L:
|
||||
for {
|
||||
select {
|
||||
case <- self.RefreshTicker.C:
|
||||
@ -136,6 +137,10 @@ func (self *WareHouse) UpdateProcessInterval(ms int) {
|
||||
self.Screen.SwapAndShow()
|
||||
}
|
||||
dirty = false
|
||||
case v:= <- self.Downloading:
|
||||
if v== false {
|
||||
break L
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -398,16 +403,25 @@ func (self *WareHouse) Init() {
|
||||
}
|
||||
self.rpcc = rpcc
|
||||
self.Downloader = grab.NewClient()
|
||||
self.Downloading = make(chan bool)
|
||||
self.Downloading = make(chan bool,1)
|
||||
|
||||
self.RefreshTicker = gotime.NewTicker(500 * gotime.Millisecond)
|
||||
//self.RefreshTicker.Stop()
|
||||
self.SetDownloading(true)
|
||||
go self.UpdateProcessInterval(500)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (self *WareHouse) SetDownloading(v bool) {
|
||||
for len(self.Downloading) > 0 {
|
||||
<- self.Downloading
|
||||
}
|
||||
|
||||
self.Downloading <- v
|
||||
}
|
||||
|
||||
func (self *WareHouse) ResetHouse() {
|
||||
if self.PsIndex > len(self.MyList) -1 {
|
||||
return
|
||||
@ -755,6 +769,17 @@ func (self *WareHouse) OnKbdReturnBackCb() {
|
||||
}
|
||||
}
|
||||
|
||||
func (self *WareHouse) OnExitCb() {
|
||||
|
||||
if self.RefreshTicker != nil {
|
||||
self.RefreshTicker.Stop()
|
||||
}
|
||||
|
||||
self.SetDownloading(false)
|
||||
self.rpcc.Close()
|
||||
|
||||
}
|
||||
|
||||
func (self *WareHouse) OnLoadCb() {
|
||||
|
||||
if self.MyStack.Length() == 1 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user