Exemple #1
0
        private void editHost(HostViewModel host)
        {
            if (host.Model.Link.Status != ELinkStatus.Stopped)
            {
                return;
            }

            var hd = new HostDialog(HostDialog.EMode.EditHost, _hostsManager.HostInfoList)
            {
                Host = host.Model.Info
            };
            var res = hd.ShowDialog(this);

            if (res == DialogResult.Cancel)
            {
                return;
            }

            var dependentHosts =
                _hostsManager.Hosts.Cast <ObjectView <HostViewModel> >().Select(ov => ov.Object).
                Where(m => m.Model.Info.DependsOn == host.Model.Info);

            foreach (var index in dependentHosts.Select(dependentHost => _bindingSource.IndexOf(dependentHost)))
            {
                _bindingSource.ResetItem(index);
            }

            updateHost(host);
            Modified = true;
        }
Exemple #2
0
        private void addHost()
        {
            var hd = new HostDialog(HostDialog.EMode.AddHost, _hostsManager.HostInfoList)
            {
                StartupDependsOn = selectedHostInfo()
            };

            hd.ShowDialog(this);
            foreach (var host in hd.CreatedHosts)
            {
                var hvm = _hostsManager.AddHost(host);
                hvm.StatusChanged += onHostStatusChanged;
            }
            if (hd.CreatedHosts.Length > 0)
            {
                Modified = true;
            }
        }
Exemple #3
0
        private void editHost(HostViewModel host)
        {
            var oldName = host.Name;
            var hd      = new HostDialog(HostDialog.EMode.EditHost, _hostsManager.HostInfoList)
            {
                Host = host.Model.Info
            };
            var res = hd.ShowDialog(this);

            if (res == DialogResult.Cancel)
            {
                return;
            }

            if (Settings.Default.HostsBeingStartedOnLastTime?.Contains(oldName) == true)
            {
                Settings.Default.HostsBeingStartedOnLastTime.Remove(oldName);
                Settings.Default.Save();
            }
            if (host.Model.Link.Status != ELinkStatus.Stopped)
            {
                stopHost(host);
            }

            var dependentHosts =
                _hostsManager.Hosts.Cast <ObjectView <HostViewModel> >().Select(ov => ov.Object).
                Where(m => m.Model.Info.DependsOn == host.Model.Info);

            foreach (var index in dependentHosts.Select(dependentHost => _bindingSource.IndexOf(dependentHost)))
            {
                _bindingSource.ResetItem(index);
            }

            updateHost(host);
            Modified = true;
        }
        private void editHost(HostViewModel host)
        {
            if (host.Model.Link.Status != ELinkStatus.Stopped)
                return;

            var hd = new HostDialog(HostDialog.EMode.EditHost, _hostsManager.HostInfoList) {Host = host.Model.Info};
            var res = hd.ShowDialog(this);
            if (res == DialogResult.Cancel)
            {
                return;
            }

            var dependentHosts =
                _hostsManager.Hosts.Cast<ObjectView<HostViewModel>>().Select(ov => ov.Object).
                Where(m => m.Model.Info.DependsOn == host.Model.Info);
            foreach (var index in dependentHosts.Select(dependentHost => _bindingSource.IndexOf(dependentHost)))
            {
                _bindingSource.ResetItem(index);
            }

            updateHost(host);
            Modified = true;
        }
 private void addHost()
 {
     var hd = new HostDialog(HostDialog.EMode.AddHost, _hostsManager.HostInfoList)
                  {
                      StartupDependsOn = selectedHostInfo()
                  };
     hd.ShowDialog(this);
     foreach (var host in hd.CreatedHosts)
     {
         var hvm = _hostsManager.AddHost(host);
         hvm.StatusChanged += onHostStatusChanged;
     }
     if (hd.CreatedHosts.Length > 0)
     {
         Modified = true;
     }
 }