Inheritance: CoreBase
Esempio n. 1
0
 public DirectMessageTimeline(Kbtter4Setting kb, string q, User p)
 {
     Setting = kb;
     DirectMessages = new ObservableSynchronizedCollection<DirectMessage>();
     Query = new Kbtter3Query(q);
     Party = p;
 }
Esempio n. 2
0
		private async void Window_Loaded(object sender, RoutedEventArgs e)
		{
			TwitterTools.Authentication();

			user = await TwitterTools.UsersShow(Properties.Settings.Default.UserId);
			ProfileImage.Source = new BitmapImage(new Uri(user.ProfileImageUrl.Replace("_normal", "")));
		}
Esempio n. 3
0
 public AccountInformation(IEnumerable<Kbtter4Account> acs)
 {
     Accounts = acs.ToArray();
     Users = new User[Accounts.Length];
     HasGot = new bool[Accounts.Length];
     Tokens = new Tokens[Accounts.Length];
 }
Esempio n. 4
0
        public void Update(CUser user)
        {
            Id         = user.Id ?? -1;
            ScreenName = user.ScreenName;
            Name       = user.Name;
            CreatedAt  = user.CreatedAt.LocalDateTime;
            if (user.Description != null)
            {
                Description = CoreTweetSupplement.EnumerateTextParts(user.Description, user.Entities?.Description).ToText();
            }
            else
            {
                Description = string.Empty;
            }
            FavouritesCount  = user.FavouritesCount;
            FollowersCount   = user.FollowersCount;
            FriendsCount     = user.FriendsCount;
            ListedCount      = user.ListedCount ?? 0;
            Location         = user.Location ?? string.Empty;
            ProfileBannerUrl = user.ProfileBannerUrl != null ? $"{user.ProfileBannerUrl}/web" : null;
            ProfileImageUrl  = user.ProfileImageUrl != null?user.GetProfileImageUrl("bigger").AbsoluteUri : null;

            IsProtected   = user.IsProtected;
            StatusesCount = user.StatusesCount;
            IsSuspended   = user.IsSuspended ?? false;
            if (user.Url != null)
            {
                Url = CoreTweetSupplement.EnumerateTextParts(user.Url, user.Entities?.Url).ToText();
            }
            else
            {
                Url = string.Empty;
            }
            IsVerified = user.IsVerified;
        }
Esempio n. 5
0
 public Form_UserInfo(Tokens tokens, User user, User myData, Form_Main parentForm)
 {
     InitializeComponent();
     this.tokens = tokens;
     this.user = user;
     this.myData = myData;
     this.parentForm = parentForm;
 }
Esempio n. 6
0
 protected override void Dispose(bool disposing)
 {
     base.Dispose(disposing);
     mainw = null;
     kbtter = null;
     user = null;
     ShowingStatuses.Clear();
     ShowingFavorites.Clear();
     ShowingFriends.Clear();
     ShowingFollowers.Clear();
 }
Esempio n. 7
0
 public UserProfilePageViewModel(User us, MainWindowViewModel vm)
 {
     user = us;
     mainw = vm;
     mwlistener = new PropertyChangedEventListener(mainw);
     mwlistener.Add("TabClose", (s, e) =>
     {
         if (mainw.ClosedTabTag == this)
         {
             Dispose();
         }
     });
 }
Esempio n. 8
0
 public void AddInfo(List <TweetClass.UserInfo> userPro, CoreTweet.User user /*=null, CoreTweet.*/)
 {
     userPro.Add(new TweetClass.UserInfo
     {
         UserName        = user.Name,
         UserId          = user.Id,
         ScreenName      = "@" + user.ScreenName,
         ProfileImageUrl = user.ProfileImageUrlHttps,
         FollowCount     = user.FollowersCount,
         FavCount        = user.FavouritesCount,
         FollowerCount   = user.FriendsCount,
         Prof            = user.Description
     }
                 );
 }
Esempio n. 9
0
        public void AddInfo2(ObservableCollection <Models.UserInfo> userPro, CoreTweet.User user)
        {
            userPro.Add(new Models.UserInfo
            {
                UserName   = user.Name,
                UserId     = user.Id,
                ScreenName = "@" + user.ScreenName,

                FollowCount     = user.FollowersCount,
                FavCount        = user.FavouritesCount,
                FollowerCount   = user.FriendsCount,
                Prof            = user.Description,
                ProfileImageUrl = user.ProfileImageUrlHttps,
            }
                        );
        }
