本文整理汇总了C#中ReactiveList.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# ReactiveList.ToList方法的具体用法?C# ReactiveList.ToList怎么用?C# ReactiveList.ToList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReactiveList
的用法示例。
在下文中一共展示了ReactiveList.ToList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrackingControlViewModel
public TrackingControlViewModel(ITrackPresenter TrackPresenter, IMappingService MappingService, TrackFormatterManager TrackFormatterManager)
{
_trackPresenter = TrackPresenter;
_trackFormatterManager = TrackFormatterManager;
_mappingService = MappingService;
_track = new ReactiveList<EarthPoint>();
_track.Changed
.Subscribe(_ => RefreshTrack());
LoadTrack = ReactiveCommand.CreateAsyncTask(LoadTrackImpl);
SaveTrack = ReactiveCommand.CreateAsyncTask(SaveTrackImpl);
ReactiveCommand<object> clearCommand = ReactiveCommand.Create(_track.IsEmptyChanged.Select(e => !e));
clearCommand.Subscribe(_ => _track.Clear());
ClearTrack = clearCommand;
IConnectableObservable<TrackPathRider> prp =
_track.Changed
.Select(_ => new TrackPathRider(new GpsTrack(_track.ToList())))
.Publish();
PathRider = prp;
prp.Connect();
_mappingService.Clicks
.Where(c => c.Action == MouseAction.LeftClick)
.Subscribe(c => AppendPointToTrack(c.Point));
_mappingService.Clicks
.Where(c => c.Action == MouseAction.RightClick)
.Subscribe(c => _track.Remove(_track.LastOrDefault()));
}
示例2: SolverEventArgs
public SolverEventArgs(Population population,int generation,long evaluations,ReactiveList<BeamToCut> beams):base(population,generation,evaluations)
{
_totalCuttingMass = new Mass(0);
_totalCuttingCost = new Currency(0);
_totalWasteCost = new Currency(0);
TotalToCut = 0;
beams.ToList().ForEach(item => TotalToCut += item.TotalLength);
foreach (var gene in Fittest.Genes)
{
var cutplan = (gene.ObjectValue as CutPlan);
CutPlan.Add(cutplan);
if (Debugger.IsAttached && cutplan.CutLength==2450) Debugger.Break();
_totalWaste += cutplan.IsRealWaste?cutplan.Waste:0 /*(cutplan.Waste == cutplan.StockLength && cutplan.IsRealWaste) ? 0 : cutplan.Waste*/;
_totalStock += (cutplan.Waste == cutplan.StockLength && cutplan.IsRealWaste) ? 0 : cutplan.StockLength;
_totalCut += cutplan.CutLength;
_totalUncut += (cutplan.Waste == cutplan.StockLength && cutplan.IsRealWaste) ? cutplan.StockLength : 0;
_totalCuttingMass += cutplan.TotalCutMass;
_totalCuttingCost += cutplan.TotalCutCost;
_totalWasteCost += cutplan.TotalWasteCost;
}
}
示例3: CreateTicketsViewModel
public CreateTicketsViewModel(ISession session, IScreen screen = null)
{
#region Initialization
HostScreen = screen ?? new DefaultScreen(RxApp.DependencyResolver);
GoBack = HostScreen.Router.NavigateBack;
CurrentBatch = new ReactiveList<TicketItemViewModel>();
Customers = new ReactiveList<Customer>();
#endregion
#region Populate Customer List
session.FetchResults<Customer>()
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(c => Customers.Add(c));
#endregion
#region Wire Up Commands
AddTicket = new ReactiveCommand(
this.WhenAny(
x => x.CurrentBatch,
y => y.Problem,
z => z.SelectedCustomer,
(x, y, z) => x.Value.Count() <= 100 &&
!string.IsNullOrWhiteSpace(y.Value) &&
z.Value != null));
AddTicket.Subscribe(_ =>
{
CurrentBatch.Add(new TicketItemViewModel(Problem, CurrentBatch.Remove));
Problem = default(string);
});
var anyInList = CurrentBatch.Changed.Select(_ => CurrentBatch.Any());
var isCustomerSelected = this.WhenAnyValue(x => x.SelectedCustomer).Select(x => x != null);
var shouldSaveChanges = Observable.CombineLatest(anyInList, isCustomerSelected, (x, y) => x && y);
SaveChanges = new ReactiveCommand(shouldSaveChanges.StartWith(false));
_isExecuting = session.IsWorking.ToProperty(this, x => x.IsExecuting, false);
SaveChanges.Select(x => CurrentBatch.ToList())
.Subscribe(x =>
{
using (INotifyWhenComplete token = session.ScopedChanges())
{
var ticketTaker = session.Take<Ticket>();
token.Completion
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(b => { if (b) (CurrentBatch as IList).Clear(); });
foreach (var item in x)
{
ticketTaker.Add(new Ticket
{
Description = item.Description,
CustomerId = SelectedCustomer.Id
});
}
}
});
#endregion
}