public void LoadData()
        {
            try
            {
                var AlphaList = Alpharepo.GetAlphasAsync().Result.ToList();
                ObservableCollection <Alpha> POData = new ObservableCollection <Alpha>();
                foreach (var item in AlphaList)
                {
                    POData.Add(item);
                }
                Alphas = POData;

                var BetaList = Betarepo.GetBetasAsync().Result.ToList();
                ObservableCollection <Beta> BetaData = new ObservableCollection <Beta>();
                foreach (var item in BetaList)
                {
                    BetaData.Add(item);
                }
                Betas = BetaData;

                var GammaList = Gammarepo.GetGammasAsync().Result.ToList();
                ObservableCollection <Gamma> GammaData = new ObservableCollection <Gamma>();
                foreach (var item in GammaList)
                {
                    GammaData.Add(item);
                }
                Gammas = GammaData;

                var DeltaList = DeltaRepo.GetDeltasAsync().Result.ToList();
                ObservableCollection <Delta> DeltaData = new ObservableCollection <Delta>();
                foreach (var item in DeltaList)
                {
                    DeltaData.Add(item);
                }
                Deltas = DeltaData;

                var ThetaList = ThetaRepo.GetThetasAsync().Result.ToList();
                ObservableCollection <Theta> ThetaData = new ObservableCollection <Theta>();
                foreach (var item in ThetaList)
                {
                    ThetaData.Add(item);
                }
                Thetas = ThetaData;

                SelectedBeta  = Betas.First(x => x.Id.Equals(1));
                SelectedGamma = Gammas.First(x => x.Id.Equals(1));
                SelectedAlpha = Alphas.First(x => x.Id.Equals(1));
                SelectedDelta = Deltas.First(x => x.Id.Equals(1));
                SelectedTheta = Thetas.First(x => x.Id.Equals(1));
                SaveText      = null;
            }
            catch (Exception e)
            {
                _logger.Error("Some error have AddRecordViewModel Load data , stacktarce =" + e.StackTrace);
                _logger.Error("AddRecordViewModel error message is " + e.Message + " inner error is " + e.InnerException.Message);
            }
        }
        private void OnAdd()
        {
            Alpha PO = new Alpha()
            {
                Name = NewAlphaName
            };

            NewAlphaName = "";
            repo.AddAlphaAsync(PO);
            Alphas.Add(PO);
        }
Example #3
0
        /// <summary>
        /// creates color blend out of color point data
        /// </summary>
        /// <returns></returns>
        private ColorBlend CreateColorBlend()
        {
            //sort all points
            ColorPoint[] colpoints   = Colors.SortedArray();
            AlphaPoint[] alphapoints = Alphas.SortedArray();
            //init out vars
            SortedList <float, Color> positions = new SortedList <float, Color>();

            //add color points
            for (int c = 0; c < colpoints.Length; c++)
            {
                if (c > 0 && colpoints[c].Focus != .5)                //focus
                {
                    AddPosition(colpoints, alphapoints, positions,
                                colpoints[c - 1].Position + (colpoints[c].Position - colpoints[c - 1].Position) * colpoints[c].Focus);
                }
                //color
                AddPosition(colpoints, alphapoints, positions, colpoints[c].Position);
            }
            //add alpha points
            for (int a = 0; a < alphapoints.Length; a++)
            {
                if (a > 0 && alphapoints[a].Focus != .5)                //focus
                {
                    AddPosition(colpoints, alphapoints, positions,
                                alphapoints[a - 1].Position + (alphapoints[a].Position - alphapoints[a - 1].Position) * alphapoints[a].Focus);
                }
                //alpha
                AddPosition(colpoints, alphapoints, positions, alphapoints[a].Position);
            }

            //add first/last point
            if (positions.Count < 1 || !positions.ContainsKey(0f))
            {
                positions.Add(0f, positions.Count < 1 ?
                              Color.Transparent : positions.Values[0]);
            }
            if (positions.Count < 2 || !positions.ContainsKey(1f))
            {
                positions.Add(1f, positions.Count < 2 ?
                              Color.Transparent : positions.Values[positions.Count - 1]);
            }
            //
            ColorBlend ret = new ColorBlend();

            Color[] col = new Color[positions.Count];
            positions.Values.CopyTo(col, 0);
            ret.Colors = col;
            float[] pos = new float[positions.Count];
            positions.Keys.CopyTo(pos, 0);
            ret.Positions = pos;
            return(ret);
        }
        private void ResetUI()
        {
            SelectedBeta  = Betas.First(x => x.Id.Equals(1));
            SelectedGamma = Gammas.First(x => x.Id.Equals(1));
            SelectedAlpha = Alphas.First(x => x.Id.Equals(1));
            SelectedDelta = Deltas.First(x => x.Id.Equals(1));
            SelectedTheta = Thetas.First(x => x.Id.Equals(1));
            Zeus          = null;
            Hera          = null;
            BeginDate     = null;
            EndDate       = null;

            TargetDate = null;
            Artemis    = null;
            Ares       = null;
            Athena     = null;
            Apollo     = null;
            Poseidon   = null;
            Remarks    = null;
        }
