Exemplo n.º 1
0
    public void addPin(PinType pinType, int slot)
    {
        if (!_pins.ContainsKey(pinType))
            _pins.Add(pinType, new List<ComponentPin>());

        GameObject[] pins = new GameObject[4];
        ComponentPin[] compPins = new ComponentPin[4];

        for (int i = 0; i < 4; i++)
        {
            pins[i] = NGUITools.AddChild(pinGroup, SchemController.pinPrefab);
            ComponentPin compPin = pins[i].GetComponent<ComponentPin>();
            compPin.setType(pinType);
            compPin.rotate(i);

            _pins[pinType].Add(compPin);

            compPin.getPin().getSprite().alpha = 0.5f;
            compPin.getPin().setComponent(this);
        }

        pins[0].transform.localPosition = new Vector3(_spr.width - 12f, 16f * slot, 0f);
        pins[1].transform.localPosition = new Vector3(_spr.width - 16f*slot, _spr.height - 12f, 0f);
        pins[2].transform.localPosition = new Vector3(12f, _spr.height - 16f * slot, 0f);
        pins[3].transform.localPosition = new Vector3(16f * slot, 12f, 0f);
    }
Exemplo n.º 2
0
    public void setType(PinType pinType)
    {
        UISprite spr = spriteObject.GetComponent<UISprite>();
        spr.color = pinTypes[pinType].pinColor;

        UILabel lbl = labelObject.GetComponent<UILabel>();
        lbl.text = pinTypes[pinType].labelChar;
    }
Exemplo n.º 3
0
 public void Write(PinType pin, bool on)
 {
     var val = on ? 1 : 0;
     var folder = string.Format("{0}gpio{1}/direction", GPIO_FOLDER, pin.ToString().Substring(4));
     Execute(folder, "out");
     folder = string.Format("{0}gpio{1}/value", GPIO_FOLDER, pin.ToString().Substring(4));
     Execute(folder, val.ToString());
 }
Exemplo n.º 4
0
 public MapPin(string title, DB_station station, PinType pinType = PinType.RegularPin, PinSize pinSize = PinSize.Big, Action<MapPin> tappedCallback2 = null)
 {
     m_title = title;
     m_station = station;
     m_pinType = pinType;
     m_pinSize = pinSize;
     m_tappedCallback = tappedCallback2;
     createPin(title, pinType);
 }
Exemplo n.º 5
0
 public void setActivePinType(PinType pinType)
 {
     foreach (KeyValuePair<PinType, List<ComponentPin>> pair in _pins)
     {
         foreach (ComponentPin pin in pair.Value)
         {
             NGUITools.SetActive(pin.gameObject, pair.Key == pinType);
         }
     }
 }
Exemplo n.º 6
0
        public DevicePin Create(Circuit circuit, PinType pinType, int bitWidth)
        {
            PinSide   pinSide = BasePin.DefaultSide((circuit is Pin circuitPin) ? (circuitPin.PinType == PinType.Input ? PinType.Output : PinType.Input) : pinType);
            DevicePin pin     = this.CreateItem(Guid.NewGuid(), circuit, bitWidth, pinType, pinSide, false,
                                                this.UniqueName(BasePin.DefaultName(pinType), circuit),
                                                DevicePinData.NoteField.Field.DefaultValue, DevicePinData.JamNotationField.Field.DefaultValue
                                                );

            pin.Order = this.order++;
            return(pin);
        }
Exemplo n.º 7
0
        public void addMarcador(Map mapa, PinType tipoPin, string nombre, double latitud, double longitud)
        {
            var pin = new Pin
            {
                Type     = tipoPin,
                Label    = nombre,
                Position = new Position(latitud, longitud)
            };

            mapa.Pins.Add(pin);
        }
Exemplo n.º 8
0
 public void AddPin(Position position, string address, string label, PinType pinType)
 {
     _position = position;
     MyMap.Pins.Add(new Pin
     {
         Address  = address,
         Label    = label,
         Position = position,
         Type     = pinType
     });
 }
Exemplo n.º 9
0
        public void Dispose()
        {
            // Copy the pins to another collection.
            var pins = new PinType[_activepins.Count];
            _activepins.CopyTo(pins, 0);

            // Unexport all of the current used pins.
            foreach (var pin in pins)
                UnExport(pin);

            // At this point, _activepins is empty.
        }
Exemplo n.º 10
0
        private Pin SetPin(string label, PinType pinType, Position position)
        {
            Pin pin = new Pin
            {
                Label    = label,
                Type     = pinType,
                Position = position
            };

            _map.Pins.Add(pin);
            return(pin);
        }
Exemplo n.º 11
0
        private void CreateDevicePin(Pin pin)
        {
            PinType pinType = pin.PinType;

            if (pinType != PinType.None)
            {
                DevicePin devicePin = this.CircuitProject.DevicePinSet.Create(
                    pin, PinType.None, pin.BitWidth
                    );
                devicePin.Inverted = pin.Inverted;
            }
        }
Exemplo n.º 12
0
 // Overloaded Constructors
 public PointData(PinType type, string label, Position position, bool init = true)
 {
     _Type       = type;
     _Label      = label;
     _Position   = new Position(position.Latitude, position.Longitude);
     _Icon       = SetIcon();
     _ActiveIcon = SetActiveIcon();
     if (init)
     {
         Init();
     }
 }
