public void CleanUp()
        {
            //Delete the note added
            NotesPage.TrashNote(NoteCreator.PreviousTitle);

            Driver.Close();
        }
        public async void OpenImagePicker()
        {
            NotesPage.DisablePopupLightDismiss();

            FileOpenPicker picker = new FileOpenPicker();

            picker.ViewMode = PickerViewMode.Thumbnail;
            picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;

            //image
            picker.FileTypeFilter.Add(".jpg");
            picker.FileTypeFilter.Add(".jpeg");
            picker.FileTypeFilter.Add(".png");
            picker.FileTypeFilter.Add(".gif");

#if WINDOWS_PHONE_APP
            await Task.Delay(0);

            //open
            picker.PickMultipleFilesAndContinue();
#elif WINDOWS_UWP
            var files = await picker.PickMultipleFilesAsync();

            HandleImageFromFilePicker(files);
#endif
        }
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            Forms.Init();

            // Create app-level resource dictionary.
            Xamarin.Forms.Application.Current = new Xamarin.Forms.Application();
            Xamarin.Forms.Application.Current.Resources = new MyDictionary();

            Instance = this;
            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes
            {
                TextColor = UIColor.Black
            });

            FolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));

            NotesPage notesPage = new NotesPage()
            {
                // Set the parent so that the app-level resource dictionary can be located.
                Parent = Xamarin.Forms.Application.Current
            };

            UIViewController notesPageController = notesPage.CreateViewController();
            notesPageController.Title = "Notes";

            _navigation = new AppNavigationController(notesPageController);

            _window.RootViewController = _navigation;
            _window.MakeKeyAndVisible();

            notesPage.Parent = null;
            return true;
        }
        public void CleanUp()
        {
            //delete the basic note created in the setup
            NotesPage.TrashNote(NoteCreator.PreviousTitle);

            Driver.Close();
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Forms.Init(this, bundle);
            Instance = this;

            SetContentView(Resource.Layout.Main);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Notes";

            FolderPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData));
            AndroidX.Fragment.App.Fragment mainPage = new NotesPage().CreateSupportFragment(this);
            SupportFragmentManager
            .BeginTransaction()
            .Replace(Resource.Id.fragment_frame_layout, mainPage)
            .Commit();

            SupportFragmentManager.BackStackChanged += (sender, e) =>
            {
                bool hasBack = SupportFragmentManager.BackStackEntryCount > 0;
                SupportActionBar.SetHomeButtonEnabled(hasBack);
                SupportActionBar.SetDisplayHomeAsUpEnabled(hasBack);
                SupportActionBar.Title = hasBack ? "Note Entry" : "Notes";
            };
        }
示例#6
0
        public App()
        {
            InitializeComponent();

            Device.SetFlags(new string[] { "SwipeView_Experimental" });

            MainPage = new NotesPage();
        }
示例#7
0
        public void CanEditAnExistingNote()
        {
            NotesPage.GoTo();
            NotesPage.SelectNote(NoteCreator.PreviousTitle);

            Driver.Wait(TimeSpan.FromSeconds(1));

            Assert.IsTrue(NewNotePage.IsInUpgradeMode(), "Wasn't in upgrade mode");
            Assert.AreEqual(NoteCreator.PreviousTitle, NotesPage.Title, "Title din not match");
        }
        public MainPage()
        {
            this.InitializeComponent();
            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            Instance     = this;
            FolderPath   = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData));
            notesPage    = new Notes.UWP.Views.NotesPage();
            this.Content = notesPage.CreateFrameworkElement();

            this.Loaded += OnMainPageLoaded;
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
        }
示例#9
0
        public MainPage()
        {
            this.NavigationCacheMode = NavigationCacheMode.Enabled;

            Instance   = this;
            FolderPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData));
            notesPage  = new Notes.UWP.Views.NotesPage
            {
                // Set the parent so that the app-level resource dictionary can be located.
                Parent = Xamarin.Forms.Application.Current
            };
            this.Content = notesPage.CreateFrameworkElement();

            this.Loaded += OnMainPageLoaded;
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;

            notesPage.Parent = null;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Forms.Init(this, bundle);

            // Create app-level resource dictionary.
            Xamarin.Forms.Application.Current           = new Xamarin.Forms.Application();
            Xamarin.Forms.Application.Current.Resources = new MyDictionary();

            Instance = this;

            SetContentView(Resource.Layout.Main);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Notes";

            FolderPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData));

            NotesPage notesPage = new NotesPage()
            {
                // Set the parent so that the app-level resource dictionary can be located.
                Parent = Xamarin.Forms.Application.Current
            };

            AndroidX.Fragment.App.Fragment notesPageFragment = notesPage.CreateSupportFragment(this);

            SupportFragmentManager
            .BeginTransaction()
            .Replace(Resource.Id.fragment_frame_layout, notesPageFragment)
            .Commit();

            SupportFragmentManager.BackStackChanged += (sender, e) =>
            {
                bool hasBack = SupportFragmentManager.BackStackEntryCount > 0;
                SupportActionBar.SetHomeButtonEnabled(hasBack);
                SupportActionBar.SetDisplayHomeAsUpEnabled(hasBack);
                SupportActionBar.Title = hasBack ? "Note Entry" : "Notes";
            };

            notesPage.Parent = null;
        }
