public void Read(IsWiXService service) { _serviceInstall = service.ServiceInstall; _serviceControl = service.ServiceControl; Name = _serviceInstall.Name; if (_serviceInstall.Name != _serviceControl.Name) { _serviceControl.Name = _serviceInstall.Name; } DisplayName = _serviceInstall.DisplayName; Description = _serviceInstall.Description; EraseDescription = _serviceInstall.EraseDescription; Arguments = _serviceInstall.Arguments; Type = _serviceInstall.Type; Startup = _serviceInstall.Start; ErrorControl = _serviceInstall.ErrorControl; Account = _serviceInstall.Account; Password = _serviceInstall.Password; LoadOrderGroup = _serviceInstall.LoadOrderGroup; Interactive = _serviceInstall.Interactive; Vital = _serviceInstall.Vital; Start = _serviceControl.Start; Stop = _serviceControl.Stop; Remove = _serviceControl.Remove; Wait = _serviceControl.Wait; }
private void createNewFolderToolStripMenuItem1_Click(object sender, EventArgs e) { ComponentPicker picker = new ComponentPicker(_services); picker.StartPosition = FormStartPosition.CenterParent; DialogResult dr = picker.ShowDialog(); if (dr != DialogResult.Cancel) { string fileKey = picker.FileKey; if (!string.IsNullOrEmpty(fileKey)) { string prefix = picker.FileName; int index = 0; bool added = false; do { index++; bool exists = false; foreach (var existingService in _services) { string name = string.Format("{0}{1}", prefix, index); if (existingService.ServiceInstall.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) { exists = true; break; } } if (exists == false) { string name = string.Format("{0}{1}", prefix, index); if (index == 1) { foreach (var existingService in _services) { if (existingService.ServiceInstall.Name.Equals(prefix, StringComparison.InvariantCultureIgnoreCase)) { exists = true; break; } } if (exists == false) { name = prefix; } } IsWiXService service = _services.Create(name, fileKey); AddServiceNode(service); added = true; } }while (added == false); } } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { IsWiXService service = treeViewServices.SelectedNode.Tag as IsWiXService; service.ServiceControl.Delete(); service.ServiceInstall.Delete(); treeViewServices.SelectedNode.Remove(); treeViewServices.SelectedNode = treeViewServices.Nodes[0]; }
private void UpdatedSelectedNodeText() { IsWiXService service = treeViewServices.SelectedNode.Tag as IsWiXService; if (service != null) { treeViewServices.SelectedNode.Text = CalculateSelectedNodeText(service); } }
private void AddServiceNode(IsWiXService iswixService) { var subTreeNode = treeViewServices.Nodes[0].Nodes.Add(CalculateSelectedNodeText(iswixService)); subTreeNode.ImageIndex = (int)ImageLibrary.Services; subTreeNode.SelectedImageIndex = (int)ImageLibrary.Services; subTreeNode.Tag = iswixService; //subTreeNode.ToolTipText = iswixService.ServiceInstall.ParentComponentXML.ToString(); treeViewServices.ExpandAll(); var parentNode = treeViewServices.Nodes[0]; if (parentNode.Nodes.Count > 0) { treeViewServices.SelectedNode = parentNode.Nodes[0]; } else { treeViewServices.SelectedNode = parentNode; } treeViewServices.Select(); UpdatedSelectedNodeText(); }
private string CalculateSelectedNodeText(IsWiXService service) { return(string.Format("{0} ({1})", service.ServiceInstall.Name, service.ServiceInstall.DestinationFilePath)); }