コード例 #1
0
        public async void AddTracker()
        {
            var mgr = IoC.Get <IWindowManager>();

            var dialog = new DialogBoxViewModel(LocalizationProvider.GetLocalizedValue(nameof(Resources.Strings.AddTrackerTitile)), string.Empty, false);
            var result = await mgr.ShowDialogAsync(dialog);

            var maxId = Trackers.Max(x => x.ID) + 1;


            if (dialog.Value is not null)
            {
                var tracker = new TransmissionTorrentTrackers()
                {
                    announce = dialog.Value.ToString(),
                    ID       = maxId
                };
                if (result == true && !Trackers.Contains(tracker))
                {
                    Trackers.Add(tracker);
                    toAdd.Add(dialog.Value.ToString());
                }
            }
        }