Esempio n. 10
0
        //PropertyChangedEventListener listener;

        public UserViewModel(User user, MainWindowViewModel mw)
        {
            Kbtter = Kbtter.Instance;
            main = mw;
            src = user;
            Name = src.Name;
            ScreenName = src.ScreenName;
            IdString = src.Id.ToString();
            ProfileImageUri = src.ProfileImageUrlHttps;
            IsProtected = src.IsProtected;
            Location = src.Location;
            UriString = src.Url != null ? src.Url.ToString() : "";
            Description = src.Description;
            Statuses = src.StatusesCount;
            Favorites = src.FavouritesCount;
            Friends = src.FriendsCount;
            Followers = src.FollowersCount;
            //if (Description != null) AnalyzeDescription();
        }
Esempio n. 11
0
        private void setData(User user)
        {
            this.label_Id.Text += string.Format("{0} ", user.ScreenName);
            this.label_Name.Text = string.Format(" {0} ", user.Name);
            this.label_Profile.Text = user.Description != null ? user.Description : string.Empty;
            this.label_CountTweet.Text += string.Format("{0} ", user.StatusesCount);
            this.label_Following.Text += string.Format("{0} ", user.FriendsCount);
            this.label_Follower.Text += string.Format("{0} ", user.FollowersCount);

            this.pictureBox_UserIcon.ImageLocation = user.ProfileImageUrl;
            this.pictureBox_UserIcon.Refresh();

            this.webBrowser_Detail.DocumentText =
@"<body bgcolor=""#404040"" text=""#F0F8FF"" link=""#B0C4DE"" vlink=""#FFB6C1"">";

            showUserTimeline(this.listView_Tweet);
            showFollowing(this.listView_Following);
            showFollowers(this.listView_Followers);
        }
Esempio n. 12
0
 public OptionUserInformationPanel(Tokens ut, User me)
 {
     t = ut;
     m = me;
 }
Esempio n. 13
0
        public TitleChildSceneOptionUserSelect(AccountInformation ainfo, int idx, bool back, User[] us)
        {
            b = back;
            ai = ainfo;
            uinfo = new UserInformation(ai.Users[idx]);
            index = idx;
            mvf = (ta, aid, max) => (mai, val) =>
            {
                if (max > aid) ta[aid].Alpha = val ? 1.0 : 0.5;
            };
            users = us;
            opod = new List<StringSprite>
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 64 - 8, Value = "1st" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 96 - 8, Value = "2nd" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 128 - 8, Value = "3rd" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 160 - 8, Value = "4th" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 192 - 8, Value = "5th" }
            };
            next = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Blue) { X = 64, Y = nextpos - 8, Value = "決定" };
            opsn = new List<StringSprite>
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 64 - 8, Value = "" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 96 - 8, Value = "" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 128 - 8, Value = "" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 160 - 8, Value = "" },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 128, Y = 192 - 8, Value = "" }
            };
            mal = new List<MenuAllocationInformation>
            {
                new MenuAllocationInformation(){ X = 32, Y = 64 },
                new MenuAllocationInformation(){ X = 32, Y = 96 },
                new MenuAllocationInformation(){ X = 32, Y = 128 },
                new MenuAllocationInformation(){ X = 32, Y = 160 },
                new MenuAllocationInformation(){ X = 32, Y = 192 },
                new MenuAllocationInformation(){ X = 32, Y = 224 },
            };
            opop = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 64, Y = 224 - 8, Value = "編集        削除" };
            opopmal = new List<MenuAllocationInformation>
            {
                new MenuAllocationInformation(){X=40,Y=224},
                new MenuAllocationInformation(){X=136,Y=224},
            };

            okcancel = new List<StringSprite>
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "OK", X = 528, Y = 180 , Alpha = 0},
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "キャンセル", X = 528, Y = 204, Alpha = 0 }
            };
            ocmal = new List<MenuAllocationInformation>
            {
                new MenuAllocationInformation(){X=512,Y=180+8,IsAvailable=false},
                new MenuAllocationInformation(){X=512,Y=204+8},
            };
            ouip = new OptionUserInformationPanel(ai.Tokens[index], ai.Users[index])
            {
                ChangingAction = (p) =>
                {
                    //タイムラグ対策
                    if (cs != 2) return;
                    if (p && users.Where(q => q != null).All(q => q.Id != ouip.SourceUser.Id))
                    {
                        valid.Value = "オプションOK";
                        valid.Color = CommonObjects.Colors.Blue;
                        ocmal[0].IsAvailable = true;
                    }
                    else
                    {
                        valid.Value = "オプションNG";
                        valid.Color = CommonObjects.Colors.Red;
                        ocmsel = 1;
                        ocmal[0].IsAvailable = false;
                        mc.AddSubOperation(SpritePatterns.VerticalMove(10, ocmal[ocmsel].Y, Easing.OutQuad));
                    }
                }
            };
            for (int i = 0; i < opopmal.Count; i++)
            {
                opopmal[i].Lefter = opopmal[(i + opopmal.Count - 1) % opopmal.Count];
                opopmal[i].Righter = opopmal[(i + 1) % opopmal.Count];
            }
            for (int i = 0; i < ocmal.Count; i++)
            {
                ocmal[i].Upper = ocmal[(i + ocmal.Count - 1) % ocmal.Count];
                ocmal[i].Lower = ocmal[(i + 1) % ocmal.Count];
                ocmal[i].AvailableChangingAction = mvf(okcancel, i, okcancel.Count);
            }
            for (int i = 0; i < mal.Count; i++)
            {
                mal[i].Upper = mal[(i + mal.Count - 1) % mal.Count];
                mal[i].Lower = mal[(i + 1) % mal.Count];
                mal[i].AvailableChangingAction = mvf(opod, i, opod.Count);
                mal[i].IsAvailable = (i < users.Length && users[i] != null) || i == mal.Count - 1 || (users.Count(p => p != null) == i);
            }
            for (int i = 0; i < opsn.Count; i++)
            {
                if (users[i] != null) opsn[i].Value = users[i].ScreenName;
            }

            valid = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { X = 320, Y = 216, Value = "オプションOK/NG" };
            mc = new MultiAdditionalCoroutineSprite() { Image = CommonObjects.ImageCursor128[1], HomeX = 64, HomeY = 64, ScaleX = 0.25, ScaleY = 0.25 };
            cs = 0;
            ki = null;
            msel = 0;
            ocmsel = 0;
        }
