Commits

Maxim Moiseev committed 969cf9f

minor improvements

  • Participants
  • Parent commits 8ba081f

Comments (0)

Files changed (2)

src/Linq2vk.Core/Net.fs

 #else
             req.AllowAutoRedirect <- false
 #endif
-//            req.CookieContainer <- CookieContainer()
-//            req.CookieContainer.Add(Cookie("remixlang", "0", "/", ".userapi.com"))
             ()
         
         async {
-            let req = HttpWebRequest.Create(url) :?> HttpWebRequest
-            setRequestProperties req
+            let req = HttpWebRequest.Create(url)
+            setRequestProperties (req :?> HttpWebRequest)
             let! resp = req.AsyncGetResponse()
             return resp :?> HttpWebResponse
         }

src/Linq2vk.Core/UserAPI.fs

 
 type UserAPI (prjId:int64) =
     let WindowSize = 10
+    let InvalidUid = Int64.MinValue
     
     let mutable _sid = String.Empty
-    let mutable _uid = Int64.MinValue
+    let mutable _uid = InvalidUid
     
     let query act =
         Query.init _sid |> Query.addAction act
         q |> Api.getAll |> Seq.map conv
     
     member this.LoggedIn
-        with get () = _uid <> Int64.MinValue
+        with get () = _uid <> InvalidUid
         
     member this.UserId
         with get () = _uid
             (sid, uid)
             
         let (sid, uid) =
-            Net.processUrlResponse query getIds |> Async.RunSynchronously
+            let task = Net.processUrlResponse query getIds
+            try
+                Async.RunSynchronously task
+            with
+            | :? NotImplementedException as ex ->
+                    System.Diagnostics.Debug.WriteLine(ex.ToString())
+                    if ex.InnerException <> null then
+                        System.Diagnostics.Debug.WriteLine(ex.InnerException.ToString())
+                    ("", InvalidUid)
         
         _sid <- sid
         _uid <- uid