Exemplo n.º 13
0
        public Pin Create(LogicalCircuit logicalCircuit, PinType pinType, int bitWidth)
        {
            Pin pin = this.CreateItem(Guid.NewGuid(), logicalCircuit, bitWidth, pinType,
                                      BasePin.DefaultSide(pinType),
                                      PinData.InvertedField.Field.DefaultValue,
                                      this.UniqueName(BasePin.DefaultName(pinType), logicalCircuit),
                                      PinData.NoteField.Field.DefaultValue,
                                      PinData.JamNotationField.Field.DefaultValue
                                      );

            this.CreateDevicePin(pin);
            return(pin);
        }
Exemplo n.º 14
0
 public void AddPin(string name, Vector3 pos, PinType type, bool isChecked)
 {
     if (!m_mergedPins.Exists(x => x.Name == name))
     {
         m_mergedPins.Add(new Pin
         {
             Name      = name,
             Pos       = pos,
             Type      = type,
             IsChecked = isChecked
         });
     }
 }
Exemplo n.º 15
0
 public Condition(
     string port,
     PinType pinType,
     byte pinNumber,
     char sign,
     int rawValue)
 {
     Port      = port;
     PinType   = pinType;
     PinNumber = pinNumber;
     Sign      = sign;
     RawValue  = rawValue;
 }
Exemplo n.º 16
0
        // GET: /PinTypes/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PinType pinType = db.PinTypes.Find(id);

            if (pinType == null)
            {
                return(HttpNotFound());
            }
            return(View(pinType));
        }
        // Instance method to create a pin placeholder to the custom map
        public void CreatePinPlaceholder(PinType pinType, double latitude, double longitude, String label, String address, int Id)
        {
            customMap.Pins.Add(new Pin
            {
                Type     = pinType,
                Position = new Xamarin.Forms.Maps.Position(latitude, longitude),
                Label    = label,
                Address  = address,
                Id       = Id
            });

            // Show the users current location on the map
            customMap.IsShowingUser = true;
        }
Exemplo n.º 18
0
 public Request(
     int?id,
     string port,
     Action action,
     PinType pinType,
     byte pinNumber,
     int value)
 {
     Id        = id;
     Port      = port;
     Action    = action;
     PinType   = pinType;
     PinNumber = pinNumber;
     Value     = value;
 }
Exemplo n.º 19
0
        private void OnEnable()
        {
            if (pinObj == null)
            {
                pinObj = transform;
            }
            if (labEntryParent == null)
            {
                Transform tempChild = pinObj;
                while (labEntryParent == null && tempChild != null)
                {
                    if (tempChild.name.StartsWith("LabEntry:"))
                    {
                        if (labEntryParent == null)
                        {
                            labEntryParent = tempChild;
                        }
                        else
                        {
                            nested = true;
                            break;
                        }
                    }
                    tempChild = tempChild.parent;
                }
            }
            if (pinType == PinType.None && pinObj != null)
            {
                switch (pinObj.name)
                {
                case "DialoguePin":
                    pinType = PinType.Dialogue;
                    break;

                case "QuizPin":
                    pinType = PinType.Quiz;
                    break;

                default:
                    pinType = PinType.None;
                    break;
                }
            }
            if (labEntryParent == null)
            {
                Debug.LogWarning("Don't forget to assign the Lab Entry Parent and Nested variables!", gameObject);
            }
        }
