Example #1
0
        //private void SetupAnimatedValuesSpy()
        //{
        //    StopAnimatedValuesSpy();

        //    this.AnimatedValuesSpy = null;
        //    this.ScaleAnimation = null;

        //    if (this._secondTextBlockUI != null)
        //    {
        //        const string visualScaleTargetedPropertyName = "visual.Scale";
        //        UIElement ppChild = this._secondTextBlockUI;
        //        Visual visualPPChild = ElementCompositionPreview.GetElementVisual(ppChild);

        //        Compositor compositor = visualPPChild.Compositor;

        //        this.AnimatedValuesSpy = compositor.CreatePropertySet();

        //        this.AnimatedValuesSpy.InsertVector3("Scale", new Vector3(0.0f, 0.0f, 0.0f));

        //        this.ScaleAnimation = compositor.CreateExpressionAnimation(visualScaleTargetedPropertyName);
        //        this.ScaleAnimation.SetReferenceParameter("visual", visualPPChild);

        //        CheckSpyingTicksRequirement();

        //        TickForValuesSpy();
        //    }
        //    else
        //    {
        //        ResetSpyOutput();
        //    }
        //}

        //private void StartAnimatedValuesSpy()
        //{
        //    if (this.AnimatedValuesSpy != null)
        //    {
        //        this.AnimatedValuesSpy.StartAnimation("Scale", this.ScaleAnimation);
        //    }
        //}

        //private void StopAnimatedValuesSpy()
        //{
        //    if (this.AnimatedValuesSpy != null)
        //    {
        //        this.AnimatedValuesSpy.StopAnimation("Scale");
        //    }
        //}

        //private void SpyAnimatedValues()
        //{
        //    if (this.AnimatedValuesSpy != null)
        //    {
        //        StopAnimatedValuesSpy();

        //        Vector3 scale;
        //        CompositionGetValueStatus status = this.AnimatedValuesSpy.TryGetVector3("Scale", out scale);
        //        if (CompositionGetValueStatus.Succeeded == status)
        //        {
        //            this.ScaleTextX.Text = scale.X.ToString();
        //            this.ScaleTextY.Text = scale.Y.ToString();
        //        }
        //        else
        //        {
        //            this.ScaleTextX.Text = this.ScaleTextY.Text = "status=" + status.ToString();
        //        }

        //        StartAnimatedValuesSpy();

        //        // System.Diagnostics.Debug.WriteLine("Spied values: " + this.ScaleTextX.Text);
        //    }
        //}

        //private void ResetSpyOutput()
        //{
        //    this.ScaleTextX.Text = this.ScaleTextY.Text = "0 - reset";
        //}

        //private void TickForValuesSpy()
        //{
        //    this.UIThreadTicksForValuesSpy = 6;
        //    CheckSpyingTicksRequirement();
        //}

        //private void CheckSpyingTicksRequirement()
        //{
        //    if (this._secondTextBlockUI != null &&
        //        (this.UIThreadTicksForValuesSpy > 0) && this.AnimatedValuesSpy != null)
        //    {
        //        if (!this.IsRenderingHooked)
        //        {
        //            this.IsRenderingHooked = true;
        //            Windows.UI.Xaml.Media.CompositionTarget.Rendering += CompositionTarget_Rendering;
        //        }
        //    }
        //    else
        //    {
        //        if (this.IsRenderingHooked)
        //        {
        //            Windows.UI.Xaml.Media.CompositionTarget.Rendering -= CompositionTarget_Rendering;
        //            this.IsRenderingHooked = false;
        //        }
        //    }
        //}

        //private void CompositionTarget_Rendering(object sender, object e)
        //{
        //    if (this.UIThreadTicksForValuesSpy > 0)
        //    {
        //        this.UIThreadTicksForValuesSpy--;
        //    }
        //    CheckSpyingTicksRequirement();
        //    SpyAnimatedValues();
        //}

        void PerformGlyphVerification(RatingControl rc, String expectedGlyph, TextBlock resultTb, String stackPanelName, SolidColorBrush expectedColor = null)
        {
            ContentPresenter presenter = FindVisualChildByName(rc, "ForegroundContentPresenter") as ContentPresenter;

            DependencyObject obj = FindVisualChildByName(rc, stackPanelName);
            var       child      = VisualTreeHelper.GetChild(obj, 0);
            TextBlock tb         = child as TextBlock;

            String glyph = tb.Text;

            if (glyph.Equals(expectedGlyph))
            {
                resultTb.Text = "+";
                // Verify colour to make sure we don't accidentally take the non-pointer over as a false-positive
                if (expectedColor == null || TextElement.GetForeground(presenter).Equals(expectedColor))
                {
                    resultTb.Text = "+";
                }
                else
                {
                    resultTb.Text = "/";
                }
            }
            else
            {
                resultTb.Text = "-";
            }
        }
