public void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "ColumnsNumber");
            DataTransferUnit.AppendNode("Data", "RowsNumber");
            DataTransferUnit.AppendNode("Data", "TableWidth");
            DataTransferUnit.AppendNode("Data", "TableWidthUnit");
            DataTransferUnit.AppendNode("Data", "TableHeight");
            DataTransferUnit.AppendNode("Data", "TableHeightUnit");
            DataTransferUnit.AppendNode("Data", "BorderPixels");
            DataTransferUnit.AppendNode("Data", "MarginPixels");
            DataTransferUnit.AppendNode("Data", "InnerMarginPixels");
            DataTransferUnit.AppendNode("Data", "TableJustify");
            DataTransferUnit.AppendNode("Data", "TableColor");
            DataTransferUnit.AppendNode("Data", "TableTitle");
            DataTransferUnit.AppendNode("Data", "TableTitleLocation");

            tableWidthUnitComboBox.Text = "% от размера окна";
            tableHeightUnitComboBox.Text = "пикселов";
            tableJustifyComboBox.Text = "влево";
            tableColorButton.BackColor = Color.FromArgb(255, 255, 255);
            tableTitleLocationComboBox.Text = "по центру";
            HelpKeyword = "Таблица";
            columnsNumberUpDown.Select();
        }
        private void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "NeverShowAgain");

            Text = Application.ProductName;
        }
        public void InitializeDialog()
        {
            this.DataTransferUnit = new XmlHelper();
            this.DataTransferUnit.AppendNode(string.Empty, "Data");
            this.DataTransferUnit.AppendNode("Data", "Source");
            this.DataTransferUnit.AppendNode("Data", "LinkText");

            this.HelpKeyword = "Добавить стрим";
        }
        private void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "LowerBound");

            HelpKeyword = "Компетенция";
            lowerBoundUpDown.Select();
        }
        public void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "Source");
            DataTransferUnit.AppendNode("Data", "LinkText");

            HelpKeyword = "Видео";
            sourceButton.Select();
        }
        public void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "BookmarkName");

            FillBookmarksTree();
            HelpKeyword = "Закладка";
            bookmarkNameTextBox.Select();
        }
        public void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "ConceptName");
            DataTransferUnit.AppendNode("Data", "ConceptType");

            HelpKeyword = "Компетенция";
            conceptNameTextBox.Select();
        }
        private void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "StyleName");
            DataTransferUnit.AppendNode("Data", "HintText");

            styleNameComboBox.Text = "нет";
            HelpKeyword = "Контент";
            styleNameComboBox.Select();
        }
        public void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "LinkText");
            DataTransferUnit.AppendNode("Data", "LinkObjectId");
            DataTransferUnit.AppendNode("Data", "LinkTarget");
            DataTransferUnit.AppendNode("Data", "Url");

            linkTarget = Enums.LinkTarget.Bookmark;
            HelpKeyword = "Ссылка";
            linkTextTextBox.Select();
            FillList();
            linkTypeComboBox.SelectedIndexChanged += linkTypeComboBox_SelectedIndexChanged;
            urlTextBox.Text = "http://";
            linkTypeComboBox.Text = "http:";
        }
        public static void LoadRecentProjects(XmlHelper xh)
        {
            for (var i = 0; i < int.MaxValue; i++)
            {
                var nodeName = string.Format("ProjectPath{0}", i + 1);
                var value = xh.GetNodeValue(nodeName);

                if (value.Equals(string.Empty))
                {
                    break;
                }

                if (File.Exists(value))
                {
                    Warehouse.Warehouse.Instance.RecentProjects.Add(value);
                }
            }
        }
        public void Initialize()
        {
            var path = Path.Combine(Application.StartupPath, appSettingsFileName);
            xmlHelper = new XmlHelper();

            if (!File.Exists(path))
            {
                InitializeDefaultAppSettings(xmlHelper);
                return;
            }

            try
            {
                xmlHelper.Load(path);
            }
            catch (Exception)
            {
                InitializeDefaultAppSettings(xmlHelper);
            }
        }
        public static void SaveRecentProjects(XmlHelper xh)
        {
            for (var i = 0; i < int.MaxValue; i++)
            {
                var nodeName = string.Format("ProjectPath{0}", i + 1);
                var value = xh.GetNodeValue(nodeName);

                if (value.Equals(string.Empty))
                {
                    break;
                }

                xh.RemoveNode(nodeName);
            }

            for (var i = 0; i < Warehouse.Warehouse.Instance.RecentProjects.Count; i++)
            {
                var nodeName = string.Format("ProjectPath{0}", i + 1);
                xh.AppendNode("RecentProjects", nodeName);
                xh.SetNodeValue(nodeName, Warehouse.Warehouse.Instance.RecentProjects[i]);
            }
        }
        public void InitializeDialog()
        {
            DataTransferUnit = new XmlHelper();
            DataTransferUnit.AppendNode(string.Empty, "Data");
            DataTransferUnit.AppendNode("Data", "Source");
            DataTransferUnit.AppendNode("Data", "Title");
            DataTransferUnit.AppendNode("Data", "LinkText");
            DataTransferUnit.AppendNode("Data", "Height");
            DataTransferUnit.AppendNode("Data", "HeightUnit");
            DataTransferUnit.AppendNode("Data", "Width");
            DataTransferUnit.AppendNode("Data", "WidthUnit");
            DataTransferUnit.AppendNode("Data", "HorizontalSpace");
            DataTransferUnit.AppendNode("Data", "VerticalSpace");
            DataTransferUnit.AppendNode("Data", "Justify");
            DataTransferUnit.AppendNode("Data", "BorderPixels");

            heightUnitComboBox.Text = "пикселов";
            widthUnitComboBox.Text = "пикселов";
            justifyComboBox.Text = "по нижнему краю";
            HelpKeyword = "Рисунок";
            sourceButton.Select();
        }
        private static void InitializeDefaultAppSettings(XmlHelper xmlHelper)
        {
            xmlHelper.AppendNode(string.Empty, "AppSettings");

            xmlHelper.AppendNode("AppSettings", "Environment");
            xmlHelper.AppendNode("Environment", "RecentProjects");

            xmlHelper.AppendNode("Environment", "InitialDirectory");
            xmlHelper.AppendNode("Environment", "ShowInvalidCourseDialog");

            xmlHelper.AppendNode("AppSettings", "Saving");
            xmlHelper.AppendNode("Saving", "AutosavingInterval");

            xmlHelper.AppendNode("AppSettings", "Appearance");
            xmlHelper.AppendNode("Appearance", "WindowState");
            xmlHelper.AppendNode("Appearance", "Left");
            xmlHelper.AppendNode("Appearance", "Top");
            xmlHelper.AppendNode("Appearance", "Width");
            xmlHelper.AppendNode("Appearance", "Height");

            xmlHelper.SetNodeValue("InitialDirectory", Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory));
            xmlHelper.SetNodeValue("ShowInvalidCourseDialog", "True");

            xmlHelper.SetNodeValue("AutosavingInterval", 0.ToString());

            xmlHelper.SetNodeValue("WindowState", FormWindowState.Maximized.ToString());
            xmlHelper.SetNodeValue("Left", 0.ToString());
            xmlHelper.SetNodeValue("Top", 0.ToString());
            xmlHelper.SetNodeValue("Width", 0.ToString());
            xmlHelper.SetNodeValue("Height", 0.ToString());
        }
        public void Log(Exception exception)
        {
            lock (this)
            {
                var path = Path.Combine(Application.StartupPath, exceptionDirectory);

                if (!Directory.Exists(path))
                {
                    // Операция может вызвать исключение.
                    Directory.CreateDirectory(path);
                }

                path = Path.Combine(path, string.Concat(Guid.NewGuid().ToString(), ".xml"));

                var xmlHelper = new XmlHelper();
                xmlHelper.AppendNode(string.Empty, "ExceptionInfo");
                xmlHelper.AppendNode("ExceptionInfo", "ProductName");
                xmlHelper.AppendNode("ExceptionInfo", "ProductVersion");
                xmlHelper.AppendNode("ExceptionInfo", "Date");
                xmlHelper.AppendNode("ExceptionInfo", "ComputerName");
                xmlHelper.AppendNode("ExceptionInfo", "UserName");
                xmlHelper.AppendNode("ExceptionInfo", "OS");
                xmlHelper.AppendNode("ExceptionInfo", "Culture");
                xmlHelper.AppendNode("ExceptionInfo", "Resolution");
                xmlHelper.AppendNode("ExceptionInfo", "SystemUpTime");
                xmlHelper.AppendNode("ExceptionInfo", "AppUpTime");
                xmlHelper.AppendNode("ExceptionInfo", "TotalMemory");
                xmlHelper.AppendNode("ExceptionInfo", "AvailableMemory");
                xmlHelper.AppendNode("ExceptionInfo", "ExceptionClasses");
                xmlHelper.AppendNode("ExceptionInfo", "ExceptionMessages");
                xmlHelper.AppendNode("ExceptionInfo", "StackTraces");
                xmlHelper.AppendNode("ExceptionInfo", "LoadedModules");

                xmlHelper.SetNodeValue("ProductName", Application.ProductName);
                xmlHelper.SetNodeValue("ProductVersion", Application.ProductVersion);
                xmlHelper.SetNodeValue("Date", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
                xmlHelper.SetNodeValue("ComputerName", SystemInformation.ComputerName);
                xmlHelper.SetNodeValue("UserName", SystemInformation.UserName);
                xmlHelper.SetNodeValue("OS", Environment.OSVersion.ToString());
                xmlHelper.SetNodeValue("Culture", CultureInfo.CurrentCulture.Name);
                xmlHelper.SetNodeValue("Resolution", SystemInformation.PrimaryMonitorSize.ToString());
                xmlHelper.SetNodeValue("SystemUpTime", ExceptionContextInfo.GetSystemUpTime().ToString());
                xmlHelper.SetNodeValue("AppUpTime", (DateTime.Now - Process.GetCurrentProcess().StartTime).ToString());
                var memoryStatus = new ExceptionContextInfo.MEMORYSTATUSEX();
                if (ExceptionContextInfo.GlobalMemoryStatusEx(memoryStatus))
                {
                    xmlHelper.SetNodeValue("TotalMemory", memoryStatus.ullTotalPhys/(1024*1024) + "Mb");
                    xmlHelper.SetNodeValue("AvailableMemory", memoryStatus.ullAvailPhys/(1024*1024) + "Mb");
                }
                xmlHelper.SetNodeValue("ExceptionClasses", ExceptionContextInfo.GetExceptionTypeStack(exception));
                xmlHelper.SetNodeValue("ExceptionMessages", ExceptionContextInfo.GetExceptionMessageStack(exception));
                xmlHelper.SetNodeValue("StackTraces", ExceptionContextInfo.GetExceptionCallStack(exception));

                var currentProcess = Process.GetCurrentProcess();
                var processInfo = new StringBuilder();
                foreach (ProcessModule module in currentProcess.Modules)
                {
                    processInfo.AppendLine(module.FileName + " " + module.FileVersionInfo.FileVersion);
                }
                xmlHelper.SetNodeValue("LoadedModules", processInfo.ToString());

                // Операция может вызвать исключение.
                xmlHelper.Save(path);
            }
        }