Пример #1
0
 public CreateHostPage()
 {
     InitializeComponent();
     back.Content  = Data.Language.Hardcoded.GetValue("back");
     save.Content  = Data.Language.Hardcoded.GetValue("save");
     hostViewModel = new NewHostViewModel
     {
         Title      = Data.Language.Hardcoded.GetValue("+ New host"),
         From       = _parent,
         AddCommand = new DelegateCommand <NewHostViewModel>(vm =>
         {
             if (!vm.IsValid())
             {
                 MessageBox.Show(vm.Error);
                 return;
             }
             if (vm.Domain == vm.DomainPlaceholder)
             {
                 MessageBox.Show(Data.Language.Hardcoded.GetValue("Domain is required"));
                 return;
             }
             else if (vm.IP == vm.IpPlaceholder)
             {
                 MessageBox.Show(Data.Language.Hardcoded.GetValue("IP is required"));
                 return;
             }
             WindowsHost.AddOrUpdate(vm.Domain, vm.IP);
             this.Redirect(new HostPage());
         })
     };
     DataContext = hostViewModel;
 }
Пример #2
0
 public NewHost(NewHostViewModel vm)
 {
     vm.Navigation  = Navigation;
     BindingContext = vm;
     InitializeComponent();
 }