예제 #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)
     });
 }
            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);
            }
 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));
 }
        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;
        }
        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
            };
        }
 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);
 }