Esempio n. 14
0
        public static int GetUserImage(User user)
        {
            if (user == null || user.Id == null) return 0;
            var target = Path.Combine(
                            CommonObjects.DataDirectory,
                            "icon_cache_big",
                            string.Format("{0}.{1}", user.Id, "png"));
            if (!CachedIds.Contains((long)user.Id))
            {
                //未キャッシュ
                if (!File.Exists(target))
                    using (var wc = new WebClient())
                    using (var st = wc.OpenRead(user.ProfileImageUrlHttps.ToString().ToString().Replace("_normal.png", ".png")))
                    {
                        var bm = new Bitmap(st);
                        var sav = new Bitmap(bm, 96, 96);
                        try
                        {
                            sav.Save(target);
                        }
                        catch
                        {

                        }

                    }
                ImageHandles[(long)user.Id] = DX.LoadGraph(target);
            }
            else if (!ImageHandles.ContainsKey((long)user.Id))
            {
                //未ロード
                ImageHandles[(long)user.Id] = DX.LoadGraph(target);
            }

            return ImageHandles[(long)user.Id];
        }
Esempio n. 15
0
 public override void OnLogout(User user)
 {
     try
     {
         var f = lua["OnLogout"] as Action<User>;
         if (f != null) f(user);
     }
     catch (Exception e)
     {
         ins.LogError("プラグイン " + Name + "でエラーが発生しました : " + e.Message);
         ins.SaveLog();
     }
 }
Esempio n. 16
0
 public User(CUser user)
 {
     Update(user);
 }
Esempio n. 17
0
        private void changeAccount(int accountNumber)
        {
            string[] tokenData = Properties.Settings.Default.AccessTokenList[accountNumber].Split(',');
            this.tokens = Tokens.Create(
                "9LQZDfaCSJR88d2HLkkXrBFz0",
                "HzupFEw0SFaLA2U4NGIBW0BFXybVY3M7uTgS33x1nByiEmjnI7",
                tokenData[2],
                tokenData[3]);
            this.user = this.tokens.Account.VerifyCredentials();

            show(this.tokens);

            clearMarkUser();

            reStreaming();
        }
