public async Task <IActionResult> DisEdit(Dismiss dis)
        {
            db.Update(dis);
            await db.SaveChangesAsync();

            return(RedirectToAction("Dismiss"));
        }
 public IActionResult DisAdd(Dismiss dis)
 {
     if (ModelState.IsValid)
     {
         db.Dismisses.Add(dis);
         db.SaveChanges();
         return(Redirect("Dismiss"));
     }
     return(View(dis));
 }
        async Task MonitorAuthenticator()
        {
            try {
                await Authenticator.GetAuthCode();

                if (Authenticator.HasCompleted)
                {
                    Dismiss?.Invoke();
                }
            } catch (Exception ex) {
                Console.WriteLine(ex);
            }
        }
        public async Task <IActionResult> DismissEdit(int?id)
        {
            if (id != null)
            {
                Dismiss dis = await db.Dismisses.FirstOrDefaultAsync(p => p.Id == id);

                if (dis != null)
                {
                    return(View(dis));
                }
            }
            return(NotFound());
        }
        public IActionResult DisDel(int?id)
        {
            if (id == null)
            {
                return(RedirectToAction("Dismiss"));
            }

            Dismiss dis = db.Dismisses.Find(id);

            db.Dismisses.Remove(dis);
            db.SaveChanges();
            return(Redirect("Dismiss"));
        }
        public ushort dismissPush(string PushIden)
        {
            if (Access_Code != "")
            {
                string      commandstring = "";
                HttpsClient client        = new HttpsClient();
                client.PeerVerification = false;
                client.HostVerification = false;
                client.Verbose          = false;

                HttpsClientRequest  request = new HttpsClientRequest();
                HttpsClientResponse response;
                String url = "https://api.pushbullet.com/v2/pushes/" + PushIden;

                request.KeepAlive = true;
                request.Url.Parse(url);
                request.Header.SetHeaderValue("Content-Type", "application/json");
                request.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
                request.Header.SetHeaderValue("Authorization", "Bearer " + Access_Code);

                Dismiss dismiss = new Dismiss
                {
                    dismissed = true
                };
                commandstring         = JsonConvert.SerializeObject(dismiss, Formatting.Indented);
                request.ContentString = commandstring;
                response = client.Dispatch(request);

                if (response.Code >= 200 && response.Code < 300)
                {
                    return(1);
                }
                else
                {
                    ErrorLog.Notice("Error Dismissing - " + response.Code.ToString() + "\n");
                    return(0);
                }
            }
            else
            {
                return(0);
            }
        }
 void Cancel()
 {
     Dismiss?.Invoke();
     Authenticator.OnCancelled();
 }
 public override void OnDismissed(Snackbar transientBottomBar, int e)
 {
     base.OnDismissed(transientBottomBar, e);
     Dismiss?.Invoke(transientBottomBar, e);
 }
예제 #9
0
        public ushort dismissPush(string PushIden)
        {
            if (Access_Code != "")
            {
                string commandstring = "";
                HttpsClient client = new HttpsClient();
                client.PeerVerification = false;
                client.HostVerification = false;
                client.Verbose = false;

                HttpsClientRequest request = new HttpsClientRequest();
                HttpsClientResponse response;
                String url = "https://api.pushbullet.com/v2/pushes/" + PushIden;

                request.KeepAlive = true;
                request.Url.Parse(url);
                request.Header.SetHeaderValue("Content-Type", "application/json");
                request.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Post;
                request.Header.SetHeaderValue("Authorization", "Bearer " + Access_Code);

                Dismiss dismiss = new Dismiss
                {
                    dismissed = true
                };
                commandstring = JsonConvert.SerializeObject(dismiss, Formatting.Indented);
                request.ContentString = commandstring;
                response = client.Dispatch(request);
                
                if (response.Code >= 200 && response.Code < 300)
                {
                    return 1;
                }
                else
                {
                    ErrorLog.Notice("Error Dismissing - " + response.Code.ToString() + "\n");
                    return 0;
                }
            }
            else

                return 0;
        }
예제 #10
0
 private void Button_Click_1(object sender, System.Windows.RoutedEventArgs e)
 {
     Dismiss?.Invoke(this, null);
 }
예제 #11
0
 private void Dialog_FormClosing(object sender, FormClosingEventArgs e)
 {
     Dismiss?.Invoke();
 }
예제 #12
0
 private void buttonDismiss_Click(object sender, EventArgs e)
 {
     this.Close();
     Dismiss?.Invoke();
 }