void LoadField() { AreCut = false; ThreadsItemLoadWork = new List <Thread>(); GroupData = new TransferGroup(); ItemsTransferWork = new List <TransferBytes>(); }
public int AddNewGroup(TransferGroup Group) { if (Setting_UI.ExitAPP_Flag) { return(-1); } Group.DataSource.Status = Group.status.ToString(); if (groups.IndexOf(Group) >= 0) { refresh(); } else { groups.Add(Group); if (Group.change == ChangeTLV.Processing) { TLV_process.data.Add(Group); } else { TLV_done.data.Add(Group); } } return(0); }
public void Add(TransferGroup ud_group) { if (groups_.IndexOf(ud_group) < 0) { groups_.Add(ud_group); } }
public void Remove(TransferGroup ud_group) { if (groups_.IndexOf(ud_group) > -1) { groups_.Remove(ud_group); } }
public void RemoveGroup(TransferGroup Group) { if (Setting_UI.ExitAPP_Flag) { return; } TLV_ud.RemoveObject(Groups[Groups.IndexOf(Group)]); TLV_done.RemoveObject(Groups[Groups.IndexOf(Group)]); Groups.Remove(Group); }
void ChangeStatus(StatusTransfer val) { foreach (CloudManagerGeneralLib.Class.TransferItem it in items) { if (val == StatusTransfer.Started && (it.status == StatusTransfer.Stop || it.status == StatusTransfer.Waiting || it.status == StatusTransfer.Error)) { it.status = val; TransferGroup pr = GetParentItem(it); if (pr != null && (pr.status != StatusTransfer.Running || pr.status != StatusTransfer.Loading || pr.status != StatusTransfer.Remove)) { pr.status = val; } } else //set Stop child if (val == StatusTransfer.Stop && (it.status != StatusTransfer.Done || it.status != StatusTransfer.Error || it.status != StatusTransfer.Stop)) { it.status = val; } else //set Waiting child if (val == StatusTransfer.Waiting && it.status != StatusTransfer.Done) { it.status = val; } else if (val == StatusTransfer.Remove) { it.status = val; } } foreach (TransferGroup gr in groups) { if (val == StatusTransfer.Started && (gr.status != StatusTransfer.Running)) { gr.status = val; } else if (val == StatusTransfer.Stop && (gr.status != StatusTransfer.Done || gr.status != StatusTransfer.Loading || gr.status != StatusTransfer.Stop)) { gr.status = val; } else if (val == StatusTransfer.Waiting && (gr.status != StatusTransfer.Done || gr.status != StatusTransfer.Remove)) { gr.status = val; } else if (val == StatusTransfer.Remove) { gr.status = val; } } }
public void UpdateGroup(TransferGroup Group, UpdateTransfer_TLVUD type) { switch (type) { case UpdateTransfer_TLVUD.Add: TLV_UD.AddNewGroup(Group); break; case UpdateTransfer_TLVUD.Remove: TLV_UD.RemoveGroup(Group); break; case UpdateTransfer_TLVUD.Refresh: TLV_UD.RefreshAll(); break; } }
}// 8 header private void LoadListView_TLV(ref TreeListView TLV, ControlCollection cc, OLVColumn[] array_header) { TLV = new TreeListView(); TLV.Dock = DockStyle.Fill; TLV.View = View.Details; TLV.MultiSelect = true; TLV.GridLines = true; TLV.FullRowSelect = true; TLV.Columns.AddRange(array_header); cc.Add(TLV); // add to ControlCollection // TLV.CanExpandGetter = delegate(object x) { return(x is TransferGroup); }; //group TLV.ChildrenGetter = delegate(object x) //child { TransferGroup list_ud_item = x as TransferGroup; return(list_ud_item.items); }; TLV.SelectedIndexChanged += TLV_SelectedIndexChanged; TLV.ContextMenuStrip = contextMenuStrip1; //col 0 array_header[0].AspectGetter = delegate(object x) { if (x is TransferGroup)//group { return(((TransferGroup)x).Name); } else//child { return(""); } }; for (int val = 1; val < array_header.Length; val++) { int i = val - 1; array_header[val].AspectGetter = delegate(object x) { if (x is TransferItem)//item in group { return(((TransferItem)x).DataSource.Col[i]); } if (x is TransferGroup)//group { return(((TransferGroup)x).DataSource.Col[i]); } return(""); }; } }
public void RemoveGroup(TransferGroup Group) { if (Setting_UI.ExitAPP_Flag) { return; } groups.Remove(Group); if (Group.change == ChangeTLV.Processing) { TLV_process.data.Remove(Group); } else { TLV_done.data.Remove(Group); } }
private void treeList_ContextMenuOpening(object sender, ContextMenuEventArgs e) { start.IsEnabled = false; waiting.IsEnabled = false; stop.IsEnabled = false; error.IsEnabled = false; remove.IsEnabled = false; numberOfParallelDownloads.IsEnabled = false; var seleecteditems = treeList.SelectedItems; if (seleecteditems != null) { if (seleecteditems.Count > 0) { remove.IsEnabled = true; } groups = new List <TransferGroup>(); items = new List <CloudManagerGeneralLib.Class.TransferItem>(); foreach (var item in seleecteditems) { TreeNode node = item as TreeNode; TransferGroup tg = node.Tag as TransferGroup; CloudManagerGeneralLib.Class.TransferItem ti = node.Tag as CloudManagerGeneralLib.Class.TransferItem; if (tg != null)//group { groups.Add(tg); SetIsEnableMenuTLV(tg as Transfer); foreach (CloudManagerGeneralLib.Class.TransferItem child in tg.items) { SetIsEnableMenuTLV(child as Transfer); } }//item else { items.Add(ti); SetIsEnableMenuTLV(ti as Transfer); } } if (groups.Count == 1 & items.Count == 0) { numberOfParallelDownloads.IsEnabled = true; } } }
public int AddNewGroup(TransferGroup group_work) { if (Setting_UI.ExitAPP_Flag) { return(-1); } group_work.DataSource.Status = group_work.status.ToString(); Groups.Add(group_work); if (group_work.change == ChangeTLV.Processing) { TLV_ud.AddObject(group_work); } else { TLV_done.AddObject(group_work); } return(Groups.IndexOf(group_work)); }
private void ChangeStatus(StatusTransfer val) { if (childs != null && childs.Count != 0) { foreach (var child in childs) { //set Started when item is Stop,Waiting if (val == StatusTransfer.Started && (child.status == StatusTransfer.Stop || child.status == StatusTransfer.Waiting || child.status == StatusTransfer.Error)) { child.status = val; TransferGroup pr = olv.GetParent(child) as TransferGroup; if (pr != null && (pr.status != StatusTransfer.Running || pr.status != StatusTransfer.Loading || pr.status != StatusTransfer.Remove)) { pr.status = val; } } else //set Stop child if (val == StatusTransfer.Stop && (child.status != StatusTransfer.Done || child.status != StatusTransfer.Error || child.status != StatusTransfer.Stop)) { child.status = val; } else //set Waiting child if (val == StatusTransfer.Waiting && child.status != StatusTransfer.Done) { child.status = val; } else if (val == StatusTransfer.Remove) { child.status = val; } } } if (parents != null && parents.Count != 0) { foreach (var parent in parents) { if (val == StatusTransfer.Started && (parent.status != StatusTransfer.Running)) { parent.status = val; } else if (val == StatusTransfer.Stop && (parent.status != StatusTransfer.Done | parent.status != StatusTransfer.Loading | parent.status != StatusTransfer.Stop)) { parent.status = val; } else if (val == StatusTransfer.Waiting && (parent.status != StatusTransfer.Done | parent.status != StatusTransfer.Remove)) { parent.status = val; } else if (val == StatusTransfer.Remove) { parent.status = val; } } } }
protected override JArray ProcessRes(JsonRPCrequest req) { JArray result = new JArray(); result = base.ProcessRes(req); switch (req.method) { case "getTransferByAddressAndBlockNumber": { UInt160 address = new UInt160((string)req.@params[0]); uint blockNumber = uint.Parse(req.@params[1].ToString()); TransferGroup trans = Singleton.Store.GetTransferGroup().TryGet(new TransferKey() { address = address, blockNumber = blockNumber }); if (trans == null) { result = new JArray(); } else { JArray ja = new JArray(); for (var i = 0; i < trans.transfers.Length; i++) { ja.Add(trans.transfers[i].ToJson()); } result = ja; } break; } case "getAllTransferByAddress": { UInt160 address = new UInt160((string)req.@params[0]); TransferBlockNumberList list = Singleton.Store.GetTransferBlockNumberList().TryGet(address); if (list == null) { result = new JArray(); } else { JArray ja = new JArray(); for (var i = 0; i < list.blockNumberList.Count; i++) { uint blockNumber = list.blockNumberList[i]; TransferGroup trans = Singleton.Store.GetTransferGroup().TryGet(new TransferKey() { address = address, blockNumber = blockNumber }); for (var ii = 0; ii < trans.transfers.Length; ii++) { ja.Add(trans.transfers[ii].ToJson()); } } result = ja; } break; } case "getTransferFilterBlockNumber": { UInt160 address = new UInt160((string)req.@params[0]); uint blockNumber = uint.Parse(req.@params[1].ToString()); TransferBlockNumberList list = Singleton.Store.GetTransferBlockNumberList().TryGet(address); if (list == null) { result = new JArray(); } else { JArray ja = new JArray(); for (var i = 0; i < list.blockNumberList.Count; i++) { uint _blockNumber = list.blockNumberList[i]; if (_blockNumber < blockNumber) { continue; } TransferGroup trans = Singleton.Store.GetTransferGroup().TryGet(new TransferKey() { address = address, blockNumber = _blockNumber }); for (var ii = 0; ii < trans.transfers.Length; ii++) { ja.Add(trans.transfers[ii].ToJson()); } } result = ja; } break; } } return(result); }