Esempio n. 1
0
        private void ConfigureButtonClick(object sender, EventArgs e)
        {
            var assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            if (string.IsNullOrEmpty(assemblyFolder))
            {
                this.OutLog("Error! ExecutingAssembly not found");
                return;
            }

            var reportFileName = Path.Combine(assemblyFolder, "Docs", "PiluleReport.frx");

            if (!File.Exists(reportFileName))
            {
                this.OutLog("Error! PiluleReport not found!");
                return;
            }

            var applicationDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            var piluleDataPath      = Path.Combine(applicationDataPath, "Pilule");

            if (!Directory.Exists(piluleDataPath))
            {
                Directory.CreateDirectory(piluleDataPath);
            }

            var dstReportFileName = Path.Combine(piluleDataPath, "PiluleReport.frx");

            File.Copy(reportFileName, dstReportFileName, true);

            var qsliteStorage = new SqLiteStorage(Path.Combine(piluleDataPath, "config.sqlite"));
            var result1       = qsliteStorage.CreateConfigStorage();

            if (!result1)
            {
                this.OutLog(qsliteStorage.LastError);
            }

            var result2 = qsliteStorage.AddConfigValue("user", "urb31075");

            if (!result2)
            {
                this.OutLog(qsliteStorage.LastError);
            }

            if (result1 && result2)
            {
                this.OutLog("Configure Ok!");
            }
            else
            {
                this.OutLog("Configure Error!");
            }
        }
Esempio n. 2
0
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            this.PaymentButton.IsEnabled   = false;
            this.AddBaskedButton.IsEnabled = false;
            var    applicationDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
            var    sqliteStorage       = new SqLiteStorage(Path.Combine(applicationDataPath, "Pilule", "config.sqlite"));
            string user;
            var    result = sqliteStorage.ReadConfigValue("user", out user);

            this.InfoTextBox.Text = result ? user : "******";
        }