예제 #1
0
        private void Login_B_Click(object sender, RoutedEventArgs e)
        {
            string username = Input_Username.Text;
            string password = Input_Password.Password;

            // 检查格式
            if (!Input_Check(username, password)) return;

            var dp = App.conn;
            string sql = @"SELECT Username, Password, Root FROM User WHERE Username = ?";
            using (var statement = dp.Prepare(sql))
            {
                statement.Bind(1, username);
                if (SQLiteResult.ROW == statement.Step())
                {
                    if ((string)statement[0] != "")
                    {
                        if (password == (string)statement[1])
                        {
                            UserItem user = new UserItem((string)statement[0], (string)statement[1], (int)statement[2]);
                            Frame.Navigate(typeof(HomePage), user);
                            App.login = true;
                            return;
                        }
                    }
                }
                var t = new MessageDialog("Username or Password is not correct!").ShowAsync();
            }
        }
예제 #2
0
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            //not login
            login      = false;
            login_user = null;

            conn = new SQLiteConnection("sqlitetodo.db");
            string sql_user = @"CREATE TABLE IF NOT EXISTS User (Username VARCHAR(20) PRIMARY KEY,Password VARCHAR(20),Root INTERGER(1))";

            using (var statement = conn.Prepare(sql_user))
            {
                statement.Step();
            }

            string sql_task = @"CREATE TABLE IF NOT EXISTS TaskItem (Id INTEGER PRIMARY KEY AUTOINCREMENT,Title VARCHAR(140),Detail VARCHAR(1000),Datetime DATETIME(140),Filepath VARCHAR(1400),Username VARCHAR(1400),Comment VARCHAR(1400),Participatants VARCHAR(1400))";

            using (var statement = conn.Prepare(sql_task))
            {
                statement.Step();
            }
        }
예제 #3
0
        public App()
        {
            Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                Microsoft.ApplicationInsights.WindowsCollectors.Session);
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            //not login
            login = false;
            login_user = null;

            conn = new SQLiteConnection("sqlitetodo.db");
            string sql_user = @"CREATE TABLE IF NOT EXISTS User (Username VARCHAR(20) PRIMARY KEY,Password VARCHAR(20),Root INTERGER(1))";
            using (var statement = conn.Prepare(sql_user))
            {
                statement.Step();
            }

            string sql_task = @"CREATE TABLE IF NOT EXISTS TaskItem (Id INTEGER PRIMARY KEY AUTOINCREMENT,Title VARCHAR(140),Detail VARCHAR(1000),Datetime DATETIME(140),Filepath VARCHAR(1400),Username VARCHAR(1400),Comment VARCHAR(1400))";
            using (var statement = conn.Prepare(sql_task))
            {
                statement.Step();
            }
        }
예제 #4
0
 private void SelectedListView_ItemClick(object sender, ItemClickEventArgs e)
 {
     Models.UserItem temp = (Models.UserItem)(e.ClickedItem);
     selectedUser.Remove(temp);
     UserModel.Add(temp);
 }