示例#11
0
        public void AddNoteToNotes()
        {
            HelperSet.HelperMethodAddWorkflow();

            var workFlownav = new WorkFlowPageNavigation(Driver);
            var notes       = new NotesPage(Driver);
            var closingRep  = new ClosingFilesRepository(DbConn);
            var comment     = DateTime.Now.ToString();

            workFlownav
            .GoToWorkFlowPage()
            .GoToAppropriateClosingFile()
            .ClickNotesMenuItem();

            notes
            .WriteAComment(comment)
            .ClickOnSaveCommentButton();

            Assert.IsTrue(notes.CheckThatCommentIsCreated(comment));
        }
        public void AddedNotesShowUp()
        {
            //Go to notes, get notes count, store
            LeftNavigation.Notes.Select();
            NotesPage.StoreCount();

            //Add a new note
            NoteCreator.CreateNote();

            //Go to Notes, get new note count
            LeftNavigation.Notes.Select();
            Assert.AreEqual(NotesPage.PreviousNoteCount + 1, NotesPage.CurrentNoteCount, "Count of notes did not increase");

            //Check for added note
            Assert.IsTrue(NotesPage.DoesNoteExistWithTitle(NoteCreator.PreviousTitle));

            //Trash note (clean up)
            NotesPage.TrashNote(NoteCreator.PreviousTitle);
            Assert.AreEqual(NotesPage.PreviousNoteCount, NotesPage.CurrentNoteCount, "Coundn't trah note");
        }
示例#13
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            Forms.Init();

            Instance = this;
            _window  = new UIWindow(UIScreen.MainScreen.Bounds);

            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes
            {
                TextColor = UIColor.Black
            });

            FolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
            UIViewController mainPage = new NotesPage().CreateViewController();

            mainPage.Title = "Notes";

            _navigation = new UINavigationController(mainPage);
            _window.RootViewController = _navigation;
            _window.MakeKeyAndVisible();

            return(true);
        }
 public NotesPageNoteWindow(NotesPage parent, Note note = null)
 {
     this.parent = parent;
     this.note   = note;
     this.Title  = "Note";
     InitializeComponent();
     textDeadline.DisplayDateStart = DateTime.Now;
     comboSubject.ItemsSource      = parent.GetSubjects();
     button_cancel.Click          += Button_cancel_Click;
     if (note == null)
     {
         textName.Text      = textNamePlaceholder;
         textName.GotFocus += TextTitle_GotFocus;
         button_add.Click  += Button_add_Click;
     }
     else
     {
         textName.Text             = note.Name;
         textDeadline.Text         = note.Deadline.ToShortDateString();
         comboSubject.SelectedItem = note.SubjectID;
         textMaterials.AppendText(note.Materials);
         button_add.Click += Button_add_Click_Modify;
     }
 }
示例#15
0
 private void Initialize()
 {
     DependencyService.Register <IdentifiablesDataStore <Note> >();
     MainPage = new NotesPage();
 }
示例#16
0
        public App()
        {
            InitializeComponent();

            MainPage = new NotesPage();
        }
示例#17
0
        public async void HandleImageFromFilePicker(IReadOnlyList <StorageFile> files)
        {
            NotesPage.EnablePopupLightDismiss();

            if (files == null || files.Count <= 0)
            {
                return;
            }
            bool error = false;

            try
            {
                //delete old images
                //await AppData.RemoveNoteImages(Note.Images);

                //clear image list
                //Note.Images.Clear();

                //add new images
                foreach (var file in files)
                {
                    if (file == null)
                    {
                        continue;
                    }
                    Debug.WriteLine("Picked photo: " + file.Path);

                    NoteImage noteImage = new NoteImage();

                    StorageFile savedImage = await AppSettings.Instance.SaveImage(file, Note.ID, noteImage.ID);

                    var imageProperties = await savedImage.Properties.GetImagePropertiesAsync();

                    noteImage.NoteId = Note.ID;
                    noteImage.URL    = savedImage.Path;
                    noteImage.Width  = imageProperties.Width;
                    noteImage.Height = imageProperties.Height;

                    Note.Images.Add(noteImage);
                    break;
                }

                //Note.NotifyPropertyChanged("Images");
            }
            catch (Exception e)
            {
                error = true;

                var exceptionProperties = new Dictionary <string, string>()
                {
                    { "Details", "Failed to save images" }
                };

                var exceptionMetrics = new Dictionary <string, double>();
                exceptionMetrics.Add("Image count", Note.Images.Count);
                for (int i = 0; i < Note.Images.Count; i++)
                {
                    exceptionMetrics.Add(string.Format("Image[{0}] Width", i), Note.Images[i].Width);
                    exceptionMetrics.Add(string.Format("Image[{0}] Height", i), Note.Images[i].Height);
                }

                App.TelemetryClient.TrackException(e, exceptionProperties, exceptionMetrics);
            }

            if (error)
            {
                //await(new MessageDialog("Failed to save image. Try again.", "Sorry")).ShowAsync();
                return;
            }

            // update note with new image so we dont lose it if the user closes the app
            if (!IsNewNote && !Note.IsEmpty())
            {
                try
                {
                    bool success = await AppData.CreateOrUpdateNote(Note);

                    if (success)
                    {
                        IsNewNote = false;
                    }
                } catch (Exception e) { }
            }
        }