Exemplo n.º 1
0
        /// <summary>
        /// TreeView Constructor
        /// </summary>
        /// <param name="_dataBlock"></param>
        /// <param name="_parentSector"></param>
        public RFiDChipGrandChildLayerViewModel(MifareClassicDataBlockModel _dataBlock, RFiDChipChildLayerViewModel _parentSector)
        {
            if (_dataBlock != null)
            {
                mifareClassicDataBlock = _dataBlock;
                if (mifareClassicDataBlock.Data == null)
                {
                    mifareClassicDataBlock.Data = new byte[16];
                }
            }


            else
            {
                mifareClassicDataBlock      = new MifareClassicDataBlockModel();
                mifareClassicDataBlock.Data = new byte[16];
            }

            IsVisible = true;

            parent = _parentSector;
            mifareClassicDataBlock.DataBlockNumberChipBased = _dataBlock.DataBlockNumberChipBased;

            DataAsHexString  = "00000000000000000000000000000000";
            DataAsCharString = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";

            IsValidDataContent = null;

            tag = String.Format("{0}:{1}", _parentSector.ParentUid, _parentSector.SectorNumber);

            children = new ObservableCollection <RFiDChipGrandGrandChildLayerViewModel>();
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        public MifareUltralightSetupViewModel()
        {
            MefHelper.Instance.Container.ComposeParts(this);             //Load Plugins

            chipModel = new MifareUltralightChipModel(string.Format("Task Description: {0}", SelectedTaskDescription), CARD_TYPE.MifareUltralight);

            childNodeViewModelFromChip = new RFiDChipChildLayerViewModel(pageModel, null, CARD_TYPE.MifareUltralight, null, true);
            childNodeViewModelTemp     = new RFiDChipChildLayerViewModel(pageModel, null, CARD_TYPE.MifareUltralight, null, true);

            MifareUltralightPages = CustomConverter.GenerateStringSequence(0, 15).ToArray();

            SelectedUltralightPageCurrent = "0";
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_desfireFile"></param>
        /// <param name="_parentSector"></param>
        public RFiDChipGrandChildLayerViewModel(MifareDesfireFileModel _desfireFile, RFiDChipChildLayerViewModel _parentSector)
        {
            desfireFile = _desfireFile;
            children    = new ObservableCollection <RFiDChipGrandGrandChildLayerViewModel>();

            parent = _parentSector;

            if (_desfireFile == null)
            {
                desfireFile      = new MifareDesfireFileModel();
                desfireFile.Data = new byte[16];
            }

            DataAsHexString  = "00000000000000000000000000000000";
            DataAsCharString = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";

            IsValidDataContent = null;
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="_selectedSetupViewModel"></param>
        /// <param name="_dialogs"></param>
        public MifareUltralightSetupViewModel(object _selectedSetupViewModel, ObservableCollection <IDialogViewModel> _dialogs)
        {
            try
            {
                MefHelper.Instance.Container.ComposeParts(this);                 //Load Plugins

                databaseReaderWriter = new DatabaseReaderWriter();

                chipModel = new MifareUltralightChipModel(string.Format("Task Description: {0}", SelectedTaskDescription), CARD_TYPE.MifareUltralight);

                pageModel            = new MifareUltralightPageModel(new byte[4], 0);
                pageModel.PageNumber = selectedUltralightPageCurrentAsInt;

                childNodeViewModelFromChip = new RFiDChipChildLayerViewModel(pageModel, null, CARD_TYPE.MifareUltralight, null, true);
                childNodeViewModelTemp     = new RFiDChipChildLayerViewModel(pageModel, null, CARD_TYPE.MifareUltralight, null, true);

                if (_selectedSetupViewModel is MifareUltralightSetupViewModel)
                {
                    PropertyInfo[] properties = typeof(MifareUltralightSetupViewModel).GetProperties(BindingFlags.Public | BindingFlags.Instance);

                    foreach (PropertyInfo p in properties)
                    {
                        // If not writable then cannot null it; if not readable then cannot check it's value
                        if (!p.CanWrite || !p.CanRead)
                        {
                            continue;
                        }

                        MethodInfo mget = p.GetGetMethod(false);
                        MethodInfo mset = p.GetSetMethod(false);

                        // Get and set methods have to be public
                        if (mget == null)
                        {
                            continue;
                        }
                        if (mset == null)
                        {
                            continue;
                        }

                        p.SetValue(this, p.GetValue(_selectedSetupViewModel));
                    }
                }

                else
                {
                    SelectedTaskIndex       = "0";
                    SelectedTaskDescription = "Enter a Description";
                }

                MifareUltralightPages = CustomConverter.GenerateStringSequence(0, 15).ToArray();

                SelectedUltralightPageCurrent = "0";

                HasPlugins = items != null?items.Any() : false;

                if (HasPlugins)
                {
                    SelectedPlugin = Items.FirstOrDefault();
                }
            }
            catch (Exception e)
            {
                LogWriter.CreateLogEntry(string.Format("{0}: {1}; {2}", DateTime.Now, e.Message, e.InnerException != null ? e.InnerException.Message : ""));
            }
        }