Example #1
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            PinAction pinAction = PinAction.None;

            if (value != null)
            {
                pinAction = (PinAction)value;
            }

            switch (pinAction)
            {
            case PinAction.AnalogRead:
                return(Application.Current.Resources["Emerald"]);

            case PinAction.AnalogWrite:
                return(Application.Current.Resources["Sunflower"]);

            case PinAction.AnalogWriteDac:
                return(Application.Current.Resources["PinOrange"]);

            case PinAction.DigitalRead:
                return(Application.Current.Resources["Cyan"]);

            case PinAction.DigitalWrite:
                return(Application.Current.Resources["Alizarin"]);

            case PinAction.None:
            default:
                return(new SolidColorBrush(Colors.Transparent));
            }
        }
Example #2
0
        private void SetConfiguredAction(PinButton pinButton, PinAction pinAction = PinAction.None)
        {
            PinSetup.Hide();
            var pin = (Pin)pinButton.DataContext;

            pin.Value            = 0;
            pin.ConfiguredAction = pinAction;
            SavePinState(pin);
        }
        public void ResetPin(PinAction pinAction = PinAction.None)
        {
            configuredAction = pinAction;
            value            = 0;
            valueText        = "";
            valuePercent     = 0;
            valueKnown       = false;

            OnPropertyChanged("ConfiguredAction");
            OnPropertyChanged("Value");
            OnPropertyChanged("ValueText");
            OnPropertyChanged("ValuePercent");
            OnPropertyChanged("ValueKnown");
        }
Example #4
0
        public void PinToStart(PinAction _action)
        {
            if (!File.Exists(this.ShortCutLnkFile))
            {
                throw new FileNotFoundException(this.ShortCutLnkFile);
            }

            try
            {
                Jrfc.Shell.Pin(this.ShortCutLnkFile, Shell.PIN_DESTINATION.Start, this.CachedIconFile);
            }
            catch (System.Exception x)
            {
                Jrfc.Exception.HandleException(x);
            }
        }
Example #5
0
        public static void SetDevicePinAction(string deviceId, string tinkerId, PinAction pinAction)
        {
            var devicePinActions = GetDevicePinActions(deviceId);

            if (devicePinActions.ContainsKey(tinkerId))
            {
                if (pinAction == PinAction.None)
                {
                    devicePinActions.Remove(tinkerId);
                }
                else
                {
                    devicePinActions[tinkerId] = pinAction;
                }
            }
            else if (pinAction != PinAction.None)
            {
                devicePinActions.Add(tinkerId, pinAction);
            }

            localSettings.Values["DevicePinActions"] = JsonConvert.SerializeObject(devicesPinActions);
        }
        private void OnActionSelected(MapIcon pin, PinAction action)
        {
            switch (action)
            {
            case PinAction.Delete:
                var myPin = new MyPin
                {
                    Coordinate = new Coordinate(pin.Location.Position.Latitude, pin.Location.Position.Longitude),
                    MyType     = MyPinType.Undefined
                };
                _pins.RemovePin(myPin);

                var window = _nativeMap.Children.FirstOrDefault(el => el is PinInfo);
                if (window != null)
                {
                    _nativeMap.Children.Remove(window);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Example #7
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            PinAction pinAction = PinAction.None;

            if (value != null)
            {
                pinAction = (PinAction)value;
            }

            switch (pinAction)
            {
            case PinAction.AnalogRead:
            case PinAction.AnalogWrite:
            case PinAction.AnalogWriteDac:
            case PinAction.DigitalRead:
            case PinAction.DigitalWrite:
                return(Application.Current.Resources["TinkerPinBackgroundSelected"]);

            case PinAction.None:
            default:
                return(Application.Current.Resources["TinkerPinBackground"]);
            }
        }
 private void SetConfiguredAction(PinButton pinButton, PinAction pinAction = PinAction.None)
 {
     PinSetup.Hide();
     var pin = (Pin)pinButton.DataContext;
     pin.Value = 0;
     pin.ConfiguredAction = pinAction;
     SavePinState(pin);
 }
        public static void SetDevicePinAction(string deviceId, string tinkerId, PinAction pinAction)
        {
            var devicePinActions = GetDevicePinActions(deviceId);

            if (devicePinActions.ContainsKey(tinkerId))
            {
                if (pinAction == PinAction.None)
                {
                    devicePinActions.Remove(tinkerId);
                }
                else
                {
                    devicePinActions[tinkerId] = pinAction;
                }

            }
            else if (pinAction != PinAction.None)
            {
                devicePinActions.Add(tinkerId, pinAction);
            }

            localSettings.Values["DevicePinActions"] = JsonConvert.SerializeObject(devicesPinActions);
        }
Example #10
0
        public void ResetPin(PinAction pinAction = PinAction.None)
        {
            configuredAction = pinAction;
            value = 0;
            valueText = "";
            valuePercent = 0;
            valueKnown = false;

            OnPropertyChanged("ConfiguredAction");
            OnPropertyChanged("Value");
            OnPropertyChanged("ValueText");
            OnPropertyChanged("ValuePercent");
            OnPropertyChanged("ValueKnown");
        }
Example #11
0
 public Pin(string tinkerId, PinType pinType, string name, PinAction[] functions, string caption = null, int maxAnalogWriteValue = AnalogWriteMax)
 {
     this.tinkerId = tinkerId;
     this.pinType = pinType;
     this.name = name;
     this.functions = functions;
     if (string.IsNullOrWhiteSpace(caption))
         this.caption = name;
     else
         this.caption = caption;
     this.maxAnalogWriteValue = maxAnalogWriteValue;
     syncing = false;
     ResetPin();
 }