Example #2
0
        void PerformImageVerification(RatingControl rc, String expectedUri, TextBlock resultTb, String stackPanelName, SolidColorBrush expectedColor = null)
        {
            ContentPresenter presenter = FindVisualChildByName(rc, "ForegroundContentPresenter") as ContentPresenter;

            DependencyObject obj = FindVisualChildByName(rc, stackPanelName);
            var         child    = VisualTreeHelper.GetChild(obj, 0);
            Image       image    = child as Image;
            var         source   = image.Source;
            BitmapImage bitImage = source as BitmapImage;

            String uri = bitImage?.UriSource.ToString() ?? source.ToString();

            if (uri.Equals(expectedUri))
            {
                resultTb.Text = "+";
                // Verify colour to make sure we don't accidentally take the non-pointer over as a false-positive
                // The colours aren't used, but the state is there so we can still check.
                if (expectedColor == null || TextElement.GetForeground(presenter).Equals(expectedColor))
                {
                    resultTb.Text = "+";
                }
                else
                {
                    resultTb.Text = "/";
                }
            }
            else
            {
                resultTb.Text = "-";
            }
        }
Example #3
0
        void ReleaseDesignerOutlets()
        {
            if (AuthorNameLabel != null)
            {
                AuthorNameLabel.Dispose();
                AuthorNameLabel = null;
            }

            if (RatingControl != null)
            {
                RatingControl.Dispose();
                RatingControl = null;
            }

            if (ReviewDateLabel != null)
            {
                ReviewDateLabel.Dispose();
                ReviewDateLabel = null;
            }

            if (ReviewLabel != null)
            {
                ReviewLabel.Dispose();
                ReviewLabel = null;
            }
        }
Example #4
0
 private void AddToCondition(Condition cond, Field field, Operator op, RatingControl ratingControl)
 {
     if (ratingControl.Value > 0)
     {
         cond.Add(new SingleCondition(field, op, ratingControl.Value));
     }
 }
Example #5
0
        private void Classificacao_ValueChanged(RatingControl sender, object args)
        {
            RatingControl ratingControl = sender as RatingControl;
            int           valorNovo     = (int)ratingControl.Value;

            if (valorNovo == -1)
            {
                valorNovo = 0;
            }
            if (Avaliacao_comentario != null)
            {
                Filme.Classificacao            = Filme.Classificacao - Avaliacao_comentario.Avaliacao + valorNovo;
                Avaliacao_comentario.Avaliacao = valorNovo;
                Avaliacao_comentario.UpdateAvaliacao();
                Filme.UpdateClassificacao();
            }
            else
            {
                Avaliacao_comentario              = new Avaliacao_comentario();
                Avaliacao_comentario.Idfilme      = Filme.Idfilme;
                Avaliacao_comentario.Idutilizador = App.utilizador.Idutilizador;
                Avaliacao_comentario.Avaliacao    = valorNovo;
                Filme.Classificacao += valorNovo;
                Avaliacao_comentario.Create();
                Filme.UpdateClassificacao();
            }
        }
Example #6
0
        private void SetRatingField(Field field, Operator op, RatingControl ratingControl)
        {
            SingleCondition cond = condition.FindByField(field, op);

            if (cond != null)
            {
                ratingControl.Value = (int)cond.Value;
            }
        }
        private async void MyHospRating_ValueChanged(RatingControl sender, object args)
        {
            if (sender.Value > 0)
            {
                await viewModel.UpdateHospitalRating(hosp_id, (double)sender.Value);

                myHospRating.Caption = myHospRating.Value.ToString();
            }
        }
