Ejemplo n.º 1
0
        internal void Validate(List <CustomTableStyle> tableStyles)
        {
            if (DisplayName.Contains(" "))
            {
                throw new ValidationException($"TableOptions display name cannot contain spaces. Found '{DisplayName}'.");
            }

            if (CustomTableStyle != null && !tableStyles.Any(ts => ts.Name == CustomTableStyle))
            {
                throw new ValidationException($"Undefined CustomTableStyle '{CustomTableStyle}' was requested. Define it in the {nameof(Options)}.{nameof(Options.TableStyles)} provided in the {nameof(MagicSpreadsheet)} constructor.");
            }
        }
Ejemplo n.º 2
0
        public bool ContainsFilteredData(string searchData)
        {
            if (DisplayName != null && DisplayName.Contains(searchData))
            {
                return(true);
            }

            if (_remoteParty != null && _remoteParty.Contains(searchData))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        internal void RecalculateSliderPosition(int posX = -1)
        {
            var offset = RelativeOffset + Background.AlignOffset;

            if (MaxValue - MinValue == 0)
            {
                ControlHandle.AlignOffset = offset;
            }
            else if (posX > 0)
            {
                if (posX <= Background.Position.X)
                {
                    CurrentValue = MinValue;
                    ControlHandle.AlignOffset = offset;
                }
                else if (posX >= Background.Position.X + SliderWidth)
                {
                    CurrentValue = MaxValue;
                    ControlHandle.AlignOffset = offset + new Vector2(SliderWidth, 0);
                }
                else
                {
                    CurrentValue = (int)Math.Round(MinValue + ((posX - Background.Position.X) / SliderWidth) * (MaxValue - MinValue));
                    ControlHandle.AlignOffset = offset + new Vector2(((float)SliderWidth / (MaxValue - MinValue)) * (CurrentValue - MinValue), 0);
                }
            }
            else
            {
                if (CurrentValue == MinValue)
                {
                    ControlHandle.AlignOffset = offset;
                }
                else if (CurrentValue == MaxValue)
                {
                    ControlHandle.AlignOffset = offset + new Vector2(SliderWidth, 0);
                }
                else
                {
                    ControlHandle.AlignOffset = offset + new Vector2(((float)SliderWidth / (MaxValue - MinValue)) * (CurrentValue - MinValue), 0);
                }
            }

            if (DisplayName.Contains("{"))
            {
                TextHandle.TextValue = string.Format(DisplayName, CurrentValue, MinValue, MaxValue);
            }
            ValueDisplayHandle.TextValue = string.Format("{0}/{1}", CurrentValue, MaxValue);
            ValueDisplayHandle.ApplyToControlPosition(this);
        }
 public void CreateAzureIoTEdgeDevice()
 {
     if (!_parentPage._isSaaSSetup)
     {
         if ((DisplayName == null) ||
             (DisplayName == string.Empty) ||
             !DisplayName.StartsWith("HostName=") ||
             !DisplayName.Contains(".azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey="))
         {
             MessageBox.Show(Strings.IoTHubs, Strings.AboutSubtitle, MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             QueueUserWorkItem(CreateAzureIoTEdgeDevice, new AzureIoTHub(DisplayName));
         }
     }
     else
     {
         QueueUserWorkItem(CreateAzureIoTEdgeDevice, null);
     }
 }