Esempio n. 18
0
        public TitleChildSceneOptionEdit(User[] op)
        {
            opts = op;
            osi = new int[opts.Length];
            oii = new OptionInitializationInformation[opts.Length];
            sum = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "オプション装備編集", X = 230, Y = 8 };
            type = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Blue) { Value = "装備タイプ", X = 160, Y = 32 + 8 };
            dirc = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Green) { Value = "装備方向", X = 160, Y = 64 + 8 };
            mode = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Green) { Value = "モード", X = 160, Y = 96 + 8 };
            uvdesc = new List<StringSprite>()
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Red) { Value = "装備固有オプション1", X = 160, Y = 128 + 8 },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Red) { Value = "装備固有オプション2", X = 160, Y = 160 + 8 },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Red) { Value = "装備固有オプション3", X = 160, Y = 192 + 8 },
            };

            seltype = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 32 + 8 };
            seldirc = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 64 + 8 };
            selmode = new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 96 + 8 };
            ipuvdesc = new List<StringSprite>()
            {
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 128 + 8 },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 160 + 8 },
                new StringSprite(CommonObjects.FontSystemMedium, CommonObjects.Colors.Black) { Value = "", X = 360, Y = 192 + 8 },
            };

            uvs = new List<StringSprite>();
            uvs.Add(type);
            uvs.Add(dirc);
            uvs.Add(mode);
            uvs.AddRange(uvdesc);

            seluvs = new List<StringSprite>();
            seluvs.Add(seltype);
            seluvs.Add(seldirc);
            seluvs.Add(selmode);
            seluvs.AddRange(ipuvdesc);

            uvsmal = new List<MenuAllocationInformation>
            {
                new MenuAllocationInformation{ X = 144, Y = 48 },
                new MenuAllocationInformation{ X = 144, Y = 80 },
                new MenuAllocationInformation{ X = 144, Y = 112 },
                new MenuAllocationInformation{ X = 144, Y = 144 },
                new MenuAllocationInformation{ X = 144, Y = 176 },
                new MenuAllocationInformation{ X = 144, Y = 208 },
            };

            for (int i = 0; i < uvsmal.Count; i++)
            {
                int ci = i;
                uvsmal[i].Upper = uvsmal[(i + uvsmal.Count - 1) % uvsmal.Count];
                uvsmal[i].Lower = uvsmal[(i + 1) % uvsmal.Count];
                uvsmal[i].AvailableChangingAction =
                    (p, v) =>
                    {
                        uvs[ci].Alpha = seluvs[ci].Alpha = v ? 1.0 : 0.5;
                    };
                if (i >= 1) uvsmal[i].IsAvailable = false;
            }

            udc = new[]
            {
                new MultiAdditionalCoroutineSprite(){HomeX=64,HomeY=64,ScaleX=0.8,ScaleY=0.4,Image=CommonObjects.ImageCursor128[2],X=64,Y=48},
                new MultiAdditionalCoroutineSprite(){HomeX=64,HomeY=64,ScaleX=0.8,ScaleY=0.4,Image=CommonObjects.ImageCursor128[3],X=64,Y=208},
            };
            selopts = new List<MultiAdditionalCoroutineSprite>();
            foreach (var i in opts)
            {
                if (i == null) continue;
                selopts.Add(new MultiAdditionalCoroutineSprite() { HomeX = 48, HomeY = 48, X = 64, Y = 128, Image = BigUserImageManager.GetUserImage(i), Alpha = 0 });
            }
            avu = selopts.Count;
            for (int i = 0; i < avu; i++)
            {
                osi[i] = 0;
                oii[i] = new OptionInitializationInformation();
            }
            selopts.Add(new MultiAdditionalCoroutineSprite() { HomeX = 48, HomeY = 48, X = 64, Y = 128, Image = CommonObjects.ImageOptionEditEnd, Alpha = 0 });
            selopts[usel].Alpha = 1;

            mc = new MultiAdditionalCoroutineSprite() { Image = CommonObjects.ImageCursor128[1], HomeX = 64, HomeY = 64, ScaleX = 0.25, ScaleY = 0.25 };
            mc.X = uvsmal[smsel].X;
            mc.Y = uvsmal[smsel].Y;
        }
Esempio n. 19
0
 public OptionInformation(User u)
 {
     SourceUser = u;
     UserInformation = new UserInformation(u);
 }
Esempio n. 20
0
 public SimpleUserViewModel(User u)
 {
     user = u;
 }
