Skip to content

Instantly share code, notes, and snippets.

@andy51002000
andy51002000 / nodejs_installer.ps1
Created August 16, 2017 06:48 — forked from nweldev/nodejs_installer.ps1
Powershell script installing nodejs (with git) and some npm packages
write-host "`n ## NODEJS INSTALLER ## `n"
### CONFIGURATION
# nodejs
$version = "4.4.7-x64"
$url = "https://nodejs.org/dist/latest-v4.x/node-v$version.msi"
# git
$git_version = "2.9.2"
@andy51002000
andy51002000 / nodejs_installer.ps1
Created August 16, 2017 06:48 — forked from nweldev/nodejs_installer.ps1
Powershell script installing nodejs (with git) and some npm packages
write-host "`n ## NODEJS INSTALLER ## `n"
### CONFIGURATION
# nodejs
$version = "4.4.7-x64"
$url = "https://nodejs.org/dist/latest-v4.x/node-v$version.msi"
# git
$git_version = "2.9.2"
@andy51002000
andy51002000 / nodejs_installer.ps1
Created August 16, 2017 06:48 — forked from nweldev/nodejs_installer.ps1
Powershell script installing nodejs (with git) and some npm packages
write-host "`n ## NODEJS INSTALLER ## `n"
### CONFIGURATION
# nodejs
$version = "4.4.7-x64"
$url = "https://nodejs.org/dist/latest-v4.x/node-v$version.msi"
# git
$git_version = "2.9.2"
@andy51002000
andy51002000 / Movie.cs
Created October 21, 2017 08:24
MVVM Model
using System.ComponentModel;
namespace SimpleMVVM.Models
{
public class Movie:INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propertyName)
{
@andy51002000
andy51002000 / FakeDatabase.cs
Created October 21, 2017 08:27
FakeDatabase that simulate database to do CRUD
using SimpleMVVM.Models;
using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Linq;
using Windows.Storage;
namespace SimpleMVVM.Data
{
@andy51002000
andy51002000 / ViewModelBase.cs
Created October 21, 2017 08:42
Base class for all ViewModel that implements INotifyPropertyChanged
using System.ComponentModel;
namespace SimpleMVVM.ViewModels
{
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string propertyName)
{
@andy51002000
andy51002000 / ViewModelLocator.cs
Last active October 21, 2017 09:52
A class that provides the instance of ViewModel and inject db context into ViewModel
using SimpleMVVM.Data;
using System.Collections.Generic;
namespace SimpleMVVM.ViewModels
{
public class ViewModelLocator
{
private Dictionary<string, ViewModelBase> modSet;
private FakeDatabase dbContext;
@andy51002000
andy51002000 / MovieListView.xaml
Last active October 21, 2017 10:08
Present Movies List. Click Button "Clear" will delete all data from view and database
<Page
x:Class="SimpleMVVM.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SimpleMVVM"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
DataContext="{Binding Source= {StaticResource ViewModelLocator}, Path=MovieListViewModel}"
>
@andy51002000
andy51002000 / MovieListViewModel.cs
Last active October 22, 2017 10:17
This class is responsible for providing proper data to view in MVVM, such as the collection of movies, ..
using SimpleMVVM.Common;
using SimpleMVVM.Data;
using SimpleMVVM.Models;
using System;
using System.Collections.ObjectModel;
using System.Windows.Input;
namespace SimpleMVVM.ViewModels
{
public class MovieListViewModel : ViewModelBase
@andy51002000
andy51002000 / App.xaml
Created October 21, 2017 10:29
Modify App.xaml and add ViewModelLocator
<Application
x:Class="SimpleMVVM.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SimpleMVVM"
RequestedTheme="Dark"
xmlns:vm="using:SimpleMVVM.ViewModels">
<Application.Resources>
<ResourceDictionary>