Exemplo n.º 20
0
        public bool CreateMergedWorldWithPins(out string error)
        {
            try
            {
                error = string.Empty;
                foreach (var pp in _profiles)
                {
                    ZPackage zPackage = new ZPackage(pp.m_worldData[_worldId].m_mapData);
                    _mapData.m_mapVersion = zPackage.ReadInt();
                    int textureSize = zPackage.ReadInt();

                    if (_mapData.m_textureSize != textureSize)
                    {
                        return(false);
                    }

                    for (int i = 0; i < (_mapData.m_textureSize * _mapData.m_textureSize); i++)
                    {
                        _mapData.m_mergedWorld[i] = (byte)(_mapData.m_mergedWorld[i] | Convert.ToByte(zPackage.ReadBool()));
                    }

                    if (_mapData.m_mapVersion >= 2)
                    {
                        int pinCount = zPackage.ReadInt();
                        for (int j = 0; j < pinCount; j++)
                        {
                            string  name      = zPackage.ReadString();
                            Vector3 pos       = zPackage.ReadVector3();
                            PinType type      = (PinType)zPackage.ReadInt();
                            bool    isChecked = _mapData.m_mapVersion >= 3 && zPackage.ReadBool();

                            _mapData.AddPin(name, pos, type, isChecked);
                            _mapData.AddProfilePin(pp.GetPlayerId(), name, pos, type, isChecked);
                        }
                    }
                    if (_mapData.m_mapVersion >= 4)
                    {
                        _mapData.m_isReferencePositionPublic = zPackage.ReadBool();
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Exemplo n.º 21
0
 public PointData(PinType type, string label, Position position, string address, int value, DateTime startDate, DateTime endDate, bool init = true)
 {
     _Type       = type;
     _Label      = label;
     _Position   = new Position(position.Latitude, position.Longitude);
     _Address    = address;
     _Value      = value;
     _StartDate  = startDate;
     _EndDate    = endDate;
     _Icon       = SetIcon();
     _ActiveIcon = SetActiveIcon();
     if (init)
     {
         Init();
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// Clears the pins.
 /// </summary>
 /// <param name="type">Type.</param>
 public void ClearPins(PinType type)
 {
     Pins.RemoveAll(o => o.Type == type);
     if (OnPinsUpdated != null)
     {
         OnPinsUpdated.Invoke(this, new ControllerPinUpdateArgs(null, UpdateOperation.Clear));
     }
     if (type == PinType.DIGITAL)
     {
         ClearSequences();
     }
     else if (type == PinType.ANALOG)
     {
         ClearMeasurementCombinations();
     }
 }
Exemplo n.º 23
0
        public ActionResult DeleteConfirmed(int id)
        {
            PinType pinType   = db.PinTypes.Find(id);
            var     pinTypeId = pinType.ID;

            // First, find all the Map_Boards that have this pin
            // and reassign them to have the default pin type
            var mapBoards = from a in db.Map_Boards
                            where a.PinTypeID == id
                            select a;

            foreach (Map_Boards thisMapBoard in mapBoards)
            {
                thisMapBoard.PinTypeID       = 1; // the default pin type
                db.Entry(thisMapBoard).State = EntityState.Modified;
            }


            // get the filename
            var fileName = Path.GetFileName(pinType.Image);

            // get the path to the file
            var path = Path.Combine(Server.MapPath("~/Images/Icons"), fileName);

            // delete the file
            try
            {
                if (System.IO.File.Exists(path))
                {
                    System.IO.File.Delete(path);
                }
            }
            catch (Exception)
            {
                ModelState.AddModelError("uploadError", "Can't delete the file.");
            }


            db.PinTypes.Remove(pinType);
            db.SaveChanges();

            var redirectURL = "../../PinTypes";

            return(Redirect(redirectURL));
        }
Exemplo n.º 24
0
        public bool ChangePIN(PinType PinType, string oldPin, string newPin)
        {
            if (IsOpen)
            {
                byte[] pbOld = System.Text.Encoding.Default.GetBytes(oldPin);
                byte[] pbNew = System.Text.Encoding.Default.GetBytes(newPin);

                if (SunKeyAPI.Dev_SunKeyChangePIN(mSunKeyHandle, (byte)PinType, pbOld, (short )pbOld.Length, pbNew, (short)pbNew.Length))
                {
                    return(true);
                }
                else
                {
                    System.Console.Out.WriteLine("SunkeyLastErr = " + new SunKeyException().FullMessage);
                }
            }
            return(false);
        }
Exemplo n.º 25
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();
 }
Exemplo n.º 26
0
        public bool UnBlockPIN(PinType PinType, string unBlockPin)
        {
            if (IsOpen)
            {
                byte[] pbUnBlockPin = System.Text.Encoding.Default.GetBytes(unBlockPin);

                if (SunKeyAPI.Dev_SunKeyUnBlockPIN(mSunKeyHandle, (byte)PinType, pbUnBlockPin, (short)pbUnBlockPin.Length))
                {
                    mPinCount = MAXPINCOUNT;
                    return(true);
                }
                else
                {
                    System.Console.Out.WriteLine("SunkeyLastErr = " + new SunKeyException().FullMessage);
                }
            }
            return(false);
        }
Exemplo n.º 27
0
        public void CreatePinPlaceholder(PinType pinType,
                                         double latitude,
                                         double longitude,
                                         string label,
                                         string address,
                                         int id)
        {
            customMap.Pins.Add(new Pin
            {
                Type     = pinType,
                Position = new Xamarin.Forms.Maps.Position(latitude, longitude),
                Label    = label,
                Address  = address,
                Id       = id
            });

            customMap.IsShowingUser = true;
        }
Exemplo n.º 28
0
 public void SetDtrEnable(bool value)
 {
     if (continueding)
     {
         return;
     }
     pinType  = PinType.Dtr;
     pinValue = value;
     if (ContinuedThread == null || ContinuedThread.ThreadState == System.Threading.ThreadState.Stopped)
     {
         ContinuedThread = new Thread(ContinuedFun);
         ContinuedThread.Start();
     }
     else if (ContinuedThread.ThreadState == System.Threading.ThreadState.Suspended)
     {
         ContinuedThread.Resume();
     }
 }
Exemplo n.º 29
0
        public PinStatus Read(PinType pin)
        {
            var folder = string.Format("{0}gpio{1}/value", GPIO_FOLDER, pin.ToString().Substring(4));
            PinStatus response;
            try
            {
                var data = File.ReadAllText(folder).Trim();
                response = data == "0"
                    ? PinStatus.False
                    : PinStatus.True;
            }
            catch
            {
                response = PinStatus.UnExported;
            }

            return response;
        }
Exemplo n.º 30
0
        private void getPinTypes(Database _database)
        {
            List <object> objects = _database.getAllPinTypes();

            PinTypes = new List <PinType>();

            // Converts each object in a List of anonymous objects to Pin type object
            foreach (var item in objects)
            {
                Type    type    = item.GetType();
                PinType pinType = new PinType()
                {
                    // System reflection to get property values from anonymous object type
                    ID   = (int)type.GetProperty("ID").GetValue(item),
                    Name = (string)type.GetProperty("Name").GetValue(item)
                };
                PinTypes.Add(pinType);
            }
        } // End getPinTypes(Database)
Exemplo n.º 31
0
        public Pin(XmlElement node) : base(node)
        {
            foreach (XmlElement propertyNode in node.ChildNodes)
            {
                switch (propertyNode.Name)
                {
                case "pin":
                    this._Pin = propertyNode.InnerText;
                    continue;

                case "origin":
                    this._Origin = (RuleLevel)StringEnum.Parse(typeof(RuleLevel), propertyNode.InnerText);
                    continue;

                case "type":
                    this._Type = (PinType)StringEnum.Parse(typeof(PinType), propertyNode.InnerText);
                    continue;
                }
            }
        }
Exemplo n.º 32
0
        public bool VerifyPIN(PinType PinType, string sPin)
        {
            if (IsOpen)
            {
                byte[] pbPin = System.Text.Encoding.Default.GetBytes(sPin);

                if (SunKeyAPI.Dev_SunKeyVerifyPIN(mSunKeyHandle, (byte)PinType, pbPin, (short)pbPin.Length, ref mPinCount))
                {
                    mIsVerifyPass = true;
                    return(true);
                }
                else
                {
                    mIsVerifyPass = false;
                    mPinCount     = 0;
                    System.Console.Out.WriteLine("SunkeyLastErr = " + new SunKeyException().FullMessage);
                }
            }
            return(false);
        }
Exemplo n.º 33
0
        public PinVMConverter()
        {
            _allowedTypes = new ObservableCollection <PinType>()
            {
                PinType.Not_Used,
                PinType.Button_Gnd,
                PinType.Button_Vcc,
                PinType.Button_Row,
                PinType.Button_Column,
                PinType.ShiftReg_LATCH,
                PinType.ShiftReg_DATA,
                PinType.TLE501x_CS,
                PinType.LED_Single,
                PinType.LED_Row,
                PinType.LED_Column,
            };

            _selectedType = PinType.Not_Used;
            _typeError    = false;
        }
Exemplo n.º 34
0
        // Creates DevicePin wrapper
        private DevicePin CreateItem(
            // Fields of DevicePin table
            Guid PinId,
            Circuit Circuit,
            int BitWidth,
            PinType PinType,
            PinSide PinSide,
            bool Inverted,
            string Name,
            string Note,
            string JamNotation
            // Fields of Circuit table

            )
        {
            TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit");
            CircuitData dataCircuit = new CircuitData()
            {
                CircuitId = PinId
            };
            RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit);

            DevicePinData dataDevicePin = new DevicePinData()
            {
                PinId       = PinId,
                CircuitId   = (Circuit != null) ? Circuit.CircuitId : DevicePinData.CircuitIdField.Field.DefaultValue,
                BitWidth    = BitWidth,
                PinType     = PinType,
                PinSide     = PinSide,
                Inverted    = Inverted,
                Name        = Name,
                Note        = Note,
                JamNotation = JamNotation,
            };

            return(this.Create(this.Table.Insert(ref dataDevicePin), rowIdCircuit));
        }
        private void AppendContent2(string storageName, UIElement elem, PinType pinType, RadBusyIndicator busyIndicator)
        {
            if (busyIndicator != null)
            {
                busyIndicator.Visibility = Visibility.Collapsed;
                busyIndicator.Background = null;
                busyIndicator.IsRunning = false;
            }

            DataModel.CategoryItem categoryItem = MiscHelpers.GetCatergoryItemFromIsolatedStorage(storageName + ".xml");

            if (categoryItem == null) return;

            var configString = storageName.Replace("fbd-ctgy-", "");
            configString = configString.Replace("fbd-localcache-", "");
            configString = configString.Replace("fbd-prefetch-", "");

            if (storageName.StartsWith("fbd-giant"))
            {
                configString = _configString;
            }
            var defaultPhoto = _cf[configString]["photo_default"];
            var gridTitle = _cf[configString]["title"];

            var feedItemList = categoryItem.ChannelItems;

            if (feedItemList != null)
            {
                var hubTile = elem as RadSlideHubTile;
                if (hubTile != null)
                {
                    hubTile.Title = gridTitle;

                    hubTile.Background = new ImageBrush { ImageSource = new BitmapImage(new Uri(defaultPhoto, UriKind.RelativeOrAbsolute)), Stretch = Stretch.UniformToFill };

                    hubTile.Tap += delegate
                    {
                        Analytics.GetInstance().TrackCategoryPageButtonPressed("tile", configString, "1");

                        if (!storageName.StartsWith("fbd-prefetch-"))
                        {
                            Dispatcher.BeginInvoke(
                                () =>
                                NavigationService.Navigate(
                                    new Uri("/NewsListPage.xaml?category=" + configString + "&storage=" + storageName
                                            + "&viewtype=" + pinType, UriKind.Relative)));
                        }
                    };
                }

                if (storageName.StartsWith("fbd-giant"))
                {
                    return;
                }

                var homeTileList = MiscHelpers.GetItemFromIsolatedStorage<List<PinTile>>("fbd-pintiles.xml");

                foreach (var item in feedItemList)
                {
                    string[] ss = item.Tag.ToString().Split('|');

                    if (ss.Length > 2)
                    {
                        //Check if the channel context are available in isolated-stoage (Channel has been pinned)
                        string channelName = ss[2];
                        string eachStorageName = "fbd-channel-" + channelName;

                        var subscribeImage = Constant.SubscribeImageSource;
                        if (HomePagePinTiles.IsFull())
                        {
                            subscribeImage = Constant.FullSubscribeImageSource;
                        }

                        string f = HttpUtility.UrlEncode(eachStorageName) + ".xml";

                        var channelItem = MiscHelpers.GetChannelItemFromIsolatedStorage(f);
                        if (channelItem == null)
                        {
                            channelItem = item;
                        }
                        else
                        {
                            //Change add icon to remove icon if true
                            PinTile existingHomeTile = GeneralHelper.GetHomeTile(eachStorageName, homeTileList);
                            if (existingHomeTile != null)
                            {
                                subscribeImage = Constant.UnSubscribeImageSource;
                            }
                        }

                        var uItem = MiscHelpers.CreateUINewsItem(channelItem);

                        string feedPhoto = "http://s2.googleusercontent.com/s2/favicons?domain=" + item.FeedLink;

                        var imageB = new BitmapImage(new Uri(feedPhoto, UriKind.RelativeOrAbsolute))
                        {
                            CreateOptions = BitmapCreateOptions.BackgroundCreation
                        };
                        imageB.ImageOpened += delegate
                        {
                            uItem.NewsImageSource = imageB;
                        };

                        var image = new BitmapImage(new Uri(defaultPhoto, UriKind.RelativeOrAbsolute));
                        uItem.NewsImageSource = image;
                        uItem.SubscribeImageSource = subscribeImage;
                        feedItems.Add(uItem);

                        giantCategoryitem.ChannelItems.Add(channelItem);
                    }
                }

                MiscHelpers.SaveDataToIsolatedStorage("fbd-giant.xml", giantCategoryitem,
                                                                  typeof(DataModel.CategoryItem), FileMode.Create);

                UIElementCollection uic = ContentPanel.Children;
                AppendContent2("fbd-giant", uic[0], PinType.Category, null);
            }
        }
        private void InvokeAppendContent()
        {
            BusyIndicatorA.IsRunning = false;
            BusyIndicatorLayerA.Background = null;

            IDictionary<string, string> q = NavigationContext.QueryString;

            if (q.ContainsKey("storage"))
            {
                _storageName = HttpUtility.UrlEncode(q["storage"]);
            }

            if (q.ContainsKey("channel"))
            {
                _channelName = HttpUtility.UrlEncode(q["channel"]);
            }

            if (q.ContainsKey("category"))
            {
                _categoryName = q["category"];
                HeaderBox.Text = _cf[_categoryName]["title"];
                HeaderIcon.Source =
                    new BitmapImage(new Uri(_cf[_categoryName]["photo_channel"], UriKind.RelativeOrAbsolute));

                defaultPhoto = _cf[_categoryName]["photo_default"];
            }
            else
            {
                HeaderBox.Text = "news";
                HeaderIcon.Source =
                    new BitmapImage(new Uri("ApplicationIcon.png", UriKind.RelativeOrAbsolute));
            }

            if (q.ContainsKey("homegiant"))
            {
                if (_storageName == null)
                {
                    _storageName = "fbd-giant";
                }

                NewsListBox.ItemsSource = _ctgyNewsItems;
                giantCategoryitem = new DataModel.CategoryItem { ChannelItems = new List<DataModel.ChannelItem>() };

                string s = q["homegiant"];
                string[] homeGiantList = s.Split('|');

                _isHomeGiant = s;

                int i = 0;
                foreach (var h in homeGiantList)
                {
                    //string ctgy = h.Replace("fbd-localcache-", "").Replace("fbd-ctgy-", "");
                    //defaultPhoto = _cf[ctgy]["photo_default"];

                    bool isStorageFileExisted = false;

                    string fileName = h;
                    using (IsolatedStorageFile f = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        isStorageFileExisted = f.FileExists(fileName + ".xml");
                    }

                    if (isStorageFileExisted)
                    {
                        BackgroundWorker bw = new BackgroundWorker();
                        bw.WorkerSupportsCancellation = true;
                        bw.WorkerReportsProgress = true;
                        bw.DoWork += delegate
                            {
                                string ctgy = h.Replace("fbd-localcache-", "").Replace("fbd-ctgy-", "");
                                defaultPhoto = _cf[ctgy]["photo_default"];

                                AppendCategoryContent(h);
                            };
                        bw.RunWorkerAsync();
                    }
                    else
                    {
                        var secCount = 0;
                        var adsTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
                        var i1 = i;
                        string h1 = h;
                        adsTimer.Tick += (sender, args) =>
                        {

                            if (IsDownloadCompleted[i1] == 1)
                            {
                                var x = i1;
                                AppendCategoryContent(h1);
                                IsDownloadCompleted[x] = 2;
                            }

                            if (NumOfDownloadCompleted == homeGiantList.Length || secCount >= 40)
                            {
                                //Analytics.GetInstance().TrackLoadingTime("category_data", trackLoadingTime);
                                adsTimer.Stop();
                            }
                            secCount++;
                        };
                        adsTimer.Start();
                    }
                    i++;
                }

                //var addBottomButton = (ApplicationBarIconButton)ApplicationBar.Buttons[1];
                //var readlaterBottomButton = (ApplicationBarIconButton)ApplicationBar.Buttons[2];
                //addBottomButton.IsEnabled = false;
                //readlaterBottomButton.IsEnabled = false;

                _viewType = PinType.Category;

                _isSubscribed = GeneralHelper.SetSubscribeCategoryButton(
                    (ApplicationBarIconButton)ApplicationBar.Buttons[1],
                    _categoryName);
            }

            if (q.ContainsKey("viewtype"))
            {
                string viewType = q["viewtype"];

                if (PinType.Category.ToString().Equals(viewType))
                {
                    _viewType = PinType.Category;

                    _isSubscribed = GeneralHelper.SetSubscribeCategoryButton(
                        (ApplicationBarIconButton)ApplicationBar.Buttons[1],
                        _categoryName);

                    AppendCategoryContent(_storageName);
                }
                else if (PinType.SubCategory.ToString().Equals(viewType))
                {
                    _viewType = PinType.SubCategory;

                    _isSubscribed = GeneralHelper.SetSubscribeSubCategoryButton(
                        (ApplicationBarIconButton)ApplicationBar.Buttons[1],
                        _storageName);

                    AppendCategoryContent(_storageName);
                }
                else if (PinType.Channel.ToString().Equals(viewType))
                {
                    _viewType = PinType.Channel;

                        AppendContent(_storageName);
                }
            }
        }
Exemplo n.º 37
0
 public static void SetPinType(SPI spi, byte pin, PinType type)
 {
     byte[] WriteBuffer = new byte[2];
     switch (type)
     {
         case PinType.PinInput:
             WriteBuffer[0] = 0x08;
             break;
         case PinType.PinOutput:
             WriteBuffer[0] = 0x09;
             break;
         case PinType.PinPwm:
             WriteBuffer[0] = 0x0A;
             break;
         case PinType.PinInvertedPwm:
             WriteBuffer[0] = 0x0B;
             break;
         default:
             WriteBuffer[0] = 0x55;
             break;
     }
     WriteBuffer[1] = pin; //Operand
     spi.Write(WriteBuffer);
 }
Exemplo n.º 38
0
 public void SetPinType(byte pin, PinType type)
 {
     byte[] WriteBuffer = new byte[2];
     switch (type)
     {
         case PinType.PinInput:
             WriteBuffer[0] = (byte)Cmd.CmdSetPinInput;
             break;
         case PinType.PinOutput:
             WriteBuffer[0] = (byte)Cmd.CmdSetPinOutput;
             break;
         case PinType.PinPwm:
             WriteBuffer[0] = (byte)Cmd.CmdSetPinPwm;
             break;
         case PinType.PinInvertedPwm:
             WriteBuffer[0] = (byte)Cmd.CmdSetPinInvertedPwm;
             break;
         default:
             throw(new SystemException("SetPinType called with invalid pin type."));
             break;
     }
     WriteBuffer[1] = pin; //Operand
     Spi.Write(WriteBuffer);
 }
Exemplo n.º 39
0
 public void UnExport(PinType pin)
 {
     var folder = string.Format("{0}unexport", GPIO_FOLDER);
     Execute(folder, pin.ToString().Substring(4));
     _activepins.Remove(pin);
 }
        private void InvokeAppendContent()
        {
            BusyIndicatorA.IsRunning = false;
            BusyIndicatorLayerA.Background = null;

            IDictionary<string, string> q = NavigationContext.QueryString;

            if (q.ContainsKey("storage"))
            {
                _storageName = HttpUtility.UrlEncode(q["storage"]);
            }

            if (q.ContainsKey("category"))
            {
                _categoryName = q["category"];
            }

            if (q.ContainsKey("fontconfig"))
            {
                int fontConfig = int.Parse(q["fontconfig"]);

                if (fontConfig == 0)
                    _sizeConfig = SizeConfig0;
                else if (fontConfig == 1)
                    _sizeConfig = SizeConfig1;
                else if (fontConfig == 2)
                    _sizeConfig = SizeConfig2;
                else if (fontConfig == 3)
                    _sizeConfig = SizeConfig3;
                else if (fontConfig == 4)
                    _sizeConfig = SizeConfig4;
            }

            if (q.ContainsKey("viewtype") && q.ContainsKey("itemguid"))
            {
                string viewType = q["viewtype"];
                _itemGuid = q["itemguid"];

                if (PinType.Category.ToString().Equals(viewType))
                {
                    _viewType = PinType.Category;
                    AppendCategoryContent(_storageName, _itemGuid);
                }
                else if (PinType.SubCategory.ToString().Equals(viewType))
                {
                    _viewType = PinType.SubCategory;

                    AppendCategoryContent(_storageName, _itemGuid);
                }
                else if (PinType.Channel.ToString().Equals(viewType) || PinType.NewsItem.ToString().Equals(viewType))
                {
                    _viewType = PinType.Channel;

                    AppendContent(_storageName, _itemGuid);
                }
            }
        }
Exemplo n.º 41
0
        private void createPin(string title, PinType pinType)
        {
            m_pin = new Grid()
            {
                Width = pinWidth,
                Height = pinHeight,
                RenderTransform = new TranslateTransform() { X = -pinWidth / 2, Y = -pinHeight + bottomPinHeight / 2 }
            };

            m_topPin = new Grid()
            {
                Width = topPinWidth,
                Height = topPinHeight,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top,
                Visibility = Windows.UI.Xaml.Visibility.Collapsed
            };

            m_bottomPin = new Grid()
            {
                Width = bottomPinWidth,
                Height = bottomPinHeight,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Bottom
            };

            m_topPin.Children.Add(new Rectangle()
            {
                Width = m_topPin.Width,
                Height = m_topPin.Height,
                Fill = new SolidColorBrush(Colors.Beige),
                Stroke = new SolidColorBrush(Colors.Black),
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top
            });

            m_topPin.Children.Add(new TextBlock()
            {
                Text = title,
                FontSize = 12,
                Foreground = new SolidColorBrush(Colors.Black),
                TextAlignment = Windows.UI.Xaml.TextAlignment.Left,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center
            });

            m_bottomPin.Children.Add(new Ellipse()
            {
                Width = (int)m_pinSize,
                Height = (int)m_pinSize,
                Fill = new SolidColorBrush(bottomPinColor[(int)pinType, 0]),
                Stroke = new SolidColorBrush(bottomPinColor[(int)pinType, 1]),
                StrokeThickness = ((int)m_pinSize / 10) + 1,
                HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center,
                VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center
            });

            m_pin.Children.Add(m_topPin);
            m_pin.Children.Add(m_bottomPin);
            m_bottomPin.Tapped += tappedCallback;
        }
Exemplo n.º 42
0
    public void FromString(string Set)
    {
        string[] tmp = Set.Split(';');
        try
        {
            Note = Convert.ToByte(tmp[0]);
            Thresold = Convert.ToByte(tmp[1]);
            ScanTime = Convert.ToByte(tmp[2]);
            MaskTime = Convert.ToByte(tmp[3]);
            Retrigger = Convert.ToByte(tmp[4]);
            Curve = Convert.ToByte(tmp[5]);
            Xtalk = Convert.ToByte(tmp[6]);
            XtalkGroup = Convert.ToByte(tmp[7]);
            CurveForm = Convert.ToByte(tmp[8]);
            Choke = Convert.ToByte(tmp[9]);
            Dual = Convert.ToByte(tmp[10]);
            //DualNote = Convert.ToByte(tmp[11]);//DUAL
            //DualThresold = Convert.ToByte(tmp[12]);
            Type = (PinType)Convert.ToByte(tmp[13]);
            Channel = Convert.ToByte(tmp[14]);
        }
        catch (Exception)
        {

        }
    }
Exemplo n.º 43
0
 public Pin(PinId pinId, PinType pinType)
 {
     this.__pinId = pinId;
     this.__pinType = pinType;
     this.__pinNumber = Array.IndexOf(Enum.GetValues(typeof(PinId)), pinId)-1;
 }     
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            BusyIndicatorA.IsRunning = false;
            BusyIndicatorLayerA.Background = null;

            IDictionary<string, string> q = NavigationContext.QueryString;

            if (q.ContainsKey("storage"))
            {
                _storageName = HttpUtility.UrlEncode(q["storage"]);
            }

            if (q.ContainsKey("category"))
            {
                _categoryName = q["category"];
                HeaderBox.Text = _cf[_categoryName]["title"];
                HeaderIcon.Source =
                    new BitmapImage(new Uri(_cf[_categoryName]["photo_channel"], UriKind.RelativeOrAbsolute));
            }
            else
            {
                HeaderBox.Text = "Result";
                HeaderIcon.Source =
                    new BitmapImage(new Uri("ApplicationIcon.png", UriKind.RelativeOrAbsolute));
            }

            if (q.ContainsKey("viewtype"))
            {
                string viewType = q["viewtype"];
                _itemGuid = q["itemguid"];

                if (PinType.Category.ToString().Equals(viewType))
                {
                    _viewType = PinType.Category;

                    _isSubscribed = GeneralHelper.SetSubscribeCategoryButton(
                        (ApplicationBarIconButton)ApplicationBar.Buttons[1],
                        _categoryName
                        );

                    AppendCategoryContent(_storageName, _itemGuid);
                }
                else if (PinType.SubCategory.ToString().Equals(viewType))
                {
                    _viewType = PinType.SubCategory;

                    _isSubscribed = GeneralHelper.SetSubscribeSubCategoryButton(
                        (ApplicationBarIconButton)ApplicationBar.Buttons[1],
                        _storageName
                        );

                    AppendCategoryContent(_storageName, _itemGuid);
                }
                else if (PinType.Channel.ToString().Equals(viewType) || PinType.NewsItem.ToString().Equals(viewType))
                {
                    _viewType = PinType.Channel;

                    if (_storageName.Contains("fbfeeds"))
                    {
                        PreInvokeAppendContent(_storageName, _itemGuid);
                    }
                    else
                    {
                        AppendContent(_storageName, _itemGuid);
                    }
                }
            }

            Analytics.GetInstance().SendView("NewsImageView");
        }
Exemplo n.º 45
0
 /// <summary>
 /// Permite inicializar un pin. Observe que el uso de internal esta dado porque el elemento del diagrama es el que sabe que pines debe tener.
 /// </summary>
 internal Pin(ChartElement chart, int index, PinType type)
 {
     this.ChartElement = chart;
     this.Index = index;
     this.PinType = type;
 }
Exemplo n.º 46
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();
 }
Exemplo n.º 47
0
 /// <summary>
 /// Clears the pins.
 /// </summary>
 /// <param name="type">Type.</param>
 public void ClearPins(PinType type)
 {
     Pins.RemoveAll (o => o.Type == type);
     if (OnPinsUpdated != null)
     {
         OnPinsUpdated.Invoke (this, new ControllerPinUpdateArgs (null, UpdateOperation.Clear));
     }
     if (type == PinType.DIGITAL)
     {
         ClearSequences ();
     } else if (type == PinType.ANALOG)
     {
         ClearMeasurementCombinations ();
     }
 }
Exemplo n.º 48
0
 public void ShowPin(PinType type)
 {
     Pins[(int)type].SetActive(true);
 }
        /// <summary>
        /// 抵抗値をセットする
        /// </summary>
        /// <param name="pinType">ピン</param>
        /// <param name="outputValue">出力値(0~255)</param>
        public void SetResistor(PinType pinType, byte outputValue)
        {
            //digitalWrite(slaveSelectPin, LOW);
            //this.write(new byte[] { 0x00, 0x06, 0x01, (byte)this.latchPin, 0x00, 0x00, 0xAA, 0xAA });
            Query_x06 query = new Query_x06()
            {
                DeviceAddress = 0x00,
                FunctionCode = 0x06,
                RegisterAddress = ModbusData.bytes2int(0x01, (byte)this.latchPin),
                PresetData = ModbusData.bytes2int(0x00, 0x00),
            };
            this.Write(query);

            ////  send in the address and value via SPI:
            //SPI.transfer(address);
            //this.write(new byte[] { 0x00, 0x06, 0x05, 0x02, 0x00, (byte)pinType, 0xAA, 0xAA });
            query = new Query_x06()
            {
                DeviceAddress = 0x00,
                FunctionCode = 0x06,
                RegisterAddress = ModbusData.bytes2int(0x05, 0x02),
                PresetData = ModbusData.bytes2int(0x00, (byte)pinType),
            };
            this.Write(query);

            //SPI.transfer(value);
            //this.write(new byte[] { 0x00, 0x06, 0x05, 0x02, 0x00, outputValue, 0xAA, 0xAA });
            query = new Query_x06()
            {
                DeviceAddress = 0x00,
                FunctionCode = 0x06,
                RegisterAddress = ModbusData.bytes2int(0x05, 0x02),
                PresetData = ModbusData.bytes2int(0x00, outputValue),
            };
            this.Write(query);

            //// take the SS pin high to de-select the chip:
            //digitalWrite(slaveSelectPin, HIGH);
            //this.write(new byte[] { 0x00, 0x06, 0x01, (byte)this.latchPin, 0x00, 0x01, 0xAA, 0xAA });
            query = new Query_x06()
            {
                DeviceAddress = 0x00,
                FunctionCode = 0x06,
                RegisterAddress = ModbusData.bytes2int(0x01, (byte)this.latchPin),
                PresetData = ModbusData.bytes2int(0x00, 0x01),
            };
            this.Write(query);
        }
Exemplo n.º 50
0
 public FlowObjectPin(string id, PinType type) : base(type)
 {
     m_Id     = Project.ParseHexValue(id);
     m_Script = null;
     m_Type   = type;
 }
Exemplo n.º 51
0
		/// <summary>
		/// トランジスタ出力値をセットする
		/// </summary>
		/// <param name="pinType">ピン</param>
		/// <param name="level">High:1  Low:0</param>
		public void SetLevel(PinType pinType, bool level)
		{
			
		}
Exemplo n.º 52
0
 public PinSwitchEventArgs(PinType pinType, bool isOn)
 {
     PinType = pinType;
     IsOn    = isOn;
 }
		void SetPinOnMap(Double Latitude, Double Longitude, int severidade){


			var position = new Xamarin.Forms.Maps.Position(Latitude, Longitude); // Latitude, Longitude

			PinType pinType = new PinType();
			if (severidade < 2) {
				pinType = PinType.Place;
			}else{
				pinType = PinType.SavedPin;
			}

			var pin = new Pin {
				Type = pinType,
				Position = position,
				Label = "Bump",
				Address = "Endereco do defeito"
			};



			map.Pins.Add(pin);



		}