public void SaveSettingsToXML()
        {
            Directory.CreateDirectory(fileRoad);
            XmlWriterSettings settingsXML = new XmlWriterSettings {
                Indent = true
            };

            try {
                using (XmlWriter xw = XmlWriter.Create(fileRoad + @"settings.xml", settingsXML)) {
                    xw.WriteStartDocument();
                    xw.WriteStartElement("settings");
                    xw.WriteStartElement("settings");
                    xw.WriteElementString("sortBy", SortBy);
                    xw.WriteElementString("sortUp", SortUp.ToString());
                    xw.WriteElementString("sortUpEditions", SortUpEditions.ToString());
                    xw.WriteElementString("sortUpGenres", SortUpGenres.ToString());
                    xw.WriteElementString("sortUpCompanies", SortUpCompanies.ToString());
                    xw.WriteElementString("sortBooks", SortBooks.ToString());
                    xw.WriteElementString("sortEditions", SortEditions.ToString());
                    xw.WriteElementString("sortGenres", SortGenres.ToString());
                    xw.WriteElementString("sortCompanies", SortCompanies.ToString());
                    xw.WriteEndElement();
                    xw.WriteEndElement();
                    xw.WriteEndDocument();
                    xw.Flush();
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message, "Chyba", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #2
0
        public static void Run()
        {
            const int k_Len = 10;
            int[] array = new int[k_Len];
            Random rand = new Random();
            for (int i = 0; i < k_Len; i++)
            {
                array[i] = rand.Next(10);
                Console.Write(array[i].ToString() + " ");
            }

            Console.WriteLine();

            SortUp sortUpObj = new SortUp();
            sortUpObj.sort(array);

            for (int u = 0; u < k_Len; u++)
            {
                Console.Write(array[u].ToString() + " ");
            }
            Console.WriteLine();

            SortDown sortDownObj = new SortDown();
            sortDownObj.sort(array);

            for (int u = 0; u < k_Len; u++)
            {
                Console.Write(array[u].ToString() + " ");
            }
            Console.WriteLine();
        }