X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=miTask.icl;h=8c17f09423768eebe75f71d318dd96818a4f1379;hb=6420aa92a3b4b341f8f86654df79adc1ef610741;hp=233e07225e4dcdd3e2da597eb47523da89fd7251;hpb=17aaf6797b3dd4e820b186a55335a36a89ea92cb;p=mTask.git diff --git a/miTask.icl b/miTask.icl index 233e072..8c17f09 100644 --- a/miTask.icl +++ b/miTask.icl @@ -55,28 +55,28 @@ demo = viewSharedInformation "Devices" [] deviceStoreNP mTaskManager :: Task () mTaskManager = (>>|) startupDevices $ - viewmTasks ||- + forever viewmTasks ||- ((manageShares ||- forever (manageDevices process)) <<@ ArrangeSplit Vertical True) <<@ ArrangeWithSideBar 0 LeftSide 260 True where - viewmTasks :: Task String + viewmTasks :: Task [MTaskDevice] viewmTasks = enterChoiceWithShared "Available mTasks" [ChooseFromList id] mTaskTaskStore - >&^ \sh->whileUnchanged sh $ \mi->forever (case mi of - Nothing = viewInformation "No task selected" [] () - Just mTaskTask = get deviceStoreNP - >>= \devices->case devices of - [] = viewInformation "No devices yet" [] () - ds = fromJust ('DM'.get mTaskTask allmTasks) - >>= \bc->(enterChoice "Choose Device" [ChooseFromDropdown \t->t.deviceName] ds - -&&- enterInformation "Timeout" [] - ) >>* [OnAction (Action "Send") (withValue $ Just o sendTaskToDevice mTaskTask bc)] - @! () - ) + >>= \task->get deviceStoreNP + >>* [OnValue $ (ifValue isEmpty) $ \_-> + viewInformation "No devices yet" [] [] >>= treturn + ,OnValue $ (ifValue $ not o isEmpty) $ \d-> + fromJust ('DM'.get task allmTasks) + >>= \bc->(enterChoice "Choose Device" [ChooseFromDropdown \t->t.deviceName] d + -&&- enterInformation "Timeout" [] + ) >>* [OnAction (Action "Send") (withValue $ Just o sendTaskToDevice task bc)] + ] process :: MTaskDevice (Shared Channels) -> Task () - process device ch = forever (watch ch >>* [OnValue ( - ifValue (not o isEmpty o fst3) - (\t->upd (appFst3 (const [])) ch >>| proc (fst3 t)))]) + process device ch = forever + $ traceValue "Waiting for channel change" + >>| wait "process" (not o isEmpty o fst3) ch + >>= \(r,s,ss)->upd (appFst3 (const [])) ch + >>| proc r where proc :: [MTaskMSGRecv] -> Task () proc [] = treturn ()