Ejemplo n.º 1
0
        public IActionResult Profile()
        {
            var             userid    = HttpContext.Session.GetInt32("SessionUser");
            User            user      = db.Users.Where(x => x.Id == userid).FirstOrDefault();
            List <Follower> followers = db.Followers.Where(x => x.UserId == userid).ToList();
            List <User>     users     = new List <User>();

            foreach (var item in followers)
            {
                User user1 = new User();
                user1 = db.Users.Where(x => x.Id == item.FollowerId).FirstOrDefault();
                users.Add(user1);
            }

            List <Follower> following      = db.Followers.Where(x => x.FollowerId == userid).ToList();
            List <User>     usersfollowing = new List <User>();

            foreach (var item in following)
            {
                User user1 = new User();
                user1 = db.Users.Where(x => x.Id == item.UserId).FirstOrDefault();
                usersfollowing.Add(user1);
            }

            ListVM tweets = new ListVM();

            tweets.Tweets      = db.Tweets.Where(x => x.UserId == userid).ToList();
            tweets.User        = user;
            tweets.Users       = users;
            tweets.FollowUsers = usersfollowing;
            tweets.User        = user;
            return(View(tweets));
        }
Ejemplo n.º 2
0
        public async void PopulateActivityList(ListVM instance)
        {
            FileHelper.FileReader fr      = new FileHelper.FileReader();
            var             xmlDoc        = XElement.Load(fr.ReadFile());
            List <XElement> activityNodes = xmlDoc.Descendants().Where(x => x.Name.ToString().Equals("Activity")).ToList();

            for (var i = 0; i > activityNodes.Count; i++)
            {
                var activity = new ActivityVM();
                activity.Name                      = activityNodes[i].Descendants("Name").ToString();
                activity.Example_wav_path          = activityNodes[i].Descendants("Example_wav_path").ToString();
                activity.Pitch                     = Convert.ToInt32(activityNodes[i].Descendants("Pitch").ToString());
                activity.PitchEvaluated            = Convert.ToBoolean(activityNodes[i].Descendants("PitchEvaluated").ToString());
                activity.Intensity                 = Convert.ToInt32(activityNodes[i].Descendants("Intensity").ToString());
                activity.IntensityEvaluated        = Convert.ToBoolean(activityNodes[i].Descendants("IntensityEvaluated").ToString());
                activity.F0_exact                  = Convert.ToInt32(activityNodes[i].Descendants("F0_exact").ToString());
                activity.F0_exactEvaluated         = Convert.ToBoolean(activityNodes[i].Descendants("F0_exactEvaluated").ToString());
                activity.F0_stable                 = Convert.ToInt32(activityNodes[i].Descendants("F0_stable").ToString());
                activity.F0_stableEvaluated        = Convert.ToBoolean(activityNodes[i].Descendants("F0_stableEvaluated").ToString());
                activity.Intensite_stable          = Convert.ToInt32(activityNodes[i].Descendants("Intensite_stable").ToString());
                activity.Intensite_stableEvaluated = Convert.ToBoolean(activityNodes[i].Descendants("Intensite_stableEvaluated").ToString());
                activity.Courbe_f0_exacte          = Convert.ToInt32(activityNodes[i].Descendants("Courbe_f0_exacte").ToString());
                activity.Courbe_f0_exacteEvaluated = Convert.ToBoolean(activityNodes[i].Descendants("Courbe_f0_exacteEvaluated").ToString());
                activity.Duree_exacte              = Convert.ToInt32(activityNodes[i].Descendants("Duree_exacte").ToString());
                activity.Duree_exacteEvaluated     = Convert.ToBoolean(activityNodes[i].Descendants("Duree_exacteEvaluated").ToString());
                activity.Jitter                    = Convert.ToInt32(activityNodes[i].Descendants("Jitter").ToString());
                activity.JitterEvaluated           = Convert.ToBoolean(activityNodes[i].Descendants("JitterEvaluated").ToString());

                instance.Add(activity);
            }
        }
