public MainForm() { m_versions = new VersionStorage(); m_client = new ClientImpl(); m_client.ClientLoaded += new EventHandler(ClientLoaded_Handler); m_client.ProgressChanged += new ProgressHandler(ClientProgressChanged_Handler); m_worker = new BackgroundWorker(); m_worker.WorkerReportsProgress = true; m_worker.DoWork += new DoWorkEventHandler(DoWork_Handler); m_worker.ProgressChanged += new ProgressChangedEventHandler(ProgressChanged_Handler); m_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RunWorkerCompleted_Handler); InitializeComponent(); LoadVersions(); obdVersionComboBox.Items.Add(ObdVersion.Version1); obdVersionComboBox.Items.Add(ObdVersion.Version2); obdVersionComboBox.SelectedIndex = 0; itemsListBox.Client = m_client; outfitsListBox.Client = m_client; effectsListBox.Client = m_client; missilesListBox.Client = m_client; thingTypeListBox.Client = m_client; saveButton.Enabled = false; }
public MainForm() { this.versions = new VersionStorage(); this.client = new ClientImpl(); this.client.ClientLoaded += new EventHandler(this.ClientLoaded_Handler); this.client.ProgressChanged += new ProgressHandler(this.ClientProgressChanged_Handler); this.worker = new BackgroundWorker(); this.worker.WorkerReportsProgress = true; this.worker.DoWork += new DoWorkEventHandler(this.DoWork_Handler); this.worker.ProgressChanged += new ProgressChangedEventHandler(this.ProgressChanged_Handler); this.worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.RunWorkerCompleted_Handler); this.InitializeComponent(); this.LoadVersions(); this.itemsListBox.Client = this.client; this.outfitsListBox.Client = this.client; this.effectsListBox.Client = this.client; this.missilesListBox.Client = this.client; this.thingTypeListBox.Client = this.client; this.saveButton.Enabled = false; }
private void LoadButton_Click(object sender, EventArgs e) { string directory = Path.Combine(PathUtils.ApplicationDirectory, "Input"); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } if (this.client != null) { this.client.Dispose(); this.client = null; } OpenTibia.Core.Version version = (OpenTibia.Core.Version)this.inputVersionComboBox.SelectedItem; string datPath = Path.Combine(directory, "Tibia.dat"); string sprPath = Path.Combine(directory, "Tibia.spr"); try { this.client = new ClientImpl(); this.client.ClientLoaded += new EventHandler(this.ClientLoaded_Handler); this.client.ProgressChanged += new ProgressHandler(this.ClientProgress_Handler); this.client.ClientCompiled += new EventHandler(this.ClientCompiled_Handler); this.client.Load(datPath, sprPath, version); } catch (Exception ex) { MessageBox.Show("Selected client: " + version + ".\n\n" + ex.Message); Application.Exit(); } }