Example #8
0
 private void ratingStar1_RatingValueChanged(object sender, RatingControl.RatingChangedEventArgs e)
 {
     foreach (Keyword keyword in dataListView1.SelectedObjects)
     {
         keyword.Rated = (int)ratingStar1.Rating;
         //Keyword keyword1 = keyword;
         //var k = _db.Keywords.Where(o => o.Id == keyword1.Id).FirstOrDefault().Rated = (int)ratingStar1.Rating;
     }
     _db.SaveChanges();
 }
Example #9
0
        private async void MyRating_ValueChanged(RatingControl sender, object args)
        {
            if (sender.Value > 0)
            {
                await viewModel.UpdateDoctor(id, (double)sender.Value);

                //myListView.SelectedIndex = index;
                //myRating.Caption = myRating.Value.ToString();
            }
        }
Example #10
0
        private void OnStarRatingChanged(RatingControl sender, object args)
        {
            var value = sender.Value;

            EnsureReview();
            BookData.Review.NStars = value;
            var bookdb = BookDataContext.Get();

            CommonQueries.BookSaveChanges(bookdb);
        }
Example #11
0
 private void MaxRating9Unset_ValueChanged(RatingControl sender, object args)
 {
     if (sender.Value == -1)
     {
         MaxRating9UnsetTextBlock.Text = "!!" + sender.PlaceholderValue.ToString();
     }
     else
     {
         MaxRating9UnsetTextBlock.Text = sender.Value.ToString();
     }
 }
Example #12
0
 private void MyRatingIsClearEnabled_ValueChanged(RatingControl sender, object args)
 {
     if (sender.Value == -1)
     {
         MyRatingIsClearEnabledText.Text = "!" + sender.PlaceholderValue.ToString();
     }
     else
     {
         MyRatingIsClearEnabledText.Text = sender.Value.ToString();
     }
 }
Example #13
0
 private void ValueChangeInMarkup_ValueChanged(RatingControl sender, object args)
 {
     if (ValueChangeInMarkup.Value == -1)
     {
         ValueChangeInMarkupText.Text = "!!" + ValueChangeInMarkup.PlaceholderValue.ToString();
     }
     else
     {
         ValueChangeInMarkupText.Text = ValueChangeInMarkup.Value.ToString();
     }
 }
Example #14
0
        private async void MyRating_ValueChanged(RatingControl sender, object args)
        {
            if (sender.Value > 0)
            {
                //Bindings.Update();
                //await viewModel.UpdateDoctor(id, (double)sender.Value);

                //Bindings.Update();
                //myRating.Caption = myRating.Value.ToString();
            }
        }
Example #15
0
        private async void MyHospRating_ValueChanged(RatingControl sender, object args)
        {
            if (sender.Value > 0)
            {
                //Bindings.Update();
                await viewModel.UpdateHospitalRating(hosp_id, (double)sender.Value);

                //Bindings.Update();
                //await viewModel.GetHospitalByDept(address, DeptListbox.SelectedIndex);
                //myHospListView.SelectedIndex = index;
            }
        }
Example #16
0
        public string GetValue(Control ctrl1, XmlNode renderingDocument)
        {
            RatingControl ctrl = (RatingControl)ctrl1.Controls[1];
            string        root = String.IsNullOrEmpty(this.Name) ? "null" : this.Name;

            XmlDocument doc       = new XmlDocument();
            XmlNode     nodeValue = doc.CreateElement(root);

            doc.AppendChild(nodeValue);
            nodeValue.AppendChild(doc.CreateElement("Value"));
            nodeValue.FirstChild.InnerText = ctrl.CurrentRating.ToString();
            return(doc.OuterXml);
        }
Example #17
0
        // GET: RatingControls/Create
        public IActionResult Create(int?groupId, int?disciplineId)
        {
            if (groupId == null || disciplineId == null)
            {
                return(NotFound());
            }

            var ratingControl = new RatingControl();

            ratingControl.GroupId = (int)groupId;
            ratingControl.SemesterDisciplineId = (int)disciplineId;

            return(PartialView("_Create", ratingControl));
        }