Ejemplo n.º 3
0
        public void Test1()
        {
            var dl = new List <TestItemDM>(new [] { new TestItemDM(0) });
            var bl = new ListBM <TestItemBM> {
                Metadata = { DataProvider = { Data = dl } }
            };
            var vl = new ListVM <TestItemVM> {
                Metadata = { DataProvider = { Data = bl } }
            };

            dl = new List <TestItemDM>(new [] { new TestItemDM(1) });
            bl = new ListBM <TestItemBM> {
                Metadata = { DataProvider = { Data = dl } }
            };

            TestItemVM oldFirst = vl.FirstOrDefault();
            TestItemVM newfirst = null;

            vl.CollectionChanged += delegate { newfirst = vl.FirstOrDefault(); };

            vl.Metadata.DataProvider.Data = bl;

            var oldFirstTypeInstanceId = oldFirst.TypeInstanceId();
            var newFirstTypeInstanceId = newfirst.TypeInstanceId();

            Assert.AreEqual(newFirstTypeInstanceId, oldFirstTypeInstanceId + 1);
        }
Ejemplo n.º 4
0
        public void InitializedList()
        {
            var dl = new List <TestItemDM> {
                new TestItemDM(0), new TestItemDM(1), new TestItemDM(2)
            };
            var bl = new ListBM <TestItemBM> {
                Metadata = { DataProvider = { Data = dl } }
            };
            var vl = new ListVM <TestItemVM> {
                Metadata = { DataProvider = { Data = bl } }
            };

            Assert.AreEqual(3, vl.Count);

            bl.RemoveAt(1);
            Assert.AreEqual(2, vl.Count);
            bl.Remove(bl[0]);
            Assert.AreEqual(1, vl.Count);
            bl.Clear();
            Assert.AreEqual(0, vl.Count);

            bl.Add(new TestItemBM {
                Metadata = { DataProvider = { Data = new TestItemDM(0) } }
            });
            Assert.AreEqual(1, vl.Count);
            bl.Insert(0, new TestItemBM {
                Metadata = { DataProvider = { Data = new TestItemDM(1) } }
            });
            Assert.AreEqual(2, vl.Count);
            bl.Insert(2, new TestItemBM {
                Metadata = { DataProvider = { Data = new TestItemDM(1) } }
            });
            Assert.AreEqual(3, vl.Count);
        }
Ejemplo n.º 5
0
            private void populateExerciceList(string path, ListVM activityList)
            {
                XDocument xml        = XDocument.Load(path + "\\config.xml");
                var       activities = xml.Descendants("Activity");

                foreach (XElement activity in activities)
                {
                    ActivityVM newSuiviVM = new ActivityVM
                    {
                        Name                      = activity.Descendants("Name").First().Value,
                        Example_wav_path          = path + "\\" + activity.Descendants("Exercice_wav_file_name").First().Value,
                        PitchMin                  = Convert.ToInt32(activity.Descendants("Pitch_min").First().Value),
                        PitchMax                  = Convert.ToInt32(activity.Descendants("Pitch_max").First().Value),
                        IntensityThreshold        = Convert.ToInt32(activity.Descendants("Intensity_threshold").First().Value),
                        F0_exactEvaluated         = Convert.ToBoolean(activity.Descendants("F0_exactEvaluated").First().Value),
                        F0_stableEvaluated        = Convert.ToBoolean(activity.Descendants("F0_stableEvaluated").First().Value),
                        Intensite_stableEvaluated = Convert.ToBoolean(activity.Descendants("Intensite_stableEvaluated").First().Value),
                        Courbe_f0_exacteEvaluated = Convert.ToBoolean(activity.Descendants("Courbe_f0_exacteEvaluated").First().Value),
                        Duree_exacteEvaluated     = Convert.ToBoolean(activity.Descendants("Duree_exacteEvaluated").First().Value),
                        JitterEvaluated           = Convert.ToBoolean(activity.Descendants("JitterEvaluated").First().Value)
                    };
                    ICollection <DataLineItem> points = activity.Descendants("point").Select(x => new DataLineItem {
                        Time = double.Parse(x.Descendants("time").First().Value), Intensity = double.Parse(x.Descendants("frequency").First().Value), Pitch = double.Parse(x.Descendants("pitch").First().Value)
                    }).ToList();
                    newSuiviVM.Exercice = points;

                    activityList.Add(newSuiviVM);
                }
            }
