Ejemplo n.º 1
0
 //終了処理
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         NicoNicoWrapperMain.GetSession().Dispose();
     }
     base.Dispose(disposing);
 }
Ejemplo n.º 2
0
        //ログイン後の初期化処理
        public void LogedInInit()
        {
            User          = new NicoNicoUserEntry();
            User.UserId   = NicoNicoWrapperMain.GetSession().UserId;
            User.UserName = NicoNicoUser.LookupUserName(User.UserId);

            App.ViewModelRoot.Title += "(user:"******")";

            TabItems.Add(Search = new SearchViewModel());
            TabItems.Add(new FavoriteViewModel());
            TabItems.Add(new NicoRepoViewModel());
            TabItems.Add(new MylistViewModel());
            TabItems.Add(new HistoryViewModel());
            TabItems.Add(new OtherViewModel());
            TabItems.Add(Config = new ConfigViewModel());
        }
Ejemplo n.º 3
0
        //サインイン
        public void SignIn()
        {
            StateText = "ログイン中・・・";
            Enabled   = false;

            Task.Run(new Action(() => {
                SigninStatus status = NicoNicoWrapperMain.GetSession().SignIn(MailAddress, Password);

                //サインイン失敗
                if (status != SigninStatus.Success)
                {
                    StateText = "ログインに失敗しました。";
                    Enabled   = true;
                    return;
                }

                Success = true;
                Messenger.Raise(new WindowActionMessage(WindowAction.Close, "WindowAction"));
            }));
        }
        //ニコレポ削除処理
        public void Delete()
        {
            Task.Run(() => {
                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "http://www.nicovideo.jp/api/nicorepo/delete_log");

                Dictionary <string, string> form = new Dictionary <string, string>();
                form["log_id"] = Entry.LogId;
                form["type"]   = Entry.Type;
                form["time"]   = Entry.DeleteTime;
                form["token"]  = Entry.Token;

                request.Content = new FormUrlEncodedContent(form);

                var response = NicoNicoWrapperMain.GetSession().GetAsync(request).Result;

                Close();


                Owner?.Reflesh();
            });
        }
Ejemplo n.º 5
0
        public void Close()
        {
            //ログイン成功
            if (Success)
            {
                //自動的にログインするにチェックが入っていたら
                if (AutoLogin)
                {
                    StreamWriter writer = new StreamWriter(NicoNicoUtil.CurrentDirectory.DirectoryName + @"\session");

                    writer.WriteLine("Key:" + NicoNicoWrapperMain.GetSession().Key);
                    writer.WriteLine("Expire:" + NicoNicoWrapperMain.GetSession().Expire);

                    writer.Flush();
                    writer.Close();
                }
            }
            else
            {
                Environment.Exit(0);
            }
        }