Example #18
0
        private void MagicDisengager_ValueChanged(RatingControl sender, object args)
        {
            if (sender.Value == 3.0)
            {
                //sender.RemoveFocusEngagement();
            }

            if (sender.Value == -1)
            {
                MagicDisengagerTextBlock.Text = "null";
            }
            else
            {
                MagicDisengagerTextBlock.Text = sender.Value.ToString();
            }
        }
Example #19
0
 private void TestRatingControl_ValueChanged(RatingControl sender, object args)
 {
     if (TestRatingControl.Value == -1)
     {
         if (TestRatingControl.PlaceholderValue == -1)
         {
             TestTextBlockControl.Text = "!";
         }
         else
         {
             TestTextBlockControl.Text = "!" + TestRatingControl.PlaceholderValue.ToString();
         }
     }
     else
     {
         TestTextBlockControl.Text = sender.Value.ToString(); // Having both ways of referring to the control to make sure both work
     }
 }
Example #20
0
        public System.Web.UI.Control GetWebControl(System.Web.HttpServerUtility server, System.Xml.XmlNode renderingDocument)
        {
            PlaceHolder ph = new PlaceHolder();

            Label lbl = new Label();

            if (renderingDocument.Attributes["renderedLabel"] != null)
            {
                lbl.Text = renderingDocument.Attributes["renderedLabel"].Value.FromXmlValue2Render(server);
            }
            else
            {
                lbl.Text = this.Name.FromXmlName2Render(server);
            }
            lbl.CssClass = "label";
            ph.Controls.Add(lbl);

            int maxRate = 0;

            int.TryParse(maxRateFacet.Value, out maxRate);
            RatingControl starBox = new RatingControl(this, maxRate);

            //		if (renderingDocument.Attributes["class"] != null)
            //			starBox.CssClass = renderingDocument.Attributes["class"].Value.FromXmlValue2Render(server);
            //		if (renderingDocument.Attributes["rel"] != null)
            //			starBox.Attributes.Add("rel", renderingDocument.Attributes["rel"].Value.FromXmlValue2Render(server));
            //if (renderingDocument.Attributes["description"] != null)
            //    starBox.ToolTip = renderingDocument.Attributes["description"].Value.FromXmlValue2Render(server);

            ph.Controls.Add(starBox);


            //--- validators ---

            return(ph);
        }
Example #21
0
        public async Task <IActionResult> Edit([Bind("Id,SemesterDisciplineId,GroupId,Number,CompletionDate")] RatingControl ratingControl)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ratingControl);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RatingControlExists(ratingControl.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }

            return(RedirectToAction(nameof(Details), new { id = ratingControl.Id }));
        }
Example #22
0
 private void ratingTo_RatingValueChanged(object sender, RatingControl.RatingChangedEventArgs e)
 {
     textRatingTo.Text = ratingTo.Rating + "";
 }
 private void Favorite_ValueChanged(RatingControl sender, object args)
 {
     FavoriteHelper.AddToFavorite(Favorite.Value, new FavoriteKeyModel {
         Key = subtitleKey, Title = subtitleTitle, Value = subtitleUrl.Replace(Helper.Settings.SubsceneServer.Url, ""), Server = Server.Subscene
     });
 }
Example #24
0
        private void onVoteWidgetClick(object sender, int rating)
        {
            RatingControl voteWidget = (RatingControl)sender;

            controller.VoteUser(ratingUsers[voteWidget], rating);
        }
