Inheritance: AcManager.Tools.AcObjectsNew.AcObjectNew, IComparer
        public void OnUri(Uri uri) {
            _type = uri.GetQueryParamEnum<OnlineManagerType>("Mode");
            _manager = BaseOnlineManager.ManagerByMode(_type);

            var id = uri.GetQueryParam("Id");
            if (id == null) {
                throw new Exception(ToolsStrings.Common_IdIsMissing);
            }

            _entry = _manager.GetById(id);
            if (_entry == null) {
                throw new Exception(string.Format(AppStrings.Online_ServerWithIdIsMissing, id));
            }
        }
Ejemplo n.º 2
0
        private async Task ScanDefferedAsync() {
            BackgroundLoading = true;
            Pinged = 0;

            await Task.Run(() => {
                KunosApiProvider.TryToGetLanList(async i => {
                    try {
                        var entry = new ServerEntry(this, i, true);
                        InnerWrappersList.Add(new AcItemWrapper(this, entry));
                        if (entry.Status == ServerStatus.Unloaded) {
                            await entry.Update(ServerEntry.UpdateMode.Lite); // BUG: Wait?
                        }
                        Pinged++;
                    } catch (Exception e) {
                        Logging.Warning("Cannot create ServerEntry: " + e);
                    }
                });
            });

            BackgroundLoading = false;
        }
 public ViewModel(ServerEntry entry) {
     Entry = entry;
     FancyBackgroundManager.Instance.ChangeBackground(Entry.Track?.PreviewImage);
 }
Ejemplo n.º 4
0
        public void Show(ServerEntry server) {
            ServerEntry = server;

            if (!ReferenceEquals(DataContext, this)) {
                DataContext = this;
                InitializeComponent();
                Show();

                Owner = Application.Current.MainWindow;

                _timer = new DispatcherTimer {
                    Interval = TimeSpan.FromSeconds(1),
                    IsEnabled = true
                };
                _timer.Tick += OnTick;
            }

            Car = server.SelectedCarEntry?.CarObject;
            Track = server.Track;

            try {
                _ignoreSkinChange = true;
                Skin = server.GetSelectedCarSkin();
            } finally {
                _ignoreSkinChange = false;
            }

            Buttons = new[] {
                CreateExtraStyledDialogButton("Go.Button", AppStrings.Common_Go, () => ServerEntry?.JoinCommand.Execute(ServerEntry.ActualJoin), () => Ready),
                CancelButton
            };
        }