Exemplo n.º 1
0
 public void OutputToXml(XmlTextWriter xmlWriter)
 {
     xmlWriter.WriteStartElement("source");
     xmlWriter.WriteAttributeString("volumetype", mVolumeType.ToString());
     OutputToXmlProtected(xmlWriter);
     xmlWriter.WriteEndElement();
 }
Exemplo n.º 2
0
        public void RemoveVolume(VolumeType type)
        {
            if (volumes.ContainsKey(type))
            {
                throw new ArgumentException(string.Format("collection does not contain a volume of type {0}!", type.ToString()));
            }

            volumes.Remove(type);
        }
Exemplo n.º 3
0
 internal static Volume CreateInstance(VolumeType type, VolumeDatabase database)
 {
     Volume volume = null;
     switch (type) {
         case VolumeType.FileSystemVolume:
             volume = new FileSystemVolume(database);
             break;
         case VolumeType.AudioCdVolume:
             volume = new AudioCdVolume(database);
             break;
         default:
             throw new NotImplementedException(string.Format("Instanciation of type {0} is not implemented", type.ToString()));
     }
     return volume;
 }
        public static void ShowConversion(int oldUnits, VolumeType from, VolumeType to)
        {
            double newUnits = ConvertUnits(oldUnits, from, to);

            Console.WriteLine("{0} {1} = {2} {3}", oldUnits, from.ToString(), newUnits, to.ToString());
        }