Example #25
0
        private void OnQuestionAnswersReceived(QuestionModel model)
        {
            while (!this.IsHandleCreated)
            {
                ;
            }
            if (this.InvokeRequired)
            {
                this.Invoke((QuestionController.ExternalEventHandler)
                            OnQuestionAnswersReceived, model);
                return;
            }
            int start = 0;

            if (answersRichTextBox.Text.Length != 0)
            {
                start = model.Answers.Count - 1;
            }

            for (int i = start; i < model.Answers.Count; i++)
            {
                answersRichTextBox.SelectionStart     = answersRichTextBox.Text.Length;
                answersRichTextBox.SelectionFont      = new Font("Verdana", 8, FontStyle.Bold);
                answersRichTextBox.SelectionBackColor = Color.LightGray;
                UserData owner = new UserData("x", "y");
                for (int j = 0; j < model.AnswerOwners.Count; j++)
                {
                    if (model.Answers[i].Owner == model.AnswerOwners[j].Id)
                    {
                        owner = model.AnswerOwners[j];
                        break;
                    }
                }
                answersRichTextBox.SelectedText = owner.Username + "\t" + model.Answers[i].Timestamp + "\n";
                answersRichTextBox.SelectedRtf  = model.Answers[i].Content;
                answersRichTextBox.SelectedText = "\n\n";
            }
            answersRichTextBox.ScrollToCaret();

            int index = 0;

            ratingUsers = new Dictionary <RatingControl, UserData>();
            usersPanel.Controls.Clear();
            foreach (UserData user in model.AnswerOwners)
            {
                RatingControl voteWidget = new RatingControl();
                voteWidget.Location = new Point(10, 27 + index * 45);
                voteWidget.AutoSize = false;
                voteWidget.Scale(new SizeF((float)0.45, (float)0.5));
                voteWidget.Fixed = false;
                if (user.Id == LoggedInUserModel.Instance.User.Id)
                {
                    voteWidget.Enabled = false;
                }
                voteWidget.SelectRating += new Rating.RatingControl.SelectRatingHandler(this.onVoteWidgetClick);
                if (model.My_votes.ContainsKey(user.Id))
                {
                    voteWidget.Rating = model.My_votes[user.Id];
                }
                else
                {
                    controller.CheckUserVote(user);
                }
                usersPanel.Controls.Add(voteWidget);


                Label userLabel = new Label();
                userLabel.Text     = user.Username + " (" + String.Format("{0:0.##}", user.Rank) + ")";
                userLabel.Location = new Point(55, 15 + index * 22);
                userLabel.AutoSize = true;
                usersPanel.Controls.Add(userLabel);
                userLabels.Add(userLabel, user.Id);
                userLabel.MouseClick += new System.Windows.Forms.MouseEventHandler(userClicked);
                index++;

                ratingUsers.Add(voteWidget, user);
            }

            postRichTextBox.Focus();
            changeStateIMButtons(model);
        }
Example #26
0
        private void OnAllTestsFinished(NewAccountModel model)
        {
            while (!this.IsHandleCreated)
            {
                ;
            }
            if (this.InvokeRequired)
            {
                this.Invoke((NewAccountController.ExternalEventHandler)
                            OnAllTestsFinished, model);
                return;
            }

            timer1.Enabled = false;

            if (type == TAKE_NEW_CERT)
            {
                int score = model.GetScoreForTest(0);

                if (score >= NewAccountModel.MIN_PASSING_SCORE)
                {
                    MessageBox.Show(
                        "You obtained " + score + " points and received the certification for the domain!",
                        "REACH");
                    controller.TakeNewCert(model.CertifiedDomains[0], score);
                }
                else
                {
                    MessageBox.Show(
                        "You didn't pass the test and did not received the certification. You may try again.",
                        "REACH");
                }

                parentForm.Close();
                this.Close();
                return;
            }

            testContainer.Visible    = false;
            resultsContainer.Visible = true;
            int passed = 0;

            for (int i = 0; i < model.CertifiedDomains.Count; ++i)
            {
                // rating control
                RatingControl r = new RatingControl();
                r.Location = new Point(89, 99 + i * (r.Height + 1));
                r.Rating   = model.GetScoreForTest(i);
                r.Fixed    = true;
                if (r.Rating >= NewAccountModel.MIN_PASSING_SCORE)
                {
                    ++passed;
                }
                r.Visible = true;
                resultsContainer.Controls.Add(r);

                // the label with the domain
                Label domainTitle = new Label();
                domainTitle.Location = new Point(12, 106 + i * (r.Height + 1));
                domainTitle.Font     = new Font(
                    "Microsoft Sans Serif",
                    9.75F,
                    FontStyle.Regular,
                    GraphicsUnit.Point,
                    ((byte)(0)));
                domainTitle.Text    = model.CertifiedDomains[i].Name + ":";
                domainTitle.Visible = true;
                resultsContainer.Controls.Add(domainTitle);

                // the label with the result
                Label domainStatus = new Label();
                domainStatus.Location = new Point(211, 106 + i * (r.Height + 1));
                domainStatus.Font     = new Font(
                    "Microsoft Sans Serif",
                    9.75F,
                    FontStyle.Bold,
                    GraphicsUnit.Point,
                    ((byte)(0)));
                if (r.Rating >= NewAccountModel.MIN_PASSING_SCORE)
                {
                    domainStatus.ForeColor = Color.Green;
                    domainStatus.Text      = "Passed";
                }
                else
                {
                    domainStatus.ForeColor = Color.Red;
                    domainStatus.Text      = "Failed";
                }
                domainStatus.Visible = true;
                resultsContainer.Controls.Add(domainStatus);
            }
            if (passed > 0)
            {
                resultTitle.Text =
                    "Your account was created. You will receive a certificate for each domain that you passed successfully.";
                controller.CreateAccount();
            }
            else
            {
                resultTitle.Text =
                    "You didn't pass any test. Your account was not created. You may try again.";
            }
        }
