/// <summary>
        /// Creates a Preview item using the given notepad view model
        /// </summary>
        /// <param name="notepad"></param>
        /// <returns></returns>
        public WindowPreviewControlViewModel CreatePreviewControlFromDataContext(NotepadViewModel notepad)
        {
            WindowPreviewControlViewModel winPrev = new WindowPreviewControlViewModel(notepad);

            SetupPreviewControlCallbacks(winPrev);
            return(winPrev);
        }
Beispiel #2
0
        public ActionResult Bold()
        {
            NotepadViewModel notepadViewModel = new NotepadViewModel();

            notepadViewModel.boolCommand = "font-weight:bold";
            return(View("Index", notepadViewModel));
        }
        public Notepad()
        {
            InitializeComponent();

            BindingContext = viewModel = new NotepadViewModel();
            observeViewModel();
        }
        /// <summary>
        /// Creates and shows a Notepad Window using the given view model.
        /// </summary>
        /// <param name="notepad"></param>
        public void CreateAndShowWindowFromViewModel(NotepadViewModel notepad)
        {
            notepad.SetupInformationHook();
            NotepadWindow window = CreateWindowFromViewModel(notepad);

            AddNewNotepadAndPreviewWindowFromWindow(window);
        }
        /// <summary>
        /// Creates a Notepad window using the given view model as it's DataContext
        /// </summary>
        /// <param name="notepad"></param>
        /// <returns></returns>
        public NotepadWindow CreateWindowFromViewModel(NotepadViewModel notepad)
        {
            NotepadWindow window = new NotepadWindow();

            window.Notepad = notepad;
            SetupNotepadWindow(window);
            return(window);
        }
Beispiel #6
0
        public ActionResult Underline()
        {
            NotepadViewModel notepadViewModel = new NotepadViewModel();

            notepadViewModel.underlineCommand = "text-decoration:underline";
            ViewBag.x = notepadViewModel.underlineCommand;
            return(View("Index"));
        }
        public void FocusWindowFromDataContext(NotepadViewModel notepad)
        {
            NotepadWindow win = WindowManager.GetNotepadWindowFromNotepad(notepad);

            if (win != null)
            {
                win.Focus();
            }
        }
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            DataContext = new NotepadViewModel(new WP8FileStorage());

            ///Sample code to call helper function to localize the ApplicationBar
            //BuildApplicationBar();
        }
Beispiel #9
0
        public IActionResult Index()
        {
            NotepadViewModel notepadViewModel = new NotepadViewModel();

            notepadViewModel.Title = Defines.TXT_FILENAME;
            System.Net.WebClient client = new System.Net.WebClient();
            notepadViewModel.Content = client.DownloadString(Defines.TXT_CONTENT_URL);
            return(View(notepadViewModel));
        }
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            DataContext = new NotepadViewModel(new WP8FileStorage());

            ///Sample code to call helper function to localize the ApplicationBar
            //BuildApplicationBar();
        }
        public async Task <IActionResult> Index()
        {
            IEnumerable <NotepadItem> items = await itemService.GetIncompleteItemsAsync();

            NotepadViewModel notepadViewModel = new NotepadViewModel();

            notepadViewModel.Items = items;
            return(View(notepadViewModel));
        }
Beispiel #12
0
        private WindowHistoryControlViewModel CreateHistoryItem(NotepadViewModel notepad)
        {
            WindowHistoryControlViewModel hc = new WindowHistoryControlViewModel()
            {
                ReopenNotepadCallback = UserReopenNotepad,
                Notepad = notepad
            };

            return(hc);
        }
 public void FullyCloseWindowFromDataContext(NotepadViewModel notepad)
 {
     if (notepad != null)
     {
         WindowPreviewControlViewModel wpc = GetPreviewControlFromNotepad(notepad);
         if (wpc != null)
         {
             CloseWindowAndRemovePreviewFromPreview(wpc);
         }
     }
 }
Beispiel #14
0
        /// <summary>
        /// Gets a Notepad window from a view model
        /// </summary>
        /// <param name="notepad"></param>
        /// <returns>null if there's no windows with the given viewmodel. else returns the Notepad window</returns>
        public static NotepadWindow GetNotepadWindowFromNotepad(NotepadViewModel notepad)
        {
            foreach (NotepadWindow window in NotepadWindows)
            {
                if (window.Notepad == notepad)
                {
                    return(window);
                }
            }

            return(null);
        }
        /// <summary>
        /// Gets a preview view model using a Notepad window's view model
        /// </summary>
        /// <param name="notepad"></param>
        /// <returns>null if there's no windows with the given viewmodel. else returns the preview</returns>
        public WindowPreviewControlViewModel GetPreviewControlFromNotepad(NotepadViewModel notepad)
        {
            foreach (WindowPreviewControlViewModel wpcvm in WindowPreviews)
            {
                if (wpcvm.Notepad == notepad)
                {
                    return(wpcvm);
                }
            }

            return(null);
        }
        public static void SaveAllUnclosedFilesToStorageLocation(NotepadWindow window)
        {
            NotepadViewModel model = window.Notepad;

            foreach (NotepadItemViewModel item in model.NotepadItems)
            {
                TextDocumentViewModel doc = item.Notepad;

                if (!doc.Document.Text.IsEmpty() && doc.HasMadeChanges)
                {
                    if (CheckUnclosedStorageDirectoryExistsElseCreateIt())
                    {
                        WriteFileToUnclosedStorageLocation(doc.Document.FileName, doc.Document.Text);
                    }
                }
            }
        }
Beispiel #17
0
        /// <summary>
        /// Pushes a Notepad View's DataContext (that has just closed) to the history
        /// </summary>
        /// <param name="path"></param>
        public void PushNotepad(NotepadViewModel notepad)
        {
            WindowHistoryControlViewModel item = CreateHistoryItem(notepad);

            Push(item);
        }
 public static void CloseWindowFromDataContext(NotepadViewModel notepad)
 {
     Information.Show("Closing a window", "Windows");
     App.FullyCloseWindowFromDataContext(notepad);
 }
Beispiel #19
0
 public NotepadView()
 {
     this.InitializeComponent();
     ViewModel = new NotepadViewModel();
 }