public void AddDependency()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
            fileDialog.FileName         = "";
            fileDialog.RestoreDirectory = true;
            fileDialog.Filter           = "MSI Merge Modules (*.msm)|*.msm";
            fileDialog.Multiselect      = true;
            if (fileDialog.ShowDialog() == true)
            {
                foreach (var fileName in fileDialog.FileNames)
                {
                    try
                    {
                        var             iswixDependency = new IsWiXDependency(fileName);
                        DependencyModel dependency      = new DependencyModel();
                        dependency.RequiredId       = iswixDependency.RequiredId;
                        dependency.RequiredLanguage = iswixDependency.RequiredLanguage;
                        dependency.RequiredVersion  = iswixDependency.RequiredVersion;
                        _iswixDependencies.Add(iswixDependency);
                        if (!Dependencies.Contains(dependency))
                        {
                            Dependencies.Add(dependency);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
Beispiel #2
0
        public void Dependencies_RowAddRemove(object sender, DataRowChangeEventArgs e)
        {
            var dependency = new IsWiXDependency(
                e.Row["RequiredId"].ToString(),
                e.Row["RequiredLanguage"].ToString(),
                e.Row["RequiredVersion"].ToString()
                );

            switch (e.Action)
            {
            case DataRowAction.Add:
                _dependencies.Add(dependency);
                break;

            case DataRowAction.Delete:
                _dependencies.Remove(dependency);
                break;
            }
        }