Example #27
0
 private void MyRatings_Changed(RatingControl sender, object args)
 {
     MyRatings.Caption = "Рейтинг " + sender.Value.ToString();
 }
 private void rsUserRating_RatingValueChanged(object sender, RatingControl.RatingChangedEventArgs e)
 {
     if (IsAuthorized)
         _controller.UpdateUserRating(_loggedInUser, _movie, rsUserRating.Rating);
     else
     {
         rsUserRating.Rating = 0;
     }
 }
        /// <summary>
        /// DnD: This method is designed to use the class property, [BaseModule], which is stores
        /// the updated version of colums's template generates by as an object of this class.
        /// for updating an existing colums's template
        /// </summary>
        /// <param name="columnsIDs"></param>
        /// <param name="collection"></param>
        /// <param name="cummulative"></param>
        /// <returns></returns>
        public string UpdateElementModule(string[] columnsIDs, object[] collection, bool cummulative)
        {
            if (this.BaseModule == null)
            {
                return(null);
            }

            var baseModule       = this.BaseModule;
            var existingSiblings = new List <string>();

            if (cummulative)
            {
                ///DnD In order to avoid duplications, it's important to first
                /// accertain which Columns are already contained in the BaseModule
                baseModule = this.UpdatedModule;
                var xl = XElement.Parse(baseModule);

                ///DnD Identify the location of the replate ment tag, <dummy />. Note that its
                ///string form's whitespaces could have changed hence the verbose conversion
                var dumName = XElement.Parse(ConstantStr.Dummy).Name.LocalName;
                while (xl != null && xl.Elements().Where(s => s.Name.LocalName == dumName).FirstOrDefault() == null)
                {
                    xl = xl.FirstNode as XElement;
                }

                if (xl == null)
                {
                    return(null);
                }

                existingSiblings = xl.Elements().Select(n => (n.Attributes().Where(a
                                                                                   => a.Name.LocalName.ToLower() == "header").FirstOrDefault())).Where(a
                                                                                                                                                       => a != null).Select(a => a.Value).ToList <String>();
            }
            var iniStr = baseModule;

            foreach (var collumnName in columnsIDs)
            {
                string[] args = new string[] { collumnName, EditText(collumnName, "Col") /*.Replace("/", "")*/, null };

                var colmItems = collection[0];// ((WkSheetModel)CachedContentPresenter.SelectedItem).PattnPageList[0] as PrintFormat;

                var objName = colmItems.GetType().GetProperties().Where(p => p.Name.ToLower() == args[1].ToLower())
                              .FirstOrDefault();

                if ((collumnName == Xt.Rating) is bool isRating && isRating)
                {
                    args[0] = Xt.Consistence;
                    args[2] = Xt.custom + RatingControl.ToString();
                }

                var type = isRating ? typeof(RatingControl) :
                           (objName != null ? objName.PropertyType : typeof(string));

                var newCollm = DynamicColumsModule.GetContexModul(type, args);

                /* ///DnD ToDo: GUI_Settings, forestores columns duplication */
                if (existingSiblings.Contains(args[0]))
                {
                    continue;
                }
                else
                {
                    existingSiblings.Add(args[0]);
                }

                iniStr = iniStr.Replace(ConstantStr.Dummy, newCollm.Trim() + "\n" + ConstantStr.Dummy);
            }
            if (cummulative)
            {
                this.UpdatedModule = iniStr;
            }
            return(iniStr.Replace(Dummy, ""));
        }
 private void _ratingControl_ValueChanged(RatingControl sender, object args)
 {
     Renderer.UpdateInputValueProperty(ElementId, _ratingControl.Value);
 }
