Ejemplo n.º 1
0
        public SitesViewModel(ISiteDataService siteDataService, IConfigurationService configurationService)
        {
            _siteDataService = siteDataService;
            _configurationService = configurationService;

            _siteDataService.PropertyChanged += (s,e) => {
                if (e.PropertyName == "Sites")
                {
                    this.SiteFilter = String.Empty;
                    this.SelectedSite = this.Sites.FirstOrDefault();
                }
            };

            this.LoadNgrokInspector = new RelayCommand(() => {
                Process.Start("http://localhost:4040/");
            });

            this.RunNgrokCommand = new RelayCommand(() => {

                Process p = new Process();
                p.StartInfo = new ProcessStartInfo( "cmd.exe" ) 
                    {
                        Arguments = string.Format("/k \"{0}\" http -subdomain={1} {2}", Path.Combine(_configurationService.ApplicationConfiguration.NgrokExecutablePath, "ngrok.exe"), this.SelectedSite.Subdomain, this.SelectedSite.LocalhostPort),
                        UseShellExecute = true,
                        WindowStyle = ProcessWindowStyle.Normal
                    };
                p.Start();

            });

            this.SiteFilter = String.Empty;
        }
Ejemplo n.º 2
0
        public SitesViewModel(ISiteDataService siteDataService, IConfigurationService configurationService)
        {
            _siteDataService      = siteDataService;
            _configurationService = configurationService;

            _siteDataService.PropertyChanged += (s, e) => {
                if (e.PropertyName == "Sites")
                {
                    this.SiteFilter   = String.Empty;
                    this.SelectedSite = this.Sites.FirstOrDefault();
                }
            };

            this.LoadNgrokInspector = new RelayCommand(() => {
                Process.Start("http://localhost:4040/");
            });

            this.RunNgrokCommand = new RelayCommand(() => {
                Process p   = new Process();
                p.StartInfo = new ProcessStartInfo("cmd.exe")
                {
                    Arguments       = string.Format("/k \"{0}\" http -subdomain={1} {2}", Path.Combine(_configurationService.ApplicationConfiguration.NgrokExecutablePath, "ngrok.exe"), this.SelectedSite.Subdomain, this.SelectedSite.LocalhostPort),
                    UseShellExecute = true,
                    WindowStyle     = ProcessWindowStyle.Normal
                };
                p.Start();
            });

            this.SiteFilter = String.Empty;
        }
Ejemplo n.º 3
0
        public SiteDataController(ISiteDataService service, IMapper mapper)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }
            if (mapper == null)
            {
                throw new ArgumentNullException(nameof(mapper));
            }

            _service = service;
            _mapper  = mapper;
        }