// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace VisualPascalABC
{
///
/// Description of ReferenceForm.
///
public partial class ReferenceForm : Form
{
public ReferenceForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
private static ReferenceForm instance;
public static ReferenceForm Instance
{
get
{
if (instance == null)
{
instance = new ReferenceForm();
Form1StringResources.SetTextForAllControls(instance);
}
return instance;
}
}
private List assembly_files = new List();
public bool fromFile = false;
private AssemblyType assemblyType = AssemblyType.GAC;
public AssemblyType AssemblyType
{
get
{
if (assemblyType == AssemblyType.File)
return assemblyType;
if (lvGac.SelectedItems.Count > 0)
return AssemblyType.GAC;
//if (lvCom.SelectedItems.Count > 0)
// return AssemblyType.COM;
return AssemblyType.GAC;
}
}
public void LoadAssemblies()
{
lvGac.Items.AddRange(GetCacheContent().ToArray());
}
public void Clear()
{
assembly_files.Clear();
assemblyType = AssemblyType.GAC;
lvGac.Items.Clear();
//lvCom.Items.Clear();
}
public string[] GetSelectedGACAssemblies()
{
List lst = new List();
for (int i=0; i lst = new List();
/*for (int i=0; i GetCacheContent()
{
List itemList = new List();
foreach (GacInterop.AssemblyListEntry asm in GacInterop.GetAssemblyList()) {
ListViewItem item = new ListViewItem(new string[] {asm.Name, asm.Version});
item.Tag = asm.FullName;
itemList.Add(item);
}
return itemList;
}
void Button1Click(object sender, EventArgs e)
{
openFileDialog1.InitialDirectory = ProjectFactory.Instance.ProjectDirectory;
openFileDialog1.Filter = VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.GetAssemblyFilterForDialogs();
openFileDialog1.ShowDialog();
}
void OpenFileDialog1FileOk(object sender, System.ComponentModel.CancelEventArgs e)
{
foreach (string s in openFileDialog1.FileNames)
{
assembly_files.Add(s);
}
assemblyType = AssemblyType.File;
DialogResult = DialogResult.OK;
Close();
}
private bool com_page_populated = false;
void LvComVisibleChanged(object sender, EventArgs e)
{
/*if (com_page_populated == false && lvCom.Visible) {
com_page_populated = true;
PopulateListView();
}*/
}
void PopulateListView()
{
IEnumerable types = TypeLibrary.Libraries;
List sort_types = new List();
sort_types.AddRange(types);
sort_types.Sort(TypeLibrary.Comparer);
foreach (TypeLibrary typeLib in sort_types) {
ListViewItem newItem = new ListViewItem(new string[] { typeLib.Description, typeLib.Path });
newItem.Tag = typeLib;
//lvCom.Items.Add(newItem);
}
}
}
}