Exemplo n.º 1
0
        private void DELETE(DeleteNote DN)
        {
            Console.WriteLine(API_HOST);
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(API_HOST + "/" + DN.id);

            request.Method      = "DELETE";
            request.ContentType = "application/json";

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            using (System.IO.Stream stream = response.GetResponseStream())
            {
                using (System.IO.StreamReader SR = new System.IO.StreamReader(stream))
                {
                    string res = SR.ReadToEnd();
                    DM.Delete(DN.id);

                    Messenger.Default.Send <NotificationMessage>(new NotificationMessage(res));
                    Messenger.Default.Send <Command>(new Command()
                    {
                        _cmd = Constants.CMD_DATA_LOAD
                    });
                }
            }
        }
Exemplo n.º 2
0
        public void DeleteNote()
        {
            string id      = "";
            string title   = "";
            string content = "";

            GetDataMain GDM = new GetDataMain();

            GDM.Callback = (output, outputP, outputC) => { id = output; title = outputP; content = outputC; };

            Messenger.Default.Send <GetDataMain>(GDM);

            while (string.IsNullOrEmpty(id) && string.IsNullOrEmpty(title) && string.IsNullOrEmpty(content))
            {
                System.Threading.Thread.Sleep(200);
            }

            DeleteNote DN = new DeleteNote();

            DN.id = id;

            Messenger.Default.Send <DeleteNote>(DN);
            GDM = null;
            DN  = null;
        }