Ejemplo n.º 6
0
        public virtual ActionResult ListControl(int pageIndex, OrderColumn orderColumn)
        {
            var currentFilterValues = GetCurrentFilterValues();
            var items = AddFilterToList(currentFilterValues);

            if (!orderColumn.ColumnName.IsEmpty())
            {
                var orderQuery = orderColumn.ColumnName;
                if (orderColumn.IsDesc)
                {
                    orderQuery += " " + Const.Common.Descending;
                }
                items = items.OrderBy(orderQuery);
            }

            var tableData = new List <ListVM.Row>();
            var pagedList = items.ToPagedList(pageIndex - 1);

            foreach (var item in pagedList)
            {
                var id   = LinqToSqlUtils.GetPK(item);
                var list = GetValuesForRow(item);
                tableData.Add(new ListVM.Row {
                    Id = id, Entity = item, Values = list
                });
            }

            var listVM = new ListVM(MetaData, pagedList, tableData);

            AddExtraControls(listVM, true);
            listVM.FilterValues = currentFilterValues;
            listVM.OrderColumn  = orderColumn;

            return(View(PartialViewNames.ListControl, listVM));
        }
Ejemplo n.º 7
0
 public InstructionVM(ModuleDef ownerModule)
 {
     this.ownerModule          = ownerModule;
     this.instructionOperandVM = new InstructionOperandVM();
     this.InstructionOperandVM.PropertyChanged += (a, b) => HasErrorUpdated();
     this.codeVM = new ListVM <Code>(codeList, (a, b) => OnCodeUpdated());
 }
Ejemplo n.º 8
0
        public ExceptionHandlerVM(TypeSigCreatorOptions typeSigCreatorOptions, ExceptionHandlerOptions options)
        {
            this.typeSigCreatorOptions                    = typeSigCreatorOptions.Clone(dnSpy_AsmEditor_Resources.CreateAnExceptionCatchType);
            this.typeSigCreatorOptions.IsLocal            = false;
            this.typeSigCreatorOptions.NullTypeSigAllowed = true;
            origOptions   = options;
            HandlerTypeVM = new EnumListVM(exceptionHandlerTypeList);
            TryStartVM    = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };
            TryEndVM = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };
            FilterStartVM = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };
            HandlerStartVM = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };
            HandlerEndVM = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };

            Reinitialize();
        }
Ejemplo n.º 9
0
        public ExceptionHandlerVM(TypeSigCreatorOptions typeSigCreatorOptions, ExceptionHandlerOptions options)
        {
            this.typeSigCreatorOptions                    = typeSigCreatorOptions.Clone("Create an Exception Catch Type");
            this.typeSigCreatorOptions.IsLocal            = false;
            this.typeSigCreatorOptions.NullTypeSigAllowed = true;
            this.origOptions   = options;
            this.handlerTypeVM = new EnumListVM(exceptionHandlerTypeList);
            this.tryStartVM    = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };
            this.tryEndVM = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };
            this.filterStartVM = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };
            this.handlerStartVM = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };
            this.handlerEndVM = new ListVM <InstructionVM>((a, b) => OnSelectionChanged())
            {
                DataErrorInfoDelegate = VerifyInstruction
            };

            Reinitialize();
        }
Ejemplo n.º 10
0
 public InstructionVM(ModuleDef ownerModule)
 {
     this.ownerModule = ownerModule;
     this.instructionOperandVM = new InstructionOperandVM();
     this.InstructionOperandVM.PropertyChanged += (a, b) => HasErrorUpdated();
     this.codeVM = new ListVM<Code>(codeList, (a, b) => OnCodeUpdated());
 }
Ejemplo n.º 11
0
		public SwitchOperandVM(IList<InstructionVM> allInstrs, IList<InstructionVM> instrs) {
			AllInstructionsVM = new ListVM<InstructionVM>(allInstrs);
			origInstructions = instrs;
			InstructionsListVM = new IndexObservableCollection<SwitchInstructionVM>();

			Reinitialize();
		}
Ejemplo n.º 12
0
        public SwitchOperandVM(IList <InstructionVM> allInstrs, IList <InstructionVM> instrs)
        {
            this.allInstructionsVM  = new ListVM <InstructionVM>(allInstrs);
            this.origInstructions   = instrs;
            this.instructionsListVM = new IndexObservableCollection <SwitchInstructionVM>();

            Reinitialize();
        }
