Esempio n. 1
0
    public void BlinqShouldEqualLinqNativeArraySinglePredicate([ArrayValues] int[] sourceArr)
    {
        var source   = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var expected = ExceptionAndValue(() => Linq.Single(source, EqualsZero.Invoke));
        var actual   = ExceptionAndValue(() => source.Single(EqualsZero));

        AssertAreEqual(expected, actual);
        source.Dispose();
    }
Esempio n. 2
0
    public void BlinqShouldEqualLinqNativeSequenceSingle([ArrayValues] int[] sourceArr)
    {
        var sourceNativeArr = new NativeArray <int>(sourceArr, Allocator.Persistent);
        var source          = sourceNativeArr.ToValueSequence();
        var expected        = ExceptionAndValue(() => Linq.Single(source));
        var actual          = ExceptionAndValue(() => source.Single());

        AssertAreEqual(expected, actual);
        sourceNativeArr.Dispose();
    }
Esempio n. 3
0
        public JobToForceViewModel(IShellService shellService, IForcesService forceService, IJobService jobService,
                                   Force force)
        {
            this.shellService = shellService;
            this.forceService = forceService;
            this.jobService   = jobService;

            this.SelectedForce = force;
            //      this.selectedJob = new Job();

            this.availableJobsList = new ObservableCollection <Job>();
            this.AvailableJobsView = new ListCollectionView(this.availableJobsList);

            this.assignedJobsList = new ObservableCollection <Job>();
            this.AssignedJobsView = new ListCollectionView(this.assignedJobsList);

            this.changedJobs = new ObservableCollection <Job>();

            // Configure shell
            this.ShellViewState = ShellViewState.Embedded;

            this.undockingCommandBarButton = new ShellCommandBarButton
            {
                ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_shell.scale-150.png"),
                Label    = "Abdocken",
                Command  = new RelayCommand(() =>
                {
                    this.View.DataContext = new ForceToJobViewModel(this.shellService, this.forceService,
                                                                    this.jobService, this.SelectedJob);
                    var newView = new ForceToJob {
                        DataContext = this
                    };
                    this.shellService.ShowInNewTab("Neue Zuweisung", newView, this, true);
                }),
                Width = 284
            };

            this.showInTabCommandBarButton = new ShellCommandBarButton
            {
                ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_shell.scale-150.png"),
                Label    = "Im Hauptfenster andocken",
                Command  = new RelayCommand(() =>
                {
                    this.shellService.ShowWindowInNewTab(this.window);
                    this.window = null;
                }),
                Visibility = Visibility.Collapsed
            };

            this.showInWindowCommandBarButton = new ShellCommandBarButton
            {
                ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/open_in_window.scale-150.png"),
                Label    = "In Fenster öffnen",
                Command  = new RelayCommand(() =>
                {
                    var shellViewModel = SimpleIoc.Default.GetInstance <ShellViewModel>();
                    var shellTab       = Enumerable.Single(shellViewModel.ShellTabs, tab => Equals(tab.View, this.View));
                    this.window        = this.shellService.ShowTabInNewWindow(shellTab);
                })
            };

            this.saveAndCloseCommandBarButton = new ShellCommandBarButton
            {
                ImageUri = new Uri("pack://application:,,/Resources/Images/ShellIcons/save_green.scale-150.png"),
                Label    = "Speichern und schließen",
                Command  = this.SaveJobAssignmentCommand
            };

            this.cancelAndCloseCommandBarButton = new ShellCommandBarButton
            {
                ImageUri =
                    new Uri("pack://application:,,/Resources/Images/ShellIcons/delete_sign_red.scale-150.png"),
                Label   = "Abbrechen und schließen",
                Command = this.CancelJobAssignmentCommand
            };

            this.CommandBarItems = new ObservableCollection <ShellCommandBarItem>
            {
                this.undockingCommandBarButton,
                this.showInTabCommandBarButton,
                this.showInWindowCommandBarButton,
                new ShellCommandBarSeparator(),
                this.saveAndCloseCommandBarButton,
                this.cancelAndCloseCommandBarButton
            };
        }
Esempio n. 4
0
 public static TSource Single <TSource>(this IEnumerable <TSource> source, Func <TSource, bool> predicate) =>
 LinqEnumerable.Single(source, predicate);
Esempio n. 5
0
 public static TSource Single <TSource>(this IEnumerable <TSource> source) =>
 LinqEnumerable.Single(source);