Esempio n. 1
0
        public static StackPanel Prediction(Result item, int mode)
        {
            /// a container for the parameters that stacks them horizontaly
            StackPanel parametres = UIFactory.ParametersPanel();

            foreach (var param in item.Predictions)
            {
                ///TODO :  change this to use resources
                parametres.Children.Add(UIFactory.GeneratePredictionWrapPanel(mode, ImagePaths.GetImagePathForParameter(param), param.ParamKey, StringFormater.GetParameterValue(param), (Math.Round(param.StandardDeviation, 2)).ToString("00"), (Math.Abs(Math.Round(param.StandardDeviation, 2))).ToString()));
            }
            /// a container for the image of the outlook
            StackPanel outlookPanel = new StackPanel()
            {
                Orientation = Orientation.Horizontal,
            };
            /// TODO : change this to use resources
            Image outlook = UIFactory.PredictionOutlookImage(item);

            ///------------------
            outlookPanel.Children.Add(outlook);

            /// This is the probability text
            TextBlock probability = UIFactory.Probabilityblock(item, mode);

            /// a container for the whole prediction element
            StackPanel prediction = new StackPanel()
            {
                Orientation = Orientation.Horizontal,
                Width       = double.NaN
                ,
                Margin = new System.Windows.Thickness(0, 2, 0, 2)
            };

            /// creating the prediction
            prediction.Children.Add(outlookPanel);
            prediction.Children.Add(parametres);
            prediction.Children.Add(probability);
            return(prediction);
        }
Esempio n. 2
0
        /// <summary>
        /// Generates the most probable prédiction first parameters
        /// </summary>
        private void GenerateFirstPredictionParameters()
        {
            /// Determining the number of parameters to draw
            int nbParam = (int)Math.Round(predictionSystem.GetNbParameters() * 0.5) + 1;

            int i = 0;

            foreach (var item in predictionSystem.Result.Results[0].Predictions)
            {
                /// TODO : Change this to use resources
                Image img = UIFactory.CreatePredictionIcon(ImagePaths.GetImagePathForParameter(item));
                ///
                TextBlock text  = UIFactory.CreatePredictionText(StringFormater.GetParameterValue(item));
                WrapPanel panel = UIFactory.CreatePredictionWrapPanel(img, text, Orientation.Vertical);
                firstPrediction.Children.Add(panel);
                panel.BeginAnimation(OpacityProperty, animation);
                i++;
                if (i >= nbParam)
                {
                    break;
                }
            }
        }