public void FetchNewMessages(APIAccess api) { if (fetchReq != null) return; fetchReq = new GetMessagesRequest(careChannels, lastMessageId); fetchReq.Success += delegate (List<Message> messages) { foreach (Message m in messages) { careChannels.Find(c => c.Id == m.ChannelId).AddNewMessages(m); } lastMessageId = messages.LastOrDefault()?.Id ?? lastMessageId; Debug.Write("success!"); fetchReq = null; }; fetchReq.Failure += delegate { Debug.Write("failure!"); fetchReq = null; }; api.Queue(fetchReq); }
public void APIStateChanged(APIAccess api, APIState state) { switch (state) { case APIState.Online: Config.Set(OsuConfig.Username, Config.Get<bool>(OsuConfig.SaveUsername) ? API.Username : string.Empty); Config.Set(OsuConfig.Password, Config.Get<bool>(OsuConfig.SavePassword) ? API.Password : string.Empty); break; } }
public void APIStateChanged(APIAccess api, APIState state) { switch (state) { case APIState.Online: initializeChannels(); break; default: messageRequest?.Cancel(); break; } }
public void APIStateChanged(APIAccess api, APIState state) { switch (state) { default: Text = @"Guest"; avatar.UserId = 1; break; case APIState.Online: Text = api.Username; avatar.UserId = api.LocalUser.Value.Id; break; } }
public void APIStateChanged(APIAccess api, APIState state) { switch (state) { case APIState.Offline: Children = new Drawable[] { new LoginForm() }; break; case APIState.Failing: Children = new Drawable[] { new SpriteText { Text = "Connection failing :(", }, }; break; case APIState.Connecting: Children = new Drawable[] { new SpriteText { Text = "Connecting...", }, }; break; case APIState.Online: Children = new Drawable[] { new SpriteText { Text = $"Connected as {api.Username}!", }, new OsuButton { RelativeSizeAxes = Axes.X, Text = "Sign out", Action = api.Logout } }; break; } }
private void load() { Dependencies.Cache(this); Dependencies.Cache(Config); Dependencies.Cache(new BeatmapDatabase(Host.Storage, Host)); Dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 0.01f }, true); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera")); OszArchiveReader.Register(); Dependencies.Cache(API = new APIAccess { Username = Config.Get<string>(OsuConfig.Username), Password = Config.Get<string>(OsuConfig.Password), Token = Config.Get<string>(OsuConfig.Token) }); API.Register(this); }
private void load(APIAccess api) { this.api = api; api.Register(this); }
private void load(APIAccess api, OsuConfigManager config) { api.Register(this); }
private void load(APIAccess api) { this.api = api; }
private void load(APIAccess api) { api?.Register(this); }