Example #1
0
        private void ImportFoldersInDirectory(TreeNode node, XmlNode directoryNode, string[] folders)
        {
            if (directoryNode.Name == "Directory")
            {
                bool mustExpand = (node.Nodes.Count == 0);

                CurrentTreeView.SuspendLayout();

                WixFiles.UndoManager.BeginNewCommandRange();
                try
                {
                    DirectoryImport dirImport = new DirectoryImport(WixFiles, folders, directoryNode);
                    dirImport.Import(node);
                }
                catch (WixEditException ex)
                {
                    MessageBox.Show(String.Format("Failed to complete import: {0}\r\n\r\nThe import is aborted and could be partially completed.", ex.Message), "Import Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    ErrorReportHandler r = new ErrorReportHandler(ex, this.TopLevelControl, "An exception occured during the import! Please press OK to report this error to the WixEdit website, so this error can be fixed.");
                    r.ReportInSeparateThread();
                }

                CurrentTreeView.ResumeLayout();
            }
        }
        /// <summary>
        /// Handles the Load event of the ErrorHandlerForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        /// <remarks>Documented by Dev07, 2009-07-15</remarks>
        private void ErrorHandlerForm_Load(object sender, EventArgs e)
        {
            this.Height = NotExpandedSize;

            // Load the appropriate text in the header
            if (Fatal)
            {
                labelErrorOccuredInformationMessage.Text = Resources.ERROR_OCCURED_INFORMATION_MESSAGE_FATAL;
            }
            else
            {
                labelErrorOccuredInformationMessage.Text = Resources.ERROR_OCCURED_INFORMATION_MESSAGE_NOT_FATAL;
            }

            //restart MemoryLifter
            checkBoxRestartMemoryLifter.Checked = Fatal;

            // Load the zip file and display the content in the list view
            using (Stream stream = report.Open(FileMode.Open))
            {
                if (stream != null)
                {
                    foreach (ZipEntry i in GetZipContent(stream))
                    {
                        ListViewItem listViewItem = new ListViewItem();
                        listViewItem.Tag         = i.Name;
                        listViewItem.ToolTipText = i.Name;
                        listViewItem.Text        = string.Format("{0} ({1:0.0} KB)", i.Name, i.Size / 1024D);
                        listViewItem.Checked     = i.Name.StartsWith("ErrorReport.") ? true : false;
                        listViewFiles.Items.Add(listViewItem);
                    }
                }
            }

            errorReportHandler = new ErrorReportHandler(report);
            try
            {
                labelErrorMessage.Text = errorReportHandler.GetValue(Resources.ERRORREPORTPATH_MESSAGE);
            }
            catch (Exception exp)
            {
                Trace.WriteLine("Reading error data from ErrorReport Exception: " + exp.ToString());
            }
        }