Ejemplo n.º 13
0
        public virtual ActionResult List(int pageIndex, OrderColumn orderColumn)
        {
            var currentFilterValues = GetCurrentFilterValues();
            var items = AddFilterToList(currentFilterValues);

            if (orderColumn.ColumnName.IsEmpty())
            {
                if (MetaData.EntityType.HasProperty(UpdateDate))
                {
                    orderColumn = new OrderColumn {
                        IsDesc     = true,
                        ColumnName = UpdateDate,
                    };
                }
                else
                {
                    orderColumn = new OrderColumn {
                        IsDesc     = true,
                        ColumnName =
                            LinqToSqlUtils.GetPKPropertyName(MetaData.EntityType)
                    }
                };
            }



            if (!orderColumn.ColumnName.IsEmpty())
            {
                var orderQuery = orderColumn.ColumnName;
                if (orderColumn.IsDesc)
                {
                    orderQuery += " " + Const.Common.Descending;
                }
                items = items.OrderBy(orderQuery);
            }
            items = OnListSelecting(items);
            var tableData = new List <ListVM.Row>();
            var pagedList = items.ToPagedList(pageIndex - 1);

            foreach (var item in pagedList)
            {
                var id   = LinqToSqlUtils.GetPK(item);
                var list = GetValuesForRow(item);
                tableData.Add(new ListVM.Row {
                    Id = id, Entity = item, Values = list
                });
            }

            var listVM = new ListVM(MetaData, pagedList, tableData);

            AddExtraControls(listVM, true);
            listVM.FilterValues = currentFilterValues;
            listVM.OrderColumn  = orderColumn;

            ListVMCreated(listVM);

            return(View(listVM));
        }
Ejemplo n.º 14
0
        // GET: /Blog/List
        public IActionResult List()
        {
            ListVM vm = new ListVM();

            vm.Posts = _db.Posts.Include(u => u.Category)
                       .Include(u => u.PostTags)
                       .ToList();

            return(View(vm));
        }
Ejemplo n.º 15
0
        public ListVM CreateList(string UserID)
        {
            OneListEntitiesCore db = new OneListEntitiesCore();
            ListVM cleanList       = new ListVM();

            cleanList.ListType       = db.ListTypes.Select(s => s);
            cleanList.ItemCategory   = db.ItemCategories.Where(cat => cat.UserID == UserID).Select(s => s);
            cleanList.SuscriberGroup = db.SuscriberGroups.Where(group => group.UserID == UserID).Select(s => s);
            return(cleanList);
        }
Ejemplo n.º 16
0
            public void zipToExerciceList(string file, ListVM activityList)
            {
                string zipPath     = file;
                string extractPath = Environment.GetEnvironmentVariable("LocalAppData") + "\\MyOrtho\\" + DateTime.Now.ToString("yyyyMMddHHmmss");

                if (!String.IsNullOrEmpty(zipPath))
                {
                    ZipFile.ExtractToDirectory(zipPath, extractPath);
                    populateExerciceList(extractPath, activityList);
                }
            }
Ejemplo n.º 17
0
        public IActionResult Index()
        {
            ListVM result = new ListVM()
            {
                Menu        = _db.Menus.ToList(),
                ContentList = _db.Contents.ToList()
            };


            return(View(result));
        }
Ejemplo n.º 18
0
        public bool CreateList(ListVM list)
        {
            try
            {
                OneListEntitiesCore db = new OneListEntitiesCore();
                //first, create List

                List newList = new List();

                newList.CreationDate = list.CreationDate;
                newList.CreatorID    = list.CreatorID;
                newList.ListName     = list.ListName;
                newList.ListTypeID   = list.ListTypeID;
                newList.ListStatusID = 1;

                List createdList = db.Lists.Add(newList);
                //then create list items and users
                db.SaveChanges();
                //list users
                string[] groups = list.SuscribergroupID.Split(',');
                foreach (string group in groups)
                {
                    ListUser Luser = new ListUser();
                    Luser.ListID           = createdList.ListID;
                    Luser.SuscriberGroupID = int.Parse(group);
                    Luser.SuscriptionDate  = list.CreationDate.ToShortDateString();

                    ListUser createdLuser = db.ListUsers.Add(Luser);
                    db.SaveChanges();
                }


                //listitems
                IEnumerable <Item> selectedItems = db.Items
                                                   .Where(a => a.ItemCategory == list.ItemCategoryID && a.UserID == list.CreatorID)
                                                   .Select(s => s);

                foreach (Item sel in selectedItems)
                {
                    ListItem lItem = new ListItem();
                    lItem.ItemID              = sel.ItemID;
                    lItem.ListID              = createdList.ListID;
                    lItem.ListItemSolved      = false;
                    lItem.ListItemSolvingDate = DateTime.Today;
                    db.ListItems.Add(lItem);
                }
                db.SaveChanges();
                return(true);
            }
            catch (Exception ex) {
                return(false);
            }
        }
