private void FormMain_Load(object sender, EventArgs e) { studentsGeneralClassList = StudentLoader.Load(); //studentsReadyInClass = StudentLoader.LoadWheel(); wheel i doldurmak için loader da bir yöntem yapmıştım onu iptal ettim aşağıdaki daha mantıklı. //aşağıdak iki satır Lİst kullanınıca çalışabilir. Ayıklamayı iki kademede yapabiliyorum List ile // studentsReadyInClass = studentsGeneralClassList; // önce kopyalıyorum, aşağıda ayıklıyorum. //studentsReadyInClass.RemoveAll(x => x.InClass == false); //int döner ve listeden iclass ı false olan elemaları siler // yukarıdakini aksine IEnumerable kullanırsam doğrudan where ile ayıklamayı bir kerede yapabliyorum. studentsReadyInClass = studentsGeneralClassList.Where(x => x.InClass == true); //int döner ve listeden iclass ı false olan elemaları siler int test = studentsReadyInClass.Count(); spinnerWheel.StudentsReadyInClass = studentsReadyInClass.ToList(); // StudentsReadyInClass-->list but studentsReadyInClass--> IEnumerable list. Aktarbilmek için sonuna ToList eklemliyiz. spinnerWheel.AnimationEnabled = SettingsManager.Instance.Get(SettingName.ANIMATION_ENABLED, true); spinnerWheel.AnimationEndWaitDuration = SettingsManager.Instance.Get(SettingName.ANIMATION_WAIT_DURATION, 2500); spinnerWheel.FontSize = SettingsManager.Instance.Get(SettingName.FONT_SIZE, 9); spinnerWheel.StudentReelectionInSession = SettingsManager.Instance.Get(SettingName.PICK_STUDENT_AGAIN, true); spinnerWheel.RefreshSpinner(); spinnerWheel.OnStudentSelected += SpinnerWheel_OnStudentSelected; labelClassName.Text = SettingsManager.Instance.Get(SettingName.CLASS_NAME, "Name of Classroom"); labelClassName.Font = FontHelper.GetFont(labelClassName.Font.Size); labelSelectedStudent.Font = FontHelper.GetFont(labelSelectedStudent.Font.Size); }
public void RefreshSpinner() { spinnerBitmap = null; textFont = FontHelper.GetFont(FontSize); nonFlickerPanel.Invalidate(); }
private void SpinnerWheel_Load(object sender, EventArgs e) { textFont = FontHelper.GetFont(FontSize); rotationTimer = new Timer() { Interval = TIMER_INTERVAL }; rotationTimer.Tick += RotationTimer_Tick; }
private void FormMain_Load(object sender, EventArgs e) { students = StudentLoader.Load(); spinnerWheel.Students = students; spinnerWheel.AnimationEnabled = SettingsManager.Instance.Get(SettingName.ANIMATION_ENABLED, true); spinnerWheel.AnimationEndWaitDuration = SettingsManager.Instance.Get(SettingName.ANIMATION_WAIT_DURATION, 2500); spinnerWheel.FontSize = SettingsManager.Instance.Get(SettingName.FONT_SIZE, 9); spinnerWheel.RefreshSpinner(); spinnerWheel.OnStudentSelected += SpinnerWheel_OnStudentSelected; labelClassName.Text = SettingsManager.Instance.Get(SettingName.CLASS_NAME, "Name of Classroom"); labelClassName.Font = FontHelper.GetFont(labelClassName.Font.Size); labelSelectedStudent.Font = FontHelper.GetFont(labelSelectedStudent.Font.Size); }
public override void LoadContent() { base.LoadContent(); _spriteBatch = new SpriteBatch(GraphicsDevice); _background = Content.Load <Texture2D>("Images/MenuBackground"); //Load font range for scaling. _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-20")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-22")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-24")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-26")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-28")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-30")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-32")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-34")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-36")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-38")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-40")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-42")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-44")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-46")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-48")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-50")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-52")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-54")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-56")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-58")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-60")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-62")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-64")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-66")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-68")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-70")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-72")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-74")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-76")); _fontList.Add(Content.Load <BitmapFont>("Fonts/arial-78")); fontPackage = FontHelper.GetFont(_fontList, proposedTextHeight, GraphicsDevice.Viewport.Bounds); newGame = FontHelper.SetTextBoxPosition(newGame, fontPackage, GraphicsDevice.Viewport.Bounds, VerticalPosition.Centered, 0f, HorizontalPosition.Centered, 0f); RectangleF newGameRectangle = fontPackage.Font.GetStringRectangle(newGame.Value); float centerPointNewGame = GraphicsDevice.Viewport.Bounds.Width / 2f - (newGameRectangle.Width / 2f); float verticalPointNewGame = GraphicsDevice.Viewport.Bounds.Height * 0.25f; newGame.Location = new Vector2(centerPointNewGame, verticalPointNewGame); newGameRectangle.Position = new Point2(newGame.Location.X, newGame.Location.Y); newGame.BoundingBox = newGameRectangle; RectangleF loadGameRectangle = fontPackage.Font.GetStringRectangle(loadGame.Value); float centerPointLoadGame = GraphicsDevice.Viewport.Bounds.Width / 2f - (loadGameRectangle.Width / 2f); float verticalPointLoadGame = verticalPointNewGame + (newGame.BoundingBox.Height * 1.5f); loadGame.Location = new Vector2(centerPointLoadGame, verticalPointLoadGame); RectangleF optionsRectangle = fontPackage.Font.GetStringRectangle(options.Value); float centerPointOptions = GraphicsDevice.Viewport.Bounds.Width / 2f - (optionsRectangle.Width / 2f); float verticalPointOptions = verticalPointLoadGame + (newGame.BoundingBox.Height * 1.5f); options.Location = new Vector2(centerPointOptions, verticalPointOptions); RectangleF exitRectangle = fontPackage.Font.GetStringRectangle(exit.Value); float centerPointExit = GraphicsDevice.Viewport.Bounds.Width / 2f - (exitRectangle.Width / 2f); float verticalPointExit = verticalPointOptions + (newGame.BoundingBox.Height * 1.5f); exit.Location = new Vector2(centerPointExit, verticalPointExit); exitRectangle.Position = new Point2(exit.Location.X, exit.Location.Y); exit.BoundingBox = exitRectangle; }