Example #31
0
 private void Favorite_ValueChanged(RatingControl sender, object args)
 {
     FavoriteHelper.AddToFavorite(Favorite.Value, new FavoriteKeyModel {
         Key = subtitleKey, Title = subtitleTitle, Value = subtitleUrl, Server = Server.WorldSubtitle
     });
 }
Example #32
0
 private async void RatingControl_ValueChanged(RatingControl sender, object args)
 {
     await Context.WriteRatingValue(sender.Value);
 }
        /// <summary>
        /// Overridden to draw the rating of the cell.
        /// </summary>
        /// <param name="graphics">The <see cref="T:System.Drawing.Graphics"/> that used to draw the rating.</param>
        /// <param name="cellRect">The cell rectangle.</param>
        /// <param name="cellValue">The cell value.</param>
        /// <param name="style">The CellStyleInfo of the cell.</param>
        /// <param name="column">The DataColumnBase of the cell.</param>
        /// <param name="rowColumnIndex">The row and column index of the cell.</param>
        protected override void OnRender(Graphics graphics, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
        {
            using (SolidBrush brush = new SolidBrush(style.BackColor))
                graphics.FillRectangle(brush, cellRect);

            var RatingColumn = column.GridColumn as GridRatingColumn;

            RatingControl.Orientation = Orientationmode.Horizontal;
            RatingControl.Location    = cellRect.Location;
            var Width = RatingControl.Width;

            RatingControl.Orientation = Orientationmode.Horizontal;
            RatingControl.ItemsCount  = RatingColumn.ItemCount;
            RatingControl.Size        = cellRect.Size;
            RatingControl.Shape       = RatingColumn.Shape;
            int value = 0;

            if (int.TryParse(cellValue, out value))
            {
                RatingControl.Value = value;
            }
            RatingControl.ItemSelectionColor = RatingColumn.ItemSelectionColor;
            RatingControl.ItemBackColor      = RatingColumn.ItemBackColor;

            var smoothingMode = graphics.SmoothingMode;

            graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;

            int       starHeight, starWidth;
            Rectangle drawArea;
            var       clipBounds = graphics.VisibleClipBounds;

            graphics.SetClip(cellRect);
            Rectangle[] m_Itemrectangle = new Rectangle[RatingControl.ItemsCount];

            var padding = 10;

            cellRect.X     += padding;
            cellRect.Width -= 2 * padding;
            Width           = cellRect.Width;

            starWidth  = 16;
            starHeight = 16;

            var startingPosition = (Width - ((RatingControl.ItemsCount * starWidth) + ((RatingControl.ItemsCount - 1) * RatingControl.Spacing))) / 2;

            drawArea = new Rectangle(cellRect.X + startingPosition, cellRect.Y + ((cellRect.Height / 2) - (starHeight / 2)), starWidth, starHeight);

            RatingControl.Location = new Point(drawArea.X, drawArea.Y);

            for (int i = 0; i < RatingControl.ItemsCount; ++i)
            {
                m_Itemrectangle[i].X      = drawArea.X - RatingControl.Spacing / 2;
                m_Itemrectangle[i].Y      = drawArea.Y;
                m_Itemrectangle[i].Width  = drawArea.Width + RatingControl.Spacing / 2;
                m_Itemrectangle[i].Height = drawArea.Height;

                if (RatingControl.Shape == Shapes.Circle)
                {
                    RatingControl.DrawCircle(graphics, drawArea, i);
                }
                else if (RatingControl.Shape == Shapes.Heart)
                {
                    RatingControl.DrawHeart(graphics, drawArea, i);
                }
                else if (RatingControl.Shape == Shapes.CustomImages)
                {
                    RatingControl.DrawCustomShapes(graphics, drawArea, i);
                }
                else
                {
                    RatingControl.DrawShape(graphics, drawArea, i);
                }

                drawArea.X += drawArea.Width + RatingControl.Spacing;
            }

            graphics.SetClip(clipBounds);
            graphics.SmoothingMode = smoothingMode;
        }