Ejemplo n.º 19
0
 public InstructionOperandVM()
 {
     SByte         = new SByteVM(a => FieldUpdated());
     Byte          = new ByteVM(a => FieldUpdated());
     Int32         = new Int32VM(a => FieldUpdated());
     Int64         = new Int64VM(a => FieldUpdated());
     Single        = new SingleVM(a => FieldUpdated());
     Double        = new DoubleVM(a => FieldUpdated());
     String        = new StringVM(a => FieldUpdated());
     OperandListVM = new ListVM <object>((a, b) => FieldUpdated());
     OperandListVM.DataErrorInfoDelegate = VerifyOperand;
 }
Ejemplo n.º 20
0
 public InstructionOperandVM()
 {
     this.@sbyte        = new SByteVM(a => FieldUpdated());
     this.@byte         = new ByteVM(a => FieldUpdated());
     this.int32         = new Int32VM(a => FieldUpdated());
     this.int64         = new Int64VM(a => FieldUpdated());
     this.single        = new SingleVM(a => FieldUpdated());
     this.@double       = new DoubleVM(a => FieldUpdated());
     this.@string       = new StringVM(a => FieldUpdated());
     this.operandListVM = new ListVM <object>((a, b) => FieldUpdated());
     this.OperandListVM.DataErrorInfoDelegate = VerifyOperand;
 }
Ejemplo n.º 21
0
        public ActionResult ListAlltopics()
        {
            var result = db.Topics.Include(x => x.TopicDetails).ToList()
                         .GroupBy(x => x.TopicDate)
                         .OrderBy(g => g.Key);
            var m = new ListVM
            {
                TopicsSortedByDAte = result
            };

            return(PartialView("_ListAlltopics", m));
        }
Ejemplo n.º 22
0
 public ActionResult CreateList()
 {
     if (Request.IsAuthenticated)
     {
         ListRepo rep       = new ListRepo();
         string   userID    = FindUserID();
         ListVM   cleanList = rep.CreateList(userID);
         return(View(cleanList));
     }
     else
     {
         return(RedirectToAction("Login", "Home"));
     }
 }
Ejemplo n.º 23
0
        public void ListPOCO_Get()
        {
            //given
            var listVM = new ListVM()
            {
                Title             = "list test title",
                ServerRelativeUrl = "server realtive url of list"
            };
            //when
            var listPOCO = listVM.ListPOCO;

            //then
            Assert.AreEqual(listVM.Title, listPOCO.Title);
            Assert.AreEqual(listVM.ServerRelativeUrl, listPOCO.ServerRelativeUrl);
        }
Ejemplo n.º 24
0
        public void CheckReentrancyThrowsInvalidOperationException()
        {
            var dl = new List <TestItemDM> {
                new TestItemDM(0), new TestItemDM(1), new TestItemDM(2)
            };
            var bl = new ListBM <TestItemBM> {
                Metadata = { DataProvider = { Data = dl } }
            };
            var vl = new ListVM <TestItemVM> {
                Metadata = { DataProvider = { Data = bl } }
            };

            vl.CollectionChanged += OnViewModelCollectionChangedCallInvalid;
            vl.Add(TestItemVM.New());
            vl.CollectionChanged -= OnViewModelCollectionChangedCallInvalid;
        }
