コード例 #1
0
        public void CanBeBound_CommandWithoutType_ReturnTrue()
        {
            Type actualType = typeof(ObservableCommand);
            Type targetType = typeof(IObservableCommand);

            bool canBeBound = BindingUtils.CanBeBound(actualType, targetType);

            canBeBound.Should().BeTrue();
        }
コード例 #2
0
 private void _PressAnyKey()
 {
     if (BindingUtils.GetAnyPressedKey() != KeyCode.None)
     {
         anim.enabled = true;
         UI[1].SetActive(false);
         StartCoroutine(PressAnyAnimation());
     }
 }
コード例 #3
0
        public void CanBeBound_RawTypeToObservableCollection_ReturnFalse()
        {
            Type actualType = typeof(int);
            Type targetType = typeof(IReadOnlyObservableCollection <int>);

            bool canBeBound = BindingUtils.CanBeBound(actualType, targetType);

            canBeBound.Should().BeFalse();
        }
コード例 #4
0
        public void CanBeBound_VariableWithReferenceType_ReturnTrue()
        {
            Type actualType = typeof(ObservableVariable <string>);
            Type targetType = typeof(IReadOnlyObservableVariable <string>);

            bool canBeBound = BindingUtils.CanBeBound(actualType, targetType);

            canBeBound.Should().BeTrue();
        }
コード例 #5
0
        public void NeedsToBeBoxed_EventWithReferenceTypeToObject_ReturnFalse()
        {
            Type actualType = typeof(ObservableEvent <string>);
            Type targetType = typeof(IObservableEvent <object>);

            bool needsToBeBoxed = BindingUtils.NeedsToBeBoxed(actualType, targetType);

            needsToBeBoxed.Should().BeFalse();
        }
コード例 #6
0
        public void CanBeBound_CollectionWithBuiltInValueType_ReturnTrue()
        {
            Type actualType = typeof(ObservableCollection <int>);
            Type targetType = typeof(IReadOnlyObservableCollection <int>);

            bool canBeBound = BindingUtils.CanBeBound(actualType, targetType);

            canBeBound.Should().BeTrue();
        }
コード例 #7
0
        public void NeedsToBeBoxed_CollectionWithReferenceTypeToObject_ReturnFalse()
        {
            Type actualType = typeof(ObservableCollection <string>);
            Type targetType = typeof(IReadOnlyObservableCollection <object>);

            bool needsToBeBoxed = BindingUtils.NeedsToBeBoxed(actualType, targetType);

            needsToBeBoxed.Should().BeFalse();
        }
コード例 #8
0
        public void NeedsToBeBoxed_EventWithBuiltInValueTypeToObject_ReturnTrue()
        {
            Type actualType = typeof(ObservableEvent <int>);
            Type targetType = typeof(IObservableEvent <object>);

            bool needsToBeBoxed = BindingUtils.NeedsToBeBoxed(actualType, targetType);

            needsToBeBoxed.Should().BeTrue();
        }
コード例 #9
0
        public void NeedsToBeBoxed_CollectionWithBuiltInValueTypeToObject_ReturnTrue()
        {
            Type actualType = typeof(ObservableCollection <int>);
            Type targetType = typeof(IReadOnlyObservableCollection <object>);

            bool needsToBeBoxed = BindingUtils.NeedsToBeBoxed(actualType, targetType);

            needsToBeBoxed.Should().BeTrue();
        }
コード例 #10
0
        public void CanBeBound_RawTypeToObservableEvent_ReturnFalse()
        {
            Type actualType = typeof(int);
            Type targetType = typeof(IObservableEvent <int>);

            bool canBeBound = BindingUtils.CanBeBound(actualType, targetType);

            canBeBound.Should().BeFalse();
        }
コード例 #11
0
        public void CanBeBound_EventWithBuiltInValueType_ReturnTrue()
        {
            Type actualType = typeof(ObservableEvent <int>);
            Type targetType = typeof(IObservableEvent <int>);

            bool canBeBound = BindingUtils.CanBeBound(actualType, targetType);

            canBeBound.Should().BeTrue();
        }
コード例 #12
0
        private static void OnDecodeIpcMsgAuthCb(IntPtr userData, uint reqId, IntPtr authGranted)
        {
            var tcs = BindingUtils.FromHandlePtr <TaskCompletionSource <IpcMsg> >(userData);

            tcs.SetResult(
                new AuthIpcMsg(
                    reqId,
                    new AuthGranted(Marshal.PtrToStructure <AuthGrantedNative>(authGranted))));
        }
コード例 #13
0
        public Task <string> EncodeContainersRespAsync(IntPtr auth, ref ContainersReq req, uint reqId, bool isGranted)
        {
            var reqNative = req.ToNative();

            var(ret, userData) = BindingUtils.PrepareTask <string>();
            EncodeContainersRespNative(auth, ref reqNative, reqId, isGranted, userData, DelegateOnFfiResultStringCb);
            reqNative.Free();
            return(ret);
        }
