/// <summary> /// 初始化 找到前面背景各32张图 /// </summary> void InitMethod() { int count = Force.transform.childCount;//count==32; for (int i = 0; i < count / 8; i++) { //4row 4个list List <GameObject> list = new List <GameObject>(); //8列 column for (int k = 0; k < count / 4; k++) { //根据二维坐标计算,(0,0)(0,1)(r,c)(当前r*总列数+当前列数);总列数为:固定值; list.Add(Force.transform.GetChild(k + i * 8).gameObject); } ForceList.Add(list); } count = Back.transform.childCount; for (int i = 0; i < count / 8; i++) { List <GameObject> list = new List <GameObject>(); for (int k = 0; k < count / 4; k++) { list.Add(Back.transform.GetChild(k + i * 8).gameObject); } BackList.Add(list); } }
public static void RemoveExercise(string type, ExerciseModel exercise) { if (type == "Chest") { ChestList.Remove(exercise); } else if (type == "Back") { BackList.Remove(exercise); } else if (type == "Legs") { LegsList.Remove(exercise); } else if (type == "Shoulders") { ShouldersList.Remove(exercise); } else if (type == "Arms") { ArmsList.Remove(exercise); } else if (type == "Abs") { AbsList.Remove(exercise); } App.Current.MainPage.Navigation.PopToRootAsync(); Application.Current.MainPage.Navigation.PushAsync(new WorkoutLogger.Views.ExerciseListPage(type)); DataService.UserDataService.SaveData(); }
//验证下一个状态不通过角色列表 //返回值,true 有不通过角色,具体参看list 返回 public static bool GetIllegalList(ref List <int> BackList) { if (BackList == null) { BackList = new List <int>(); } BackList.Clear(); return(BackList.Count > 0 ? true : false); }
async void OnRegisterUserClicked(object sender, EventArgs args) { i = await ManagerDefine <BackList <Interesse> > .manager.GetTasksAsync(Constants.listInteressiUrl); ads = await ManagerDefine <BackList <Admin> > .manager.GetTasksAsync(Constants.listAdminUrl); Constants.interessi = i.data; Constants.aziende = ads.data; Constants.CurrentUser = null; await Navigation.PushAsync(new Registrati()); }
public void AddOval() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); ElipseShape rect = new ElipseShape(new Rectangle(x, y, 100, 100)); rect.FillColor = Color.White; ShapeList.Add(rect); BackList.Add(rect); }
public void AddRectMercedes() { Random rnd = new Random(); int x = rnd.Next(100, 1000); int y = rnd.Next(100, 600); RectMercedes rect = new RectMercedes(new Rectangle(x, y, 200, 100)); rect.FillColor = Color.White; ShapeList.Add(rect); BackList.Add(rect); }
//_____________________________________________________________________________________________________________________________________________________________ public void GoBack() { LogHelper.Add("GoBack"); if (BackList.Count == 0) { return; } Tuple <string, int, int> pos = BackList.Pop(); try { hostObject.CurrentPowerShellTab.Files.SetSelectedFile(hostObject.CurrentPowerShellTab.Files.Where(file => file.FullPath.iEquals(pos.Item1)).FirstOrDefault()); hostObject.CurrentPowerShellTab.Files.SelectedFile.Editor.SetCaretPosition(pos.Item2, pos.Item3); } catch (Exception ex) { LogHelper.AddException(ex, "GetReferences", null); } }
public static void AddExercise(string type, string entry) { ExerciseModel newExercise = new ExerciseModel(); newExercise.Name = entry; List <LogModel> newData = new List <LogModel>(); LogModel data1 = new LogModel(); data1.Reps = 0; data1.Sets = 0; data1.Weights = 0; data1.Trend = 0; data1.Date = DateTime.Now.ToString("dd/MM/yy"); newData.Add(data1); newExercise.Data = newData; if (type == "Chest") { ChestList.Add(newExercise); } else if (type == "Back") { BackList.Add(newExercise); } else if (type == "Legs") { LegsList.Add(newExercise); } else if (type == "Shoulders") { ShouldersList.Add(newExercise); } else if (type == "Arms") { ArmsList.Add(newExercise); } else if (type == "Abs") { AbsList.Add(newExercise); } App.Current.MainPage.Navigation.PopToRootAsync(); Application.Current.MainPage.Navigation.PushAsync(new WorkoutLogger.Views.ExerciseListPage(type)); DataService.UserDataService.SaveData(); }
//_____________________________________________________________________________________________________________________________________________________________ public bool GoToDefinition() { LogHelper.Add("GoToDefinition"); try { ISEEditor editor = hostObject.CurrentPowerShellTab.Files.SelectedFile.Editor; string currentFile = hostObject.CurrentPowerShellTab.Files.SelectedFile.FullPath; string caretLineText = editor.CaretLineText; Tuple <string, int, int> pos = new Tuple <string, int, int>(currentFile, editor.CaretLine, editor.CaretColumn); List <PSToken> list = PSParser.Tokenize(caretLineText, out Collection <PSParseError> errors).Where(t => (t.Type == PSTokenType.Command || t.Type == PSTokenType.Member) && t.StartColumn <= editor.CaretColumn && t.EndColumn >= editor.CaretColumn).ToList(); List <cFunction> functions = mProjects.Project.Functions.GetFunctionByFileAndName(currentFile, list[0].Content); if (functions.Count == 0) { functions = mProjects.Project.Functions.GetFunctionByName(list[0].Content); } if (functions.Count == 0) { return(false); } cFunction function = GetSelectedFileName(functions, currentFile, editor); ISEFile file = hostObject.CurrentPowerShellTab.Files.Where(x => x.FullPath.iEquals(function.FullName)).FirstOrDefault(); if (file != null) { hostObject.CurrentPowerShellTab.Files.SetSelectedFile(file); } else { try { hostObject.CurrentPowerShellTab.Files.Add(function.FullName); } catch (Exception ex) { LogHelper.AddException(ex, "GoToDefinition", null); return(false); } } hostObject.CurrentPowerShellTab.Files.SelectedFile.Editor.SetCaretPosition(functions[0].Line, 1); hostObject.CurrentPowerShellTab.Files.SelectedFile.Editor.Select(function.Line, function.Position, function.Line, function.Position + function.Name.Length); BackList.Push(pos); return(true); } catch (Exception ex) { LogHelper.AddException(ex, "GoToDefinition", null); return(false); } }
//_____________________________________________________________________________________________________________________________________________________________ public void GetReferences() { LogHelper.Add("GetReferences"); ISEEditor editor = hostObject.CurrentPowerShellTab.Files.SelectedFile.Editor; string caretLineText = editor.CaretLineText; string currentFile = hostObject.CurrentPowerShellTab.Files.SelectedFile.FullPath; Tuple <string, int, int> pos = new Tuple <string, int, int>(currentFile, editor.CaretLine, editor.CaretColumn); List <PSToken> list = PSParser.Tokenize(caretLineText, out Collection <PSParseError> errors).Where(t => t.Type == PSTokenType.Command && t.StartColumn <= editor.CaretColumn && t.EndColumn >= editor.CaretColumn).ToList(); if (list.Count == 0) { list = PSParser.Tokenize(caretLineText, out errors).Where(t => t.Type == PSTokenType.CommandParameter && t.StartColumn <= editor.CaretColumn && t.EndColumn >= editor.CaretColumn).ToList(); } if (list.Count == 0) { list = PSParser.Tokenize(caretLineText, out errors).Where(t => t.Type == PSTokenType.CommandArgument && t.StartColumn <= editor.CaretColumn && t.EndColumn >= editor.CaretColumn).ToList(); } if (list.Count == 0) { list = PSParser.Tokenize(caretLineText, out errors).Where(t => t.StartColumn <= editor.CaretColumn && t.EndColumn >= editor.CaretColumn).ToList(); } if (list.Count == 0) { return; } PSToken tkn = list[0]; List <cScriptLocation> lst = GetAllReferenceLocations(tkn); string title = $"{tkn.Content} ({tkn.Type}) [{lst.Count}]"; if (tkn.Type == PSTokenType.String) // if tkn is a string with less than 2 results, try to searh into the string for additional tokens { PSToken tknsubstr = Token.GetPSTokenInLocation(caretLineText, tkn, editor.CaretColumn); if (tknsubstr != null) { List <cScriptLocation> lstsubstr = GetAllReferenceLocations(tknsubstr); if (lstsubstr.Count > 0) { lst.AddRange(lstsubstr);// is string found more tokens replace the list with the new result title += $" / {tknsubstr.Content} ({tknsubstr.Type}) [{lstsubstr.Count}]"; } } } if (lst.Count == 0) { return; } using (frmReferences f = new frmReferences()) { f.Locations = lst; f.SelectDefaultLocation(Path.GetFileName(currentFile), editor.CaretLine); f.Command = $"References {title}"; f.ShowDialog(new WindowWrapper(WindowWrapper.GetSafeHandle())); if (!f.ReferenceSelected) { return; } cScriptLocation l = f.SelectedLocation; try { hostObject.CurrentPowerShellTab.Files.SetSelectedFile(hostObject.CurrentPowerShellTab.Files.Where(file => Path.GetFileName(file.FullPath).iEquals(l.fileName)).FirstOrDefault()); hostObject.CurrentPowerShellTab.Files.SelectedFile.Editor.SetCaretPosition(l.line, l.position); hostObject.CurrentPowerShellTab.Files.SelectedFile.Editor.Select(l.line, l.position, l.line, l.position + l.word.Length); BackList.Push(pos); } catch (Exception ex) { LogHelper.AddException(ex, "GetReferences", null); } } }