Exemplo n.º 1
0
        // Load data for the ViewModel Items
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (!App.ViewModel.IsDataLoaded)
            {
                App.ViewModel.LoadData();
            }
            dbServices d = new dbServices();

            try
            {
                if (d.isUserLoggedIn())
                {
                    NavigationService.RemoveBackEntry();
                    NavigationService.Navigate(new Uri("/DocListing.xaml", UriKind.RelativeOrAbsolute));
                }
            }
            catch (Exception exx)
            {
                System.Diagnostics.Debug.WriteLine(exx.ToString());
            }
            while (NavigationService.CanGoBack)
            {
                NavigationService.RemoveBackEntry();
            }
        }
Exemplo n.º 2
0
        public void logout(object sender, EventArgs e)
        {
            dbServices d = new dbServices();

            d.truncateAllTable();
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
        }
Exemplo n.º 3
0
        public async void CreateANewFile(object sender, EventArgs e)
        {
            if (fileNameL.Text == "")
            {
                return;
            }


            dbServices d = new dbServices();

            var values = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("email", d.returnEmailofUser()),
                new KeyValuePair <string, string>("name", fileNameL.Text)
            };

            var httpClient = new HttpClient(new HttpClientHandler());
            HttpResponseMessage response = await httpClient.PostAsync(urlConfig.createNoteUrl(), new FormUrlEncodedContent(values));

            try
            {
                var responseString = await response.Content.ReadAsStringAsync();

                System.Diagnostics.Debug.WriteLine(responseString);
                System.Diagnostics.Debug.WriteLine("response: " + responseString);
                var responseStrings = JsonConvert.DeserializeObject <onCreateNote>(responseString);
                System.Diagnostics.Debug.WriteLine(responseStrings);
                if (responseStrings.status == 0)
                {
                    d.addnoteInDb((onCreateNote)responseStrings, fileNameL.Text);
                    IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication();
                    if (store.GetDirectoryNames().Contains("./"))
                    {
                        string directory     = "./";
                        var    isoFileStream = new IsolatedStorageFileStream(directory + "\\" + fileNameL.Text, FileMode.OpenOrCreate, store);
                    }
                    NavigationService.Navigate(new Uri("/Note.xaml?file=" + fileNameL.Text, UriKind.RelativeOrAbsolute));
                }
                else
                {
                    System.Diagnostics.Debug.WriteLine("Possibly wrong password !!"); //Add Message box here.
                    NavigationService.Navigate(new Uri("/DocListing.xaml", UriKind.RelativeOrAbsolute));
                }
            }
            catch (Exception err)
            {
                System.Diagnostics.Debug.WriteLine(err.ToString());
            }
        }
Exemplo n.º 4
0
        public async void sendInvite(object sender, EventArgs e)
        {
            string     email  = inviteEmail.Text;
            dbServices d      = new dbServices();
            var        values = new List <KeyValuePair <string, string> >
            {
                new KeyValuePair <string, string>("email", email),
                new KeyValuePair <string, string>("id", d.getNoteId(filename).ToString())
            };

            var httpClient = new HttpClient(new HttpClientHandler());
            HttpResponseMessage response = await httpClient.PostAsync(urlConfig.inviteUrl(), new FormUrlEncodedContent(values));

            try
            {
                var responseString = await response.Content.ReadAsStringAsync();

                System.Diagnostics.Debug.WriteLine(responseString);
            }
            catch (Exception err)
            {
                System.Diagnostics.Debug.WriteLine(err.ToString());
            }
        }