Example #5
0
 /// <summary>
 /// adds all colors of the given blend
 /// </summary>
 private void AddColors(ColorBlend blend)
 {
     if (blend == null ||
         blend.Colors == null || blend.Positions == null ||
         blend.Colors.Length != blend.Positions.Length)
     {
         throw new ArgumentException("blend is invalid");
     }
     //
     for (int i = 0; i < blend.Colors.Length; i++)
     {
         if (blend.Colors[i].A != 255)
         {
             Alphas.Add(new AlphaPoint((byte)blend.Colors[i].A,
                                       (double)blend.Positions[i]));
         }
         Colors.Add(new ColorPoint(blend.Colors[i],
                                   (double)blend.Positions[i]));
     }
 }
Example #6
0
        public override bool Equals(object obj)
        {
            if (obj is ColorGradient)
            {
                ColorGradient color = (ColorGradient)obj;
                if (IsLibraryReference && color.IsLibraryReference && LibraryReferenceName.Equals(color.LibraryReferenceName))
                {
                    return(true);
                }

                if (IsLibraryReference || color.IsLibraryReference)
                {
                    return(false);
                }

                if (Colors.Equals(color.Colors) && Alphas.Equals(color.Alphas))
                {
                    return(true);
                }
            }
            return(base.Equals(obj));
        }
Example #7
0
        public List <List <string> > GetPDFDAta()
        {
            List <List <string> > ListOfRecord = new List <List <string> >();


            foreach (var item in ReportRecords)
            {
                List <string> SingleRecord = new List <string>();
                if (PdfFilterZeus)
                {
                    SingleRecord.Add(item.Zeus);
                }

                if (PdfFilterStatus)
                {
                    SingleRecord.Add(Statuses.First(x => x.Id.Equals(item.StatusID)).Name.ToString());
                }

                if (PdfFilterEndDate)
                {
                    SingleRecord.Add(item.EndDate);
                }

                if (PdfFilterGamma)
                {
                    SingleRecord.Add(Gammas.First(x => x.Id.Equals(item.GammaID)).Name.ToString());
                }

                if (PdfFilterBeta)
                {
                    SingleRecord.Add(Betas.First(x => x.Id.Equals(item.BetaID)).Name.ToString());
                }

                if (PdfFilterAlpha)
                {
                    SingleRecord.Add(Alphas.First(x => x.Id.Equals(item.AlphaID)).Name.ToString());
                }

                if (PdfFilterHera)
                {
                    SingleRecord.Add(item.Hera);
                }

                if (PdfFilterDelta)
                {
                    SingleRecord.Add(Deltas.First(x => x.Id.Equals(item.DeltaID)).Name.ToString());
                }

                if (PdfFilterBeginDate)
                {
                    SingleRecord.Add(item.BeginDate);
                }

                if (PdfFilterPoseidon)
                {
                    SingleRecord.Add(item.Poseidon);
                }

                if (PdfFilterAres)
                {
                    SingleRecord.Add(item.Ares);
                }

                if (PdfFilterAthena)
                {
                    SingleRecord.Add(item.Athena);
                }

                if (PdfFilterTheta)
                {
                    SingleRecord.Add(Thetas.First(x => x.Id.Equals(item.ThetaID)).Name.ToString());
                }

                if (PdfFilterArtemis)
                {
                    SingleRecord.Add(item.Artemis);
                }

                if (PdfFilterTargetDate)
                {
                    SingleRecord.Add(item.TargetDate);
                }

                if (PdfFilterApollo)
                {
                    SingleRecord.Add(item.Apollo);
                }
                ListOfRecord.Add(SingleRecord);
            }

            return(ListOfRecord);
        }
