/// <summary>
        /// Updates values in the settings file
        /// </summary>
        private void UpdateSettingsFile()
        {
            // Get Current Directory
            var directory = System.AppDomain.CurrentDomain.BaseDirectory;

            XmlFileHandler.SaveValues(_startDate, _stopDate, directory + @"\" + _path);
        }
 /// <summary>
 /// The save configuration.
 /// </summary>
 /// <param name="pathToConfigurationXml">
 /// The path To Configuration Xml.
 /// </param>
 public static void SaveConfiguration(string pathToConfigurationXml)
 {
     if (ConfiguratorDialog.SelectedConfiguration != null)
     {
         XmlFileHandler.WriteDataToXml(ConfiguratorDialog.SelectedConfiguration, pathToConfigurationXml);
     }
 }
Beispiel #3
0
        /// <summary>
        /// The save data.
        /// </summary>
        private void SaveData()
        {
            this.GetConfiguratorDialogData();
            SaveConfiguratorDialogData();

            // Update configuration data
            Configuration.SelectedConfiguration = XmlFileHandler.ReadDataFromXml(pathToConfigurationFile);
        }
Beispiel #4
0
        /// <summary>
        /// The save configurator dialog data.
        /// </summary>
        public static void SaveConfiguratorDialogData()
        {
            if (pathToConfigurationFile == string.Empty)
            {
                pathToConfigurationFile = Directory.GetCurrentDirectory() + @"\ConfigData\Configuration.xml";
            }

            XmlFileHandler.WriteDataToXml(SelectedConfiguration, pathToConfigurationFile);
        }
        /// <summary>
        /// Updates the current values according to the saved data in settings file
        /// </summary>
        /// <param name="value"></param>
        private void UpdateCurrentValues(string value)
        {
            // Get Current Directory
            var directory = System.AppDomain.CurrentDomain.BaseDirectory;

            if (value.Equals("UpdateSettingsValues"))
            {
                var values = XmlFileHandler.GetValues(directory + @"\" + _path);

                _startDate = values.Item1;
                _stopDate  = values.Item2;
            }
        }
Beispiel #6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var mainWindow      = new mainWindow(Configuration.APP_NAME + " v" + Configuration.APP_VERSION);
            var xmlFileHandler  = new XmlFileHandler(Configuration.XML_FILE_PATH);
            var xmlService      = new XmlService(xmlFileHandler, Configuration.DATE_FORMAT);
            var repository      = new InvoiceRepository(xmlService);
            var newInvoiceModel = new InvoiceModel();

            var mainPresenter = new MainPresenter(mainWindow, repository, newInvoiceModel);

            // load the configuration data
            Configuration.SenderEmailAddress = ConfigurationManager.AppSettings["senderEmail"];
            Configuration.SenderName         = ConfigurationManager.AppSettings["SenderName"];
            Configuration.SenderPassword     = ConfigurationManager.AppSettings["SenderPassword"];
            Configuration.Host = ConfigurationManager.AppSettings["Host"];
            Configuration.port = int.Parse(ConfigurationManager.AppSettings["port"]);
            Configuration.RecipientEmailAddress = ConfigurationManager.AppSettings["recipientEmail"];
            Configuration.RecipientName         = ConfigurationManager.AppSettings["recipientName"];

            try
            {
                // show the main window
                Application.Run(mainWindow);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                System.Diagnostics.Debug.WriteLine(ex.StackTrace);

                // show an error dialog and create crashlog
                string crashlogFilePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\crash.log";
                if (File.Exists(crashlogFilePath))
                {
                    File.Delete(crashlogFilePath);
                }
                using (FileStream fs = File.Create(crashlogFilePath))
                {
                    byte[] message = new UTF8Encoding(true).GetBytes(ex.Message);
                    fs.Write(message, 0, message.Length);
                    byte[] author = new UTF8Encoding(true).GetBytes(ex.StackTrace);
                    fs.Write(author, 0, author.Length);
                }
                MessageBox.Show("An unexpected error occurred: \r\r" + ex.Message + "\r\n" + ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #7
0
        private XmlFileHandler FileHandlerConstruction(string directory)
        {
            var rootNode = new XmlEntryStandard()
            {
                EntryPrefix = Properties.Settings.Default.SettingsFileKeywordPath,
                TypePrefix  = Properties.Settings.Default.SettingsFileKeywordType, TypeName = Properties.Settings.Default.SettingsFileTypeNameFolder,
                NamePrefix  = Properties.Settings.Default.SettingsFileKeywordName, Name = @"Locations"
            };
            var handler = new XmlFileHandler(directory
                                             , Properties.Settings.Default.SettingsFileName
                                             , Properties.Settings.Default.SettingsFileKeywordPath);

            handler.InitXmlFile(rootNode);

            _message = handler.FileExists ? @"Locations File found" : handler.Info;
            return(handler);
        }
 /// <summary>
 /// The save new configuration.
 /// </summary>
 /// <param name="testFrameworkConfigFile">
 /// The test framework config file.
 /// </param>
 /// <param name="testFrameworkAssembliesPath">
 /// The test framework assemblies path.
 /// </param>
 public static void SaveNewConfiguration(string testFrameworkConfigFile, string testFrameworkAssembliesPath)
 {
     XmlFileHandler.WriteEmptyXmlFile(testFrameworkConfigFile, testFrameworkAssembliesPath);
 }
Beispiel #9
0
 public VmTreeViewData(string directory)
 {
     _fileHandler = FileHandlerConstruction(directory);
 }