Esempio n. 21
0
        /*
        //UserStreamのStatus.UserにEntityがろくに含まれてないので凍結
        public void AnalyzeDescription()
        {
            var l = new List<Tuple<int[], StatusTextElement>>();

            if (src.Entities != null && src.Entities.Url != null)
            {
                if (src.Entities.Url.Urls != null)
                    foreach (var i in src.Entities.Url.Urls)
                    {
                        //Text = Text.Replace(i.Url.ToString(), i.DisplayUrl.ToString());
                        var e = new StatusTextElement();
                        e.Original = i.Url.ToString();
                        e.Action = main.View.OpenInDefault;
                        e.Type = StatusTextElementType.Uri;
                        e.Link = i.ExpandedUrl;
                        e.Surface = i.DisplayUrl;
                        l.Add(new Tuple<int[], StatusTextElement>(i.Indices, e));
                    }

                if (src.Entities.Url.Media != null)
                    foreach (var i in src.Entities.Url.Media)
                    {
                        //Text = Text.Replace(i.Url.ToString(), i.DisplayUrl.ToString());
                        var e = new StatusTextElement();
                        e.Original = i.Url.ToString();
                        e.Action = main.View.OpenInDefault;
                        e.Type = StatusTextElementType.Media;
                        e.Link = i.ExpandedUrl;
                        e.Surface = i.DisplayUrl;
                        l.Add(new Tuple<int[], StatusTextElement>(i.Indices, e));
                    }

                if (src.Entities.Url.UserMentions != null)
                    foreach (var i in src.Entities.Url.UserMentions)
                    {
                        var e = new StatusTextElement();
                        e.Action = async (p) =>
                        {
                            var user = await Kbtter.Token.Users.ShowAsync(id => i.Id);
                            Kbtter.AddUserToUsersList(user);
                            main.View.Notify(user.Name + "さんの情報");
                            main.View.ChangeToUser();
                        };
                        e.Type = StatusTextElementType.User;
                        e.Link = new Uri("https://twitter.com/" + i.ScreenName);
                        e.Surface = "@" + i.ScreenName;
                        e.Original = e.Surface;
                        l.Add(new Tuple<int[], StatusTextElement>(i.Indices, e));
                    }

                if (src.Entities.Url.HashTags != null)
                    foreach (var i in src.Entities.Url.HashTags)
                    {
                        var e = new StatusTextElement();
                        e.Action = (p) =>
                        {
                            main.View.ChangeToSearch();
                            main.View.SearchText = "#" + i.Text;
                            Kbtter.Search("#" + i.Text);
                        };
                        e.Type = StatusTextElementType.Hashtag;
                        e.Link = new Uri("https://twitter.com/search?q=%23" + i.Text);
                        e.Surface = "#" + i.Text;
                        e.Original = e.Surface;
                        l.Add(new Tuple<int[], StatusTextElement>(i.Indices, e));
                    }

                l.Sort((x, y) => x.Item1[0].CompareTo(y.Item1[0]));
            }

            int le = 0;
            foreach (var i in l)
            {
                var el = i.Item1[1] - i.Item1[0];
                var ntl = i.Item1[0] - le;
                if (ntl != 0)
                {
                    var nt = Description.Substring(le, ntl);
                    nt = nt
                        .Replace("&lt;", "<")
                        .Replace("&gt;", ">")
                        .Replace("&amp;", "&");
                    DescriptionElements.Add(new StatusTextElement { Surface = nt, Type = StatusTextElementType.None });
                }
                DescriptionElements.Add(i.Item2);
                le = i.Item1[1];
            }
            //foreach (var i in l) Text = Text.Replace(i.Item2.Original, i.Item2.Surface);
            if (Description.Length > le - 1)
            {
                var ls = Description.Substring(le);
                ls = ls
                        .Replace("&lt;", "<")
                        .Replace("&gt;", ">")
                        .Replace("&amp;", "&");
                DescriptionElements.Add(new StatusTextElement { Surface = ls, Type = StatusTextElementType.None });
            }
        }
        */
        public UserViewModel(User user, MainWindowViewModel mw, bool gfs)
            : this(user, mw)
        {

        }
Esempio n. 22
0
 public UserInformation(User user)
 {
     SourceUser = user;
     ShotStrength = (SourceUser.StatusesCount + (DateTime.Now - SourceUser.CreatedAt.LocalDateTime).Days * (int)Math.Log10(SourceUser.StatusesCount)) / 25;
     GrazePoints = (SourceUser.StatusesCount / SourceUser.FollowersCount) / 20 + 10;
     CollisionRadius = 4.0 * SourceUser.FriendsCount / SourceUser.FollowersCount;
     DefaultPlayers = (int)(Math.Log10(SourceUser.FollowersCount) * Math.Log10(SourceUser.FriendsCount)) * 4;
     DefaultBombs = (int)(Math.Log10(SourceUser.FavouritesCount) + Math.Log10(SourceUser.StatusesCount)) * 2;
     BombStrength = SourceUser.StatusesCount;
 }