Exemplo n.º 5
0
        private void ChangeGraph()
        {
            int days = m_oDateRanges.Where(x => x.Item3).First().Item1;
            List <HistoricalQuoteDetails> oH = m_oSecAnalysis.GetDataForRange(DateTime.Now.AddDays(-days), DateTime.Now);

            string[] xData = days > 1 ?
                             oH.Select(h => h.Date.ToShortDateString()).ToArray()
                :
                             oH.Select(h => h.Date.ToShortTimeString()).ToArray();
            double[] yData = oH.Select(h => Convert.ToDouble(h.Close)).ToArray();

            ZedGraphControl PriceGraph = CreatePriceGraph(xData, yData);

            List <Tuple <string, double[]> > AdditionalGraphs = new List <Tuple <string, double[]> >();

            foreach (var TA in m_oIndicator.Where(t => t.Item3 == true).ToList())
            {
                switch (TA.Item1)
                {
                case TA_Indicator.Trend:
                    break;

                case TA_Indicator.MA:
                    break;

                case TA_Indicator.MA20_50_200:
                    break;

                case TA_Indicator.EMA:
                    break;

                case TA_Indicator.Bollinger:
                    GetBollinger(days).ForEach(x =>
                                               AdditionalGraphs.Add(new Tuple <string, double[]>(TA_Indicator.Bollinger.ToString(), x.ToArray()
                                                                                                 )));
                    break;

                case TA_Indicator.Crossover:
                    break;

                default:
                    break;
                }
            }
            foreach (var GS in m_oGraphSettings.Where(t => t.Item3 == true).ToList())
            {
                switch (GS.Item1)
                {
                case TA_Settings.Volume:
                    var oVolumeInfoList = m_oSecAnalysis.GetRangeOfVolumeIndicator(DateTime.Now.AddDays(-days), DateTime.Now)
                                          .Where(h => h.Item1.Date >= DateTime.Now.AddDays(-days).Date&& h.Item1.Date <= DateTime.Now.Date)
                                          .OrderBy(x => x.Item1)
                                          .ToList();

                    if (oVolumeInfoList.Count() > 0)
                    {
                        foreach (VolumeIndicatorType VolumeType in Enum.GetValues(typeof(VolumeIndicatorType)))
                        {
                            if ((VolumeType != VolumeIndicatorType.Unknown && VolumeType != VolumeIndicatorType.VolumeClimaxPlusHighVolumeChurn) && oVolumeInfoList.Where(z => z.Item2.VolumeIndicatorType.Equals(VolumeType)).Count() > 0)
                            {
                                AdditionalGraphs.Add(new Tuple <string, double[]>(VolumeType.ToString(),
                                                                                  yData.Select((s, i2) => new { i2, s })
                                                                                  .Select(t => (t.i2 < oVolumeInfoList.Count()) ? oVolumeInfoList[t.i2].Item2.VolumeIndicatorType.Equals(VolumeType) ? t.s : 0 : 0).ToArray()));
                            }
                        }
                    }
                    break;

                case TA_Settings.High_Low:
                    PriceGraph.GraphPane.GraphObjList.Add(DrawLine(yData.Max(), yData.Count(), GS.Item1.ToString()));
                    var text = new TextObj("High", 1, yData.Max() - 10, CoordType.ChartFraction, AlignH.Left, AlignV.Top);
                    text.ZOrder = ZOrder.A_InFront;
                    PriceGraph.GraphPane.GraphObjList.Add(text);
                    PriceGraph.GraphPane.GraphObjList.Add(DrawLine(yData.Min(), yData.Count(), GS.Item1.ToString()));
                    var textlow = new TextObj("Low", 1, yData.Min() + 10, CoordType.ChartFraction, AlignH.Left, AlignV.Top);
                    textlow.ZOrder = ZOrder.A_InFront;
                    PriceGraph.GraphPane.GraphObjList.Add(textlow);
                    break;

                default:
                    break;
                }
            }


            var pane = PriceGraph.GraphPane;

            AdditionalGraphs.ForEach(x =>
                                     pane.CurveList.Add(CreateLineItemFromData(x.Item2, x.Item1)
                                                        ));
            if (AdditionalGraphs.Count() > 0)
            {
                pane.YAxis.Scale.Max = AdditionalGraphs.Select(x => x.Item2.Max()).Max() * 1.0005;
                pane.YAxis.Scale.Min = AdditionalGraphs.SelectMany(d => d.Item2).Where(x => x > 0).Min() * 0.9995;
            }

            PriceGraph.Refresh();
            PriceGraph.Name = "StockChart";
            PriceGraph.Dock = DockStyle.Fill;
            if (!panel_chart.Controls.ContainsKey(PriceGraph.Name))
            {
                panel_chart.Controls.Add(PriceGraph);
                //if (AdditionalGraphs.Where(x=>x.Item1.Equals(TA_Settings.Volume.ToString())).Count() > 0)
                //if (Volume.Count() > 0 && ShowVolume)
                //    panel_vol.Controls.Add(oZGP_vol);
            }
            else
            {
                panel_chart.Controls.RemoveByKey(PriceGraph.Name);
                panel_chart.Controls.Add(PriceGraph);

                // panel_vol.Controls.RemoveByKey(oZGP_vol.Name);
                //if (Volume.Count() > 0 && ShowVolume)
                //    panel_vol.Controls.Add(oZGP_vol);
            }

            tableLayoutPanel_Graph.Visible = true;
        }
Exemplo n.º 6
0
        internal static Volume CreateInstance(VolumeType type, VolumeDatabase database)
        {
            Volume volume = null;

            switch (type)
            {
            case VolumeType.FileSystemVolume:
                volume = new FileSystemVolume(database);
                break;

            case VolumeType.AudioCdVolume:
                volume = new AudioCdVolume(database);
                break;

            default:
                throw new NotImplementedException(string.Format("Instanciation of type {0} is not implemented", type.ToString()));
            }
            return(volume);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Sets volume of given type and saves to PlayerPrefs
 /// </summary>
 /// <param name="type"></param>
 /// <param name="value"></param>
 public static void setVolume(VolumeType type, float value)
 {
     storedPrefs.volumes[(int)type] = value;
     PlayerPrefs.SetFloat(VolumeKeyPrefix + type.ToString(), value);
 }
Exemplo n.º 8
0
        public static VolumeEditor CreateInstance(VolumeType volType)
        {
            switch (volType)
            {
            case VolumeType.FileSystemVolume:
                return(new FileSystemVolumeEditor());

            case VolumeType.AudioCdVolume:
                return(new AudioCdVolumeEditor());

            default:
                throw new NotImplementedException(string.Format("VolumeEditor widget for VolumeType {0} is not implemented", volType.ToString()));
            }
        }