Example #8
0
        /// <summary>
        /// creates color blend out of color point data
        /// </summary>
        /// <returns></returns>
        private ColorBlend CreateColorBlend(Color?filterColor = null)
        {
            //sort all points
            ColorPoint[] colpoints   = Colors.SortedArray();
            AlphaPoint[] alphapoints = Alphas.SortedArray();
            //init out vars
            SortedList <float, Color> positions = new SortedList <float, Color>();

            // if we're filtering the colors, the iterate through the color list, setting all non-matching colors to black
            if (filterColor != null)
            {
                List <ColorPoint> newColorPoints = new List <ColorPoint>();
                foreach (ColorPoint colorPoint in colpoints)
                {
                    ColorPoint newPoint = (ColorPoint)colorPoint.Clone();
                    if (newPoint.Color.ToRGB().ToArgb() != filterColor)
                    {
                        // it's not the desired color. Make it black and add it, but only if there's
                        // not an entry in the list with this position already
                        if (newColorPoints.Where(x => x.Position == newPoint.Position).Count() == 0)
                        {
                            newPoint.Color = XYZ.FromRGB(Color.Black);
                            newColorPoints.Add(newPoint);
                        }
                    }
                    else
                    {
                        // it's the desired color. Find any others in the list that are in this position
                        // and black, remove them, and then replace it with this one
                        newColorPoints.RemoveAll(
                            x => x.Position == newPoint.Position && x.Color.ToRGB().ToArgb().ToArgb() == Color.Black.ToArgb());
                        newColorPoints.Add(newPoint);
                    }
                }
                colpoints = newColorPoints.ToArray();
            }
            //add color points
            for (int c = 0; c < colpoints.Length; c++)
            {
                // focus point; if filtered, non-standard focus points aren't supported.
                if (c > 0 && colpoints[c].Focus != .5 && filterColor == null)
                {
                    AddPosition(colpoints, alphapoints, positions,
                                colpoints[c - 1].Position + (colpoints[c].Position - colpoints[c - 1].Position) * colpoints[c].Focus);
                }
                //color
                AddPosition(colpoints, alphapoints, positions, colpoints[c].Position);
            }

            // We aren't using alpha points, and first/last points get added below

            ////add alpha points
            //for (int a = 0; a < alphapoints.Length; a++)
            //{
            //    if (a > 0 && alphapoints[a].Focus != .5)//focus
            //        AddPosition(colpoints, alphapoints, positions,
            //            alphapoints[a - 1].Position + (alphapoints[a].Position - alphapoints[a - 1].Position) * alphapoints[a].Focus);
            //    //alpha
            //    AddPosition(colpoints, alphapoints, positions, alphapoints[a].Position);
            //}

            //add first/last point
            if (positions.Count < 1)
            {
                positions.Add(0f, Color.Transparent);
            }
            if (!positions.ContainsKey(0f))
            {
                if (filterColor != null)
                {
                    float earliest = positions.Keys[0];
                    Color c        = Color.Black;
                    for (int i = 0; i < positions.Count && positions.Keys[i] == earliest; i++)
                    {
                        if (positions.Values[i].ToArgb() != Color.Black.ToArgb())
                        {
                            c = positions.Values[i];
                            break;
                        }
                    }
                    positions.Add(0f, c);
                }
                else
                {
                    positions.Add(0f, positions.Values[0]);
                }
            }

            if (positions.Count < 2)
            {
                Color c = positions.Values[0];
                if (filterColor != null && c.ToArgb() != ((Color)filterColor).ToArgb())
                {
                    c = Color.Black;
                }
                positions.Add(1f, c);
            }

            if (!positions.ContainsKey(1f))
            {
                if (filterColor != null)
                {
                    float latest = positions.Keys[positions.Count - 1];
                    Color c      = Color.Black;
                    for (int i = positions.Count - 1; i >= 0 && positions.Keys[i] == latest; i--)
                    {
                        if (positions.Values[i].ToArgb() != Color.Black.ToArgb())
                        {
                            c = positions.Values[i];
                            break;
                        }
                    }
                    positions.Add(1f, c);
                }
                else
                {
                    positions.Add(1f, positions.Values[positions.Count - 1]);
                }
            }

            ColorBlend ret = new ColorBlend();

            Color[] col = new Color[positions.Count];
            positions.Values.CopyTo(col, 0);
            ret.Colors = col;
            float[] pos = new float[positions.Count];
            positions.Keys.CopyTo(pos, 0);
            ret.Positions = pos;
            return(ret);
        }
Example #9
0
 public override int GetHashCode()
 {
     return(Colors.GetHashCode() ^ Alphas.GetHashCode());
 }
 private void OnDelete()
 {
     repo.DeleteAlphaAsync(SelectedAlpha.Id);
     Alphas.Remove(SelectedAlpha);
 }