static void Main() { string regKey = PixiqCore.RegistryKey; // レジストリからバージョン情報取得 string version = PixiqCore.GetRegistryValue(regKey, "version"); // レジストリからPixivのユーザー情報取得 string pixivID = PixiqCore.GetRegistryValue(regKey, "pixiv_id"); string password = PixiqCore.GetRegistryValue(regKey, "password"); // ユーザー情報がなければ設定フォームを起動する Form form = null; if ((pixivID == "") || (password == "") || (version == "")) { form = new SettingForm(); } else { form = new PixiqForm(); ((PixiqForm)form).pixiv.PixivID = pixivID; ((PixiqForm)form).pixiv.Password = password; } Application.Run(form); }
private void menuSignIn_Click(object sender, EventArgs e) { statusBar1.Text = "ログインチェック中"; System.Threading.Thread thread = new System.Threading.Thread(LoginThread); //thread.Start(); try { Pixiv.PixivID = textID.Text; Pixiv.Password = textPassword.Text; Pixiv.Login(); // アセンブリのバージョンを取得する string asmVersion = PixiqCore.GetAssemblyVersion(); // レジストリに書き込み保存する PixiqCore.SetRegistryValue(@"Softbuild\pixiq", "pixiv_id", Pixiv.PixivID); PixiqCore.SetRegistryValue(@"Softbuild\pixiq", "password", Pixiv.Password); PixiqCore.SetRegistryValue(@"Softbuild\pixiq", "version", asmVersion); } catch { statusBar1.Text = "ログインに失敗しました"; return; } // ホーム画面を表示する PixiqForm form = new PixiqForm(); form.pixiv.PixivID = Pixiv.PixivID; form.pixiv.Password = Pixiv.Password; form.Show(); this.Hide(); //this.Close(); }