Ejemplo n.º 25
0
        string VerifyInstruction(ListVM <InstructionVM> list)
        {
            var item  = list.SelectedItem;
            var instr = item as InstructionVM;

            if (item != null && instr == null)
            {
                return(dnSpy_AsmEditor_Resources.Error_OnlyInstrsCanBeSelected);
            }

            if (instr != null && instr.Index == -1)
            {
                return(dnSpy_AsmEditor_Resources.Error_InstrHasBeenRemoved);
            }

            return(string.Empty);
        }
Ejemplo n.º 26
0
        string VerifyInstruction(ListVM <InstructionVM> list)
        {
            var item  = list.SelectedItem;
            var instr = item as InstructionVM;

            if (item != null && instr == null)
            {
                return("Only instructions can be selected");
            }

            if (instr != null && instr.Index == -1)
            {
                return("Instruction has been removed");
            }

            return(string.Empty);
        }
        public void NotifyDataChangedTest()
        {
            _dataList = new List <TestData> {
                new TestData()
            };
            var listVM = new ListVM <TestVM> {
                Metadata = new ListViewModelMetadata {
                    DataProvider = new CustomDataProvider <IEnumerable <TestData> >(GetData, null)
                }
            };

            Assert.AreEqual(1, listVM.Count);
            _dataList.Add(new TestData());
            Assert.AreEqual(1, listVM.Count);
            //listVM.DebuggerFlags.Breakpoints.OnDataChanged = true;
            listVM.Metadata.DataProvider.NotifyDataChanged();
            Assert.AreEqual(2, listVM.Count);
        }
Ejemplo n.º 28
0
        public void SelectedListAbsoluteUrl_ReturnsProperListUrl()
        {
            //given
            var listVM = new ListVM()
            {
                ServerRelativeUrl = "/sites/site/list"
            };
            var indexVM = new IndexVM()
            {
                SelectedListVM = listVM,
                HostWebUrl     = "http://hostWebUtl/sites/site"
            };
            //when
            var listUrl = indexVM.SelectedListAbsoluteUrl;

            //then
            Assert.AreEqual("http://hostWebUtl/sites/site/list", listUrl);
        }
Ejemplo n.º 29
0
        string VerifyOperand(ListVM <object> list)
        {
            var item = list.SelectedItem;

            switch (InstructionOperandType)
            {
            case MethodBody.InstructionOperandType.BranchTarget:
                var instr = item as InstructionVM;
                if (instr == null || instr == InstructionVM.Null)
                {
                    return("Operand must be an instruction");
                }
                if (instr.Index == -1)
                {
                    return("Instruction target has been removed");
                }
                break;

            case MethodBody.InstructionOperandType.Local:
                var local = item as LocalVM;
                if (local == null || local == LocalVM.Null)
                {
                    return("Operand must be a local");
                }
                if (local.Index == -1)
                {
                    return("Local has been removed");
                }
                break;

            case MethodBody.InstructionOperandType.Parameter:
                var p = item as Parameter;
                if (p == null || p == BodyUtils.NullParameter)
                {
                    return("Operand must be a parameter");
                }
                break;

            default:
                break;
            }

            return(string.Empty);
        }
Ejemplo n.º 30
0
        string VerifyOperand(ListVM <object> list)
        {
            var item = list.SelectedItem;

            switch (InstructionOperandType)
            {
            case MethodBody.InstructionOperandType.BranchTarget:
                var instr = item as InstructionVM;
                if (instr == null || instr == InstructionVM.Null)
                {
                    return(dnSpy_AsmEditor_Resources.Error_OpMustBeInstr);
                }
                if (instr.Index == -1)
                {
                    return(dnSpy_AsmEditor_Resources.Error_InstrTargetHasBeenRemoved);
                }
                break;

            case MethodBody.InstructionOperandType.Local:
                var local = item as LocalVM;
                if (local == null || local == LocalVM.Null)
                {
                    return(dnSpy_AsmEditor_Resources.Error_OpMustBeLocal);
                }
                if (local.Index == -1)
                {
                    return(dnSpy_AsmEditor_Resources.Error_LocalHasBeenRemoved);
                }
                break;

            case MethodBody.InstructionOperandType.Parameter:
                var p = item as Parameter;
                if (p == null || p == BodyUtils.NullParameter)
                {
                    return(dnSpy_AsmEditor_Resources.Error_OpMustBeParam);
                }
                break;

            default:
                break;
            }

            return(string.Empty);
        }