Esempio n. 23
0
 public override void OnLogout(User user)
 {
     try
     {
         if (haslogout == null)
         {
             haslogout = scope.TryGetVariable("OnLogout", out logout);
         }
         if (haslogout ?? false) logout(user);
     }
     catch (Exception e)
     {
         ins.LogError("プラグイン " + Name + "でエラーが発生しました : " + e.Message);
     }
 }
Esempio n. 24
0
        private void setRelation(User user, User myData, Tokens tokens)
        {
            this.button_Follow.Text = " Follow ";
            string myRelation = " Following : {0} ";
            string following = "false";
            string userRelation = " Followed : {0} ";
            string followed = "false";

            try
            {
                string json = this.tokens.Friendships.Lookup(user_id => this.user.Id).Json;
                string cleanJson = new var_dump().GetCleanJson(json);
                var relationship = JsonConvert.DeserializeObject<Relationship>(cleanJson);

                if (relationship.connections.Contains("following"))
                {
                    following = "true";
                    this.button_Follow.Text = " UnFollow ";
                }
                if (relationship.connections.Contains("followed_by"))
                {
                    followed = "true";
                }

                this.label_MyRelation.Text = string.Format(myRelation, following);
                this.label_UserRelation.Text = string.Format(userRelation, followed);
            }
            catch(Exception ex)
            {
                util.ShowExceptionMessageBox(ex.Message, ex.StackTrace);
            }
        }
Esempio n. 25
0
 public void SearchUser(string sn)
 {
     sname.Value = sn;
     IsValidUser = true;
     ChangingAction(false);
     t.Users.ShowAsync(screen_name => sn)
         .ContinueWith(p =>
         {
             if (p.IsFaulted)
             {
                 sname.Value = "Not Found";
                 IsValidUser = false;
                 return;
             }
             var u = p.Result;
             SourceUser = u;
             tweets.Value = SourceUser.StatusesCount.ToString();
             fav.Value = SourceUser.FavouritesCount.ToString();
             friend.Value = SourceUser.FriendsCount.ToString();
             follower.Value = SourceUser.FollowersCount.ToString();
             img.Image = UserImageManager.GetUserImage(SourceUser);
             try
             {
                 var fs = t.Friendships.Show(source_id => m.Id, target_id => SourceUser.Id);
                 if ((fs.Source.IsFollowing ?? false) && (fs.Target.IsFollowing ?? false) && m.Id != SourceUser.Id)
                 {
                     IsValidUser = true;
                     ChangingAction(true);
                 }
             }
             catch
             {
             }
         });
 }
Esempio n. 26
0
 public abstract void OnLogin(User user);
Esempio n. 27
0
        private static async Task<int> GetUserImageTaskAsync(User user)
        {
            if (user == null || user.Id == null) return 0;
            if (!ImageHandles.ContainsKey((long)user.Id))
            {
                using (var wc = new WebClient())
                {
                    var target = Path.Combine(
                            CommonObjects.DataDirectory,
                            "icon_cache",
                            string.Format(
                                "{0}.{1}",
                                user.Id,
                                Path.GetFileNameWithoutExtension(user.ProfileImageUrlHttps.ToString().Split('/').Last())
                                )
                            );
                    await wc.DownloadFileTaskAsync(user.ProfileImageUrlHttps, target);
                    ImageHandles[(long)user.Id] = DX.LoadGraph(target);
                }

            }
            return ImageHandles[(long)user.Id];
        }
Esempio n. 28
0
 public abstract void OnLogout(User user);
Esempio n. 29
0
        private void addAccount()
        {
            string apiKey = "9LQZDfaCSJR88d2HLkkXrBFz0";
            string apiKeySecret = "HzupFEw0SFaLA2U4NGIBW0BFXybVY3M7uTgS33x1nByiEmjnI7";
            var sessions = OAuth.Authorize(apiKey, apiKeySecret);
            var url = sessions.AuthorizeUri;

            using (Form_InputPinCode ff = new Form_InputPinCode(url.ToString()))
            {
                DialogResult dr = ff.ShowDialog();
                if (dr != DialogResult.OK)
                {
                    return;
                }

                string pin = ff.PinCode;
                var t = OAuth.GetTokens(sessions, pin);

                foreach(string row in Properties.Settings.Default.AccessTokenList)
                {
                    string screenName = row.Split(',')[0];
                    if (screenName == t.Account.VerifyCredentials().ScreenName)
                    {
                        MessageBox.Show("This user has been added.",
                            "Information,",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.Information);
                        return;
                    }
                }

                this.tokens = t;
                this.user = t.Account.VerifyCredentials();
            }

            show(this.tokens);

            if (this.disposable != null)
            {
                this.disposable.Dispose();
                logger.Debug("Streaming has disposed.");
            }

            streaming(this.tokens);

            string tokenData = string.Format("{0},{1},{2},{3}",
                this.user.ScreenName,
                this.user.Name,
                this.tokens.AccessToken,
                this.tokens.AccessTokenSecret);
            Properties.Settings.Default.AccessTokenList.Add(tokenData);
            Properties.Settings.Default.Save();
        }
