Esempio n. 1
0
        public async void AddStorageValue()
        {
            var dlg = new StorageValueDialog()
            {
                DataContext = new VAR()
                {
                    Name = "", StartIndex = 0, Tag = 0, Type = TYPE.SHORT
                }
            };
            var result = await DialogHost.Show(dlg);

            if (result is bool r && r == true)
            {
                VAR v = dlg.DataContext as VAR;
                Storage.AddItem(v);
            }
        }
Esempio n. 2
0
        public async void ModifyDataValue()
        {
            var dlg = new StorageValueDialog()
            {
                DataContext = new VAR()
                {
                    Name       = SelectedItem.Name,
                    StartIndex = SelectedItem.StartIndex,
                    Tag        = SelectedItem.Tag,
                    Type       = SelectedItem.Type,
                    Value      = SelectedItem.Value
                }
            };
            var result = await DialogHost.Show(dlg);

            lock (DataStorage.Locker)
            {
                if (result is bool r && r == true)
                {
                    VAR v = dlg.DataContext as VAR;
                    Storage.ModifyItem(SelectedItem, v);
                }
            }
        }