Ejemplo n.º 31
0
 public void BaseSetup()
 {
     Setup          = new ValidatorMockConfigurationFluent();
     List           = new ListVM(Setup);
     ItemDescriptor = ItemVM.ClassDescriptor;
 }
Ejemplo n.º 32
0
 public ListPage()
 {
     InitializeComponent();
     BindingContext = new ListVM();
 }
Ejemplo n.º 33
0
		string VerifyOperand(ListVM<object> list) {
			var item = list.SelectedItem;

			switch (InstructionOperandType) {
			case MethodBody.InstructionOperandType.BranchTarget:
				var instr = item as InstructionVM;
				if (instr == null || instr == InstructionVM.Null)
					return dnSpy_AsmEditor_Resources.Error_OpMustBeInstr;
				if (instr.Index == -1)
					return dnSpy_AsmEditor_Resources.Error_InstrTargetHasBeenRemoved;
				break;

			case MethodBody.InstructionOperandType.Local:
				var local = item as LocalVM;
				if (local == null || local == LocalVM.Null)
					return dnSpy_AsmEditor_Resources.Error_OpMustBeLocal;
				if (local.Index == -1)
					return dnSpy_AsmEditor_Resources.Error_LocalHasBeenRemoved;
				break;

			case MethodBody.InstructionOperandType.Parameter:
				var p = item as Parameter;
				if (p == null || p == BodyUtils.NullParameter)
					return dnSpy_AsmEditor_Resources.Error_OpMustBeParam;
				break;

			default:
				break;
			}

			return string.Empty;
		}
Ejemplo n.º 34
0
 public InstructionOperandVM()
 {
     this.@sbyte = new SByteVM(a => FieldUpdated());
     this.@byte = new ByteVM(a => FieldUpdated());
     this.int32 = new Int32VM(a => FieldUpdated());
     this.int64 = new Int64VM(a => FieldUpdated());
     this.single = new SingleVM(a => FieldUpdated());
     this.@double = new DoubleVM(a => FieldUpdated());
     this.@string = new StringVM(a => FieldUpdated());
     this.operandListVM = new ListVM<object>((a, b) => FieldUpdated());
     this.OperandListVM.DataErrorInfoDelegate = VerifyOperand;
 }
Ejemplo n.º 35
0
        string VerifyOperand(ListVM<object> list)
        {
            var item = list.SelectedItem;

            switch (InstructionOperandType) {
            case MethodBody.InstructionOperandType.BranchTarget:
                var instr = item as InstructionVM;
                if (instr == null || instr == InstructionVM.Null)
                    return "Operand must be an instruction";
                if (instr.Index == -1)
                    return "Instruction target has been removed";
                break;

            case MethodBody.InstructionOperandType.Local:
                var local = item as LocalVM;
                if (local == null || local == LocalVM.Null)
                    return "Operand must be a local";
                if (local.Index == -1)
                    return "Local has been removed";
                break;

            case MethodBody.InstructionOperandType.Parameter:
                var p = item as Parameter;
                if (p == null || p == BodyUtils.NullParameter)
                    return "Operand must be a parameter";
                break;

            default:
                break;
            }

            return string.Empty;
        }
Ejemplo n.º 36
0
 bool HasListError(ListVM<object> list)
 {
     return !string.IsNullOrEmpty(VerifyOperand(list));
 }
Ejemplo n.º 37
0
		public InstructionOperandVM() {
			SByte = new SByteVM(a => FieldUpdated());
			Byte = new ByteVM(a => FieldUpdated());
			Int32 = new Int32VM(a => FieldUpdated());
			Int64 = new Int64VM(a => FieldUpdated());
			Single = new SingleVM(a => FieldUpdated());
			Double = new DoubleVM(a => FieldUpdated());
			String = new StringVM(a => FieldUpdated());
			OperandListVM = new ListVM<object>((a, b) => FieldUpdated());
			OperandListVM.DataErrorInfoDelegate = VerifyOperand;
		}
Ejemplo n.º 38
0
		public InstructionVM() {
			InstructionOperandVM = new InstructionOperandVM();
			InstructionOperandVM.PropertyChanged += (a, b) => HasErrorUpdated();
			CodeVM = new ListVM<Code>(codeList, (a, b) => OnCodeUpdated());
		}