Esempio n. 30
0
        public TweetItem(Status status, Control control)
        {
            InitializeComponent();

            parentFrame = control;

            this.status = status;
            this.user = status.User;
            innerUrl = "";
            imageBox[0] = ImageBox1;
            imageBox[1] = ImageBox2;
            imageBox[2] = ImageBox3;
            imageBox[3] = ImageBox4;

            if (status.Source.IndexOf("<a") >= 0)
            {
                Match m = TwitterTools.viaReg(status.Source);
                status.Source = m.Groups["via"].Value;
            }

            // 画像が含まれていたら表示する
            if (status.Entities.Media != null)
            {
                status.Text = status.Text.Replace(status.Entities.Media[0].Url, "");
                innerUrl = status.Entities.Media[0].ExpandedUrl;

                if (status.ExtendedEntities.Media != null)
                {
                    if (status.ExtendedEntities.Media[0].Type == "animated_gif")
                    {
                        StartButton.BackColor = Color.Transparent;
                        StartButton.Parent = ImageBox1;
                        StartButton.Visible = true;
                    }

                    for (int i = 0; i < status.ExtendedEntities.Media.Length; i++)
                    {
                        mediaEntity[i] = status.ExtendedEntities.Media[i];
                        imageBox[i].Source = new BitmapImage(new Uri(status.ExtendedEntities.Media[i].MediaUrl + ":small"));
                    }

                }
            }

            // 画像のないPictureBoxを消す
            for (int i = 0; i < imageBox.Length; i++)
            {
                if (imageBox[i].Source == null)
                {
                    grid.Children.Remove(imageBox[i]);
                }
            }

            //URLを置換
            foreach (var url in status.Entities.Urls)
            {
                Match m = TwitterTools.urlReg(status.Entities.Urls.ToString());
                status.Text = status.Text.Replace(url.Url, url.DisplayUrl);
                innerUrl = url.ExpandedUrl;
            }

            //リツイート→赤、リプライ→緑、自分宛→青
            if (status.RetweetedStatus != null)
            {
                BackColor = Color.FromArgb(50, 16, 16);

                ProfileImage.ImageLocation = status.RetweetedStatus.User.ProfileImageUrl.Replace("_normal", "");
                NameLabel.Content = status.RetweetedStatus.User.Name + " @" + status.RetweetedStatus.User.ScreenName;
                TextLabel.Content = status.RetweetedStatus.Text;

                RetweetProfileImage.ImageLocation = status.User.ProfileImageUrl.Replace("_normal", "");
                RetweetNameLabel.Content = "Retweeted by " + status.User.Name + " and " + status.RetweetCount.ToString() + " Users";
            }
            else
            {
                ProfileImage.ImageLocation = status.User.ProfileImageUrl.Replace("_normal", "");
                NameLabel.Content = status.User.Name + " @" + status.User.ScreenName;
                TextLabel.Content = WebUtility.HtmlDecode(status.Text);

                grid.Children.Remove(RetweetProfileImage);
                grid.Children.Remove(RetweetNameLabel);
            }

            if (TwitterTools.IsReply(status))
            {
                if (TwitterTools.IsReplyToMe(status))
                {
                    BackColor = Color.FromArgb(16, 16, 60);
                }
                else
                {
                    BackColor = Color.FromArgb(12, 55, 16);
                }
            }

            switch (parentFrame.Name)
            {
                case "MainFrame":
                    mainFrame = (MainFrame)control.TopLevelControl;

                    TimeLabel.Content = status.CreatedAt.LocalDateTime + " (via " + status.Source + ")";
                    TimeLabel.Location = new Point(59, TextLabel.Location.Y + TextLabel.Size.Height + 3);

                    // 画像位置調整
                    for (int i = 0; i < ImageBox.Length; i++)
                    {
                        if (imageBox[i] != null)
                        {
                            switch (i)
                            {
                                case 0:
                                    ImageBox1.Location = new Point(60, TimeLabel.Location.Y + TimeLabel.Size.Height + 3);
                                    break;
                                case 1:
                                    ImageBox2.Location = new Point(216, TimeLabel.Location.Y + TimeLabel.Size.Height + 3);
                                    break;
                                case 2:
                                    ImageBox3.Location = new Point(60, ImageBox1.Location.Y + ImageBox1.Size.Height + 3);
                                    break;
                                case 3:
                                    ImageBox4.Location = new Point(216, ImageBox2.Location.Y + ImageBox2.Size.Height + 3);
                                    break;
                                default:
                                    break;
                            }
                            StartButton.Location = new Point(50, 15);
                        }
                    }

                    if (status.IsFavorited.Value) FavoriteIcon.Image = Properties.Resources.favorite_b;

                    break;

                case "ProfileFrame":
                case "MentionFrame":
                    MaximumSize = new Size(240, 5000);
                    ProfileImage.Size = new Size(30, 30);

                    NameLabel.Location = new Point(35, 3);

                    TextLabel.Location = new Point(35, 18);
                    TextLabel.MinimumSize = new Size(205, 15);
                    TextLabel.MaximumSize = new Size(205, 4500);

                    TimeLabel.Text = status.CreatedAt.LocalDateTime + "\n(via " + status.Source + ")";
                    TimeLabel.Location = new Point(35, TextLabel.Location.Y + TextLabel.Size.Height + 3);

                    ReplyIcon.Location = new Point(170, TextLabel.Location.Y + TextLabel.Size.Height + 3);

                    RetweetIcon.Location = new Point(193, TextLabel.Location.Y + TextLabel.Size.Height + 3);

                    FavoriteIcon.Location = new Point(216, TextLabel.Location.Y + TextLabel.Size.Height + 3);

                    // 画像位置調整
                    for (int i = 0; i < ImageBox.Length; i++)
                    {
                        if (imageBox[i] != null)
                        {
                            imageBox[i].Size = new Size(120, 64);
                            switch (i)
                            {
                                case 0:
                                    ImageBox1.Location =
                                        new Point(ProfileImage.Location.X, TimeLabel.Location.Y + TimeLabel.Size.Height + 3);
                                    break;
                                case 1:
                                    ImageBox2.Location =
                                        new Point(ImageBox1.Location.X + ImageBox1.Size.Width + 4, TimeLabel.Location.Y + TimeLabel.Size.Height + 3);
                                    break;
                                case 2:
                                    ImageBox3.Location =
                                        new Point(ImageBox1.Location.X, ImageBox1.Location.Y + ImageBox1.Size.Height + 3);
                                    break;
                                case 3:
                                    ImageBox4.Location =
                                        new Point(ImageBox3.Location.X + ImageBox3.Size.Width + 4, ImageBox1.Location.Y + ImageBox1.Size.Height + 3);
                                    break;
                                default:
                                    break;
                            }
                            StartButton.Location = new Point(35, 7);
                        }
                    }

                    break;

                default:
                    break;
            }

            // リツイートユーザー情報の位置調整
            if (status.Entities.Media != null && status.ExtendedEntities.Media != null)
            {
                switch (status.ExtendedEntities.Media.Length)
                {
                    case 1:
                    case 2:
                        RetweetProfileImage.Location = new Point(3, ImageBox1.Location.Y + ImageBox1.Size.Height + 3);
                        RetweetNameLabel.Location = new Point(40, ImageBox1.Location.Y + ImageBox1.Size.Height + 3);
                        break;
                    case 3:
                    case 4:
                        RetweetProfileImage.Location = new Point(3, ImageBox3.Location.Y + ImageBox3.Size.Height + 3);
                        RetweetNameLabel.Location = new Point(40, ImageBox3.Location.Y + ImageBox3.Size.Height + 3);
                        break;
                }
            }
            else
            {
                RetweetProfileImage.Location = new Point(3, TimeLabel.Location.Y + TimeLabel.Size.Height + 3);
                RetweetNameLabel.Location = new Point(40, TimeLabel.Location.Y + TimeLabel.Size.Height + 3);
            }
        }
Esempio n. 31
0
        private User getUserFromScreenName(Tokens tokens, string screenName)
        {
            User user = null;
            try
            {
                user = tokens.Users.Show(screen_name => screenName);
            }
            catch(Exception)
            {

            }

            return user;
        }
 public TwitterUserInfoViewModel(CoreTweet.User user)
 {
     this.user = user;
 }
Esempio n. 33
0
 public SimpleUserViewModel()
 {
     user = new User();
 }
Esempio n. 34
0
        private void displayUser(ListView lv, User user)
        {
            string[] row = new string[]
            {
                user.ScreenName,
                user.Name
            };
            ListViewItem item = new ListViewItem(row);

            lv.Items.Add(item);
        }