コード例 #14
0
 /// <summary>
 /// Returns native registered app
 /// </summary>
 /// <returns></returns>
 internal RegisteredAppNative ToNative()
 {
     return(new RegisteredAppNative
     {
         AppInfo = AppInfo,
         ContainersPtr = BindingUtils.CopyFromObjectList(Containers),
         ContainersLen = (UIntPtr)(Containers?.Count ?? 0)
     });
 }
コード例 #15
0
            public ColorAssigmentOption(ReadOnlyDictionary <CalculationsMode, IChart> charts,
                                        AssignmentOfColorMethod assignmentOfColorMethod) : base(assignmentOfColorMethod, charts)
            {
                this.assignmentOfColorMethod = assignmentOfColorMethod;
                IsOption = true;
                Checked  = complexChart.ColorAssignmentMethod == assignmentOfColorMethod;

                BindingUtils.OnPropertyChanged(complexChart, nameof(complexChart.ColorAssignmentMethod), () =>
                                               Checked = complexChart.ColorAssignmentMethod == assignmentOfColorMethod);
            }
コード例 #16
0
 public Task <string> AuthAppAsync(
     string appId,
     string appName,
     string appVendor,
     string endpoint)
 {
     var(ret, userData) = BindingUtils.PrepareTask <string>();
     AuthAppNative(appId, appName, appVendor, endpoint, userData, DelegateOnFfiResultStringCb);
     return(ret);
 }
コード例 #17
0
            public ContourLinesOption(ReadOnlyDictionary <CalculationsMode, IChart> charts,
                                      CountourLinesMode contourLinesMode) : base(contourLinesMode, charts)
            {
                this.contourLinesMode = contourLinesMode;
                IsOption = true;
                Checked  = complexChart.CountourMode == contourLinesMode;

                BindingUtils.OnPropertyChanged(complexChart, nameof(complexChart.CountourMode), () =>
                                               Checked = complexChart.CountourMode == contourLinesMode);
            }
コード例 #18
0
 private static void OnFfiResultAppExchangeInfoListCb(
     IntPtr userData,
     IntPtr result,
     IntPtr appExchangeInfoPtr,
     UIntPtr appExchangeInfoLen)
 {
     BindingUtils.CompleteTask(
         userData,
         Marshal.PtrToStructure <FfiResult>(result),
         () => BindingUtils.CopyToObjectList <AppExchangeInfo>(appExchangeInfoPtr, (int)appExchangeInfoLen));
 }
コード例 #19
0
        protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
        {
            var calendarXItem = element as CalendarXItem;

            BindingUtils.BindingProperty(calendarXItem, CalendarXItem.ContentProperty, item, CalendarXItemModel.ContentProperty);
            BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsCheckedProperty, item, CalendarXItemModel.IsCheckedProperty, System.Windows.Data.BindingMode.TwoWay);
            BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsDownplayProperty, item, CalendarXItemModel.IsDownplayProperty);
            BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsTodayProperty, item, CalendarXItemModel.IsTodayProperty);
            BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsInRangeProperty, item, CalendarXItemModel.IsInRangeProperty);
            BindingUtils.BindingProperty(calendarXItem, CalendarXItem.IsEnabledProperty, item, CalendarXItemModel.IsEnabledProperty);
        }
コード例 #20
0
            public ContourLinesOption(IComplexChart complexChart,
                                      CountourLinesMode contourLinesMode) : base(contourLinesMode)
            {
                _complexChart         = complexChart;
                this.contourLinesMode = contourLinesMode;
                IsOption = true;
                Checked  = complexChart.CountourMode == contourLinesMode;

                BindingUtils.OnPropertyChanged(complexChart, nameof(complexChart.CountourMode), () =>
                                               Checked = complexChart.CountourMode == contourLinesMode);
            }
コード例 #21
0
            public ColorAssigmentOption(IComplexChart complexChart,
                                        AssignmentOfColorMethod assignmentOfColorMethod) : base(assignmentOfColorMethod)
            {
                _complexChart = complexChart;
                this.assignmentOfColorMethod = assignmentOfColorMethod;
                IsOption = true;
                Checked  = complexChart.ColorAssignmentMethod == assignmentOfColorMethod;

                BindingUtils.OnPropertyChanged(complexChart, nameof(complexChart.ColorAssignmentMethod), () =>
                                               Checked = complexChart.ColorAssignmentMethod == assignmentOfColorMethod);
            }
コード例 #22
0
 private static void OnFfiResultRegisteredAppListCb(
     IntPtr userData,
     IntPtr result,
     IntPtr registeredAppPtr,
     UIntPtr registeredAppLen)
 {
     BindingUtils.CompleteTask(
         userData,
         Marshal.PtrToStructure <FfiResult>(result),
         () => BindingUtils.CopyToObjectList <RegisteredAppNative>(registeredAppPtr, (int)registeredAppLen).
         Select(native => new RegisteredApp(native)).ToList());
 }
コード例 #23
0
            public LanguageOption(CultureInfo language)
            {
                Text          = language.NativeName;
                ToolTip       = language.EnglishName;
                this.language = language;

                CheckOnClick = true;
                IsOption     = true;
                Checked      = Equals(CultureInfo.CurrentCulture, language);
                BindingUtils.OnPropertyChanged(Settings.Default, nameof(Settings.Default.Language), () =>
                                               Checked = Equals(Settings.Default.Language, this.language));
            }
コード例 #24
0
        private static string RoundTripBinding(string indexer)
        {
            var indexerBinding = BindingUtils.GetIndexerBinding(indexer);

            var boundClass = new BoundClass {
                DataContext = new ReflectingIndexer()
            };

            boundClass.SetBinding(TextBlock.TextProperty, indexerBinding);

            return(boundClass.BoundValue);
        }
コード例 #25
0
    public void Setup(string _toMap)
    {
        bindingToMap = _toMap;

        // Automatically set the onclick function and change the name text to the binding.
        button.onClick.AddListener(OnClick);
        bindingName.text = _toMap;

        // Update the button text with the binding's value and make the GO active
        BindingUtils.UpdateTextWithBinding(bindingToMap, buttonText);
        gameObject.SetActive(true);
    }
コード例 #26
0
        private void InitTableData()
        {
            if (_haveInitedData)
            {
                return;
            }
            _haveInitedData = true;

            var data = (VolatilitySurfaceData <Tenor, Tenor>)DataContext;

            while (detailsList.Columns.Count > 1)
            {
                detailsList.Columns.RemoveAt(1);
            }

            foreach (var x in data.Xs)
            {
                var textBlockStyle = new Style(typeof(FrameworkElement));
                var binding        = BindingUtils.GetIndexerBinding(x.ToString());
                binding.Converter = new ValueToColorConverter(_zRange);
                textBlockStyle.Setters.Add(new Setter(BackgroundProperty, binding));

                detailsList.Columns.Add(new DataGridTextColumn
                {
                    Width     = 60,
                    Header    = x,
                    CellStyle = textBlockStyle,
                    Binding   = BindingUtils.GetIndexerBinding(x.ToString())
                });
            }

            var rows = new List <Dictionary <string, object> >();

            foreach (var y in data.Ys)
            {
                var row = new Dictionary <string, object>();
                row["Length"] = y;

                foreach (var x in data.Xs)
                {
                    double value;
                    if (data.TryGet(x, y, out value))
                    {
                        row[x.ToString()] = value;
                    }
                }

                rows.Add(row);
            }

            detailsList.ItemsSource = rows;
        }
コード例 #27
0
        public LegendPositionsCommand(ISharedViewState sharedViewState, LegendPlacementCommand legendPlacementCommand, LegendAligmentCommand legendAligmentCommand) : base(MenuStrings.legendPositions_Text)
        {
            _sharedViewState = sharedViewState;
            Visible          = _sharedViewState.CalculationsMode == CalculationsMode.Real;
            BindingUtils.OnPropertyChanged(_sharedViewState, nameof(_sharedViewState.CalculationsMode),
                                           () => Visible = _sharedViewState.CalculationsMode == CalculationsMode.Real);

            ChildrenCommands = new List <IToolbarCommand>
            {
                legendPlacementCommand,
                legendAligmentCommand
            };
        }
コード例 #28
0
        public RescaleCommand(ISharedViewState sharedViewState, FitAxesCommand fitAxesCommand, EqualAxesCommand equalAxesCommand) : base(MenuStrings.rescale_Text)
        {
            _sharedViewState = sharedViewState;
            Visible          = _sharedViewState.CalculationsMode == CalculationsMode.Fxy;
            BindingUtils.OnPropertyChanged(_sharedViewState, nameof(_sharedViewState.CalculationsMode),
                                           () => Visible = _sharedViewState.CalculationsMode == CalculationsMode.Fxy);

            ChildrenCommands = new List <IToolbarCommand>
            {
                fitAxesCommand,
                equalAxesCommand
            };
        }
コード例 #29
0
 public Task <ISafeData> InspectAsync(IntPtr app, string url)
 {
     var(task, userData) = BindingUtils.PrepareTask <ISafeData>();
     InspectNative(
         app,
         url,
         userData,
         DelegateOnFfiResultPublishedImmutableDataCb,
         DelegateOnFfiResultWalletCb,
         DelegateOnFfiResultSafeKeyCb,
         DelegateOnFfiResultFilesContainerCb,
         DelegateOnFfiFetchFailedCb);
     return(task);
 }
コード例 #30
0
 public Task <IpcReq> DecodeIpcMessage(IntPtr authPtr, string msg)
 {
     var(task, userData) = BindingUtils.PrepareTask <IpcReq>();
     AuthDecodeIpcMsgNative(
         authPtr,
         msg,
         userData,
         DelegateOnDecodeIpcReqAuthCb,
         DelegateOnDecodeIpcReqContainersCb,
         DelegateOnDecodeIpcReqUnregisteredCb,
         DelegateOnDecodeIpcReqShareMDataCb,
         DelegateOnFfiResultIpcReqErrorCb);
     return(task);
 }