Ejemplo n.º 1
0
        /// <summary>
        /// 打开需要的工作空间文件及地图
        /// </summary>
        private void Initialize()
        {
            try
            {
                //初始化点线面
                m_point = new GeoPoint(25, 25);

                Point2Ds point2DsLine = new Point2Ds();
                point2DsLine.Add(new Point2D(5, 35));
                point2DsLine.Add(new Point2D(65, 35));
                m_line = new GeoLine(point2DsLine);

                Point2Ds point2DsRegion = new Point2Ds();
                point2DsRegion.Add(new Point2D(5, 5));
                point2DsRegion.Add(new Point2D(5, 69));
                point2DsRegion.Add(new Point2D(69, 69));
                point2DsRegion.Add(new Point2D(69, 5));
                m_region = new GeoRegion(point2DsRegion);
                //初始化点线面符号的风格
                m_markerGeoStyle            = new GeoStyle();
                m_markerGeoStyle.LineColor  = Color.Blue;
                m_markerGeoStyle.MarkerSize = new Size2D(12, 12);
                m_point.Style = m_markerGeoStyle;

                m_lineGeoStyle           = new GeoStyle();
                m_lineGeoStyle.LineColor = Color.Blue;
                m_lineGeoStyle.LineWidth = 0.5;
                m_line.Style             = m_lineGeoStyle;

                m_fillGeoStyle = new GeoStyle();
                m_fillGeoStyle.FillForeColor  = Color.Blue;
                m_fillGeoStyle.FillBackOpaque = false;
                m_region.Style = m_fillGeoStyle;

                // 得到点线面的RootGroup
                Resources     resources           = m_workspace.Resources;
                SymbolLibrary symbolMarkerLibrary = resources.MarkerLibrary;
                m_symbolMarkerRootGroup = symbolMarkerLibrary.RootGroup;

                SetTreeGroup(m_symbolMarkerRootGroup);

                SymbolLibrary symbolLineLibrary = resources.LineLibrary;
                m_symbolLineRootGroup = symbolLineLibrary.RootGroup;

                SymbolLibrary symbolFillLibrary = resources.FillLibrary;
                m_symbolFillRootGroup = symbolFillLibrary.RootGroup;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
 private static DataTarget LoadDump(string path)
 {
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         DataTarget dataTarget = DataTarget.LoadDump(path);
         dataTarget.FileLocator = SymbolGroup.CreateFromSymbolPath(string.Empty);
         return(dataTarget);
     }
     else
     {
         return(DataTarget.LoadDump(path));
     }
 }
Ejemplo n.º 3
0
 public SymbolGroup(SymbolGroup Parent, SymRelation Relation)
 {
     Symbols        = new List <iSymbol>();
     this.Parent    = Parent;
     SymbolRelation = Relation;
     if (SymbolRelation == SymRelation.AND)
     {
         Name = "AND Group";
     }
     else
     {
         Name = "OR Group";
     }
 }
Ejemplo n.º 4
0
        public void SaveChanges()
        {
            if (String.IsNullOrEmpty(txtPortfolio.Text))
            {
                Telerik.WinControls.RadMessageBox.Show(Program.LanguageDefault.DictionaryPortfolio["fieldEmptyPortfolio"]);
                return;
            }

            SymbolGroup portChanged = new SymbolGroup()
            {
                Name    = txtPortfolio.Text,
                Type    = (int)GroupType.Portfolio,
                Index   = ParentControl.GetPortfolioNewIndex(),
                Symbols = ""
            };

            UpdatePortfolios = new List <string> {
                txtPortfolio.Text
            };

            SqlConnection _connection = DBlocalSQL.Connect();

            List <SymbolGroup> listpoPortfolios = DBlocalSQL.LoadGroups(GroupType.Index, _connection);

            listpoPortfolios.AddRange(DBlocalSQL.LoadGroups(GroupType.Portfolio, _connection));
            DBlocalSQL.Disconnect(_connection);

            foreach (var listpoPortfolio in listpoPortfolios)
            {
                if (listpoPortfolio.Name.ToUpper() == portChanged.Name.ToUpper() || Program.LanguageDefault.DictionaryTabAssets["tabAll"] == portChanged.Name.ToUpper())
                {
                    Telerik.WinControls.RadMessageBox.Show(String.Format(Program.LanguageDefault.DictionaryPortfolio["portfolioExisted"], txtPortfolio.Text));
                    return;
                }

                UpdatePortfolios.Add(listpoPortfolio.Name);
            }

            listpoPortfolios.Add(portChanged);

            SqlConnection _connection2 = DBlocalSQL.Connect();

            DBlocalSQL.SaveGroups(listpoPortfolios, _connection2);
            DBlocalSQL.Disconnect(_connection2);

            PortFolio = txtPortfolio.Text;

            DialogResult = DialogResult.OK;
            Close();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 设置TreeView的数据
 /// </summary>
 /// <param name="treeView"></param>
 /// <param name="rootGroup"></param>
 public void SetTreeView(TreeView treeView, SymbolGroup rootGroup)
 {
     try
     {
         TreeNode topNode = treeView.TopNode;
         topNode.Text = "根组";
         topNode.Tag  = rootGroup;
         SetTreeNode(topNode, rootGroup);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Use to create forex pairs symbols.
        /// </summary>
        public Symbol(SymbolGroup group, string currency1, string currency2)
        {
            SystemMonitor.CheckThrow(group == SymbolGroup.Forex);

            _name   = currency1 + "/" + currency2;
            _group  = group.ToString();
            _source = string.Empty;

            _isForexPair    = true;
            _forexCurrency1 = currency1;
            _forexCurrency2 = currency2;

            Construct();
        }
        public TokenScoreBuilder()
        {
            _lastTimeSignature = new TimeSignature {
                Beat = Durations.Quarter, Ticks = 4
            };

            _currentGroup       = new SymbolGroup();
            _currentGroup.Meter = _lastTimeSignature;

            _score = new Score {
                SymbolGroups = { _currentGroup }
            };
            _relativeOctave = Octaves.Three;
            _previous       = new Common.Models.Note(Names.C, _relativeOctave);
        }
        private void CreateNewSymbolGroup()
        {
            // only when current group is not empty
            if (_currentGroup.Symbols.Count <= 0)
            {
                return;
            }

            _currentGroup = new SymbolGroup
            {
                Meter = _lastTimeSignature,
                Tempo = _lastTempo
            };
            _score.SymbolGroups.Add(_currentGroup);
        }
Ejemplo n.º 9
0
        public static string GetPluralText(this SymbolGroup symbolGroup)
        {
            switch (symbolGroup)
            {
            case SymbolGroup.Namespace:
                return("namespaces");

            case SymbolGroup.Module:
                return("modules");

            case SymbolGroup.Class:
                return("classes");

            case SymbolGroup.Delegate:
                return("delegates");

            case SymbolGroup.Enum:
                return("enums");

            case SymbolGroup.Interface:
                return("interfaces");

            case SymbolGroup.Struct:
                return("structs");

            case SymbolGroup.Event:
                return("events");

            case SymbolGroup.Field:
                return("fields");

            case SymbolGroup.Const:
                return("consts");

            case SymbolGroup.Method:
                return("methods");

            case SymbolGroup.Property:
                return("properties");

            case SymbolGroup.Indexer:
                return("indexers");
            }

            Debug.Fail(symbolGroup.ToString());

            return("");
        }
        public void CloseScope()
        {
            var count = _score.SymbolGroups.Count;

            if (count < 2)
            {
                return;
            }

            _currentGroup = new SymbolGroup
            {
                Meter = _score.SymbolGroups[count - 2].Meter,
                Tempo = _score.SymbolGroups[count - 2].Tempo
            };
            _score.SymbolGroups.Add(_currentGroup);
        }
Ejemplo n.º 11
0
        public static string GetText(this SymbolGroup symbolGroup)
        {
            switch (symbolGroup)
            {
            case SymbolGroup.Namespace:
                return("namespace");

            case SymbolGroup.Class:
                return("class");

            case SymbolGroup.Delegate:
                return("delegate");

            case SymbolGroup.Enum:
                return("enum");

            case SymbolGroup.Interface:
                return("interface");

            case SymbolGroup.Struct:
                return("struct");

            case SymbolGroup.Event:
                return("event");

            case SymbolGroup.Field:
                return("field");

            case SymbolGroup.Const:
                return("const");

            case SymbolGroup.Method:
                return("method");

            case SymbolGroup.Property:
                return("property");

            case SymbolGroup.Indexer:
                return("indexer");
            }

            Debug.Fail(symbolGroup.ToString());

            return("");
        }
Ejemplo n.º 12
0
        public override void ReadBytes(byte[] buffer, int offset)
        {
            StartR(buffer, offset);

            StockId   = _br.ReadInt32();
            RequestId = _br.ReadString();
            ClientId  = _br.ReadString();
            MuxId     = _br.ReadString();
            GroupInfo = new SymbolGroup
            {
                Name    = _br.ReadString(),
                Index   = _br.ReadInt32(),
                Type    = _br.ReadInt32(),
                Symbols = _br.ReadString()
            };

            StopR();
        }
        public void AddRepeat(Repeat repeat)
        {
            _currentGroup = new SymbolGroup
            {
                Meter  = _score.SymbolGroups.Last().Meter,
                Tempo  = _score.SymbolGroups.Last().Tempo,
                Repeat = new Common.Models.Repeat
                {
                    Times = repeat.Times
                }
            };

            var visitor = new TokenVisitor(this);

            foreach (var token in repeat.Inner)
            {
                token.Accept(visitor);
            }

            foreach (var alt in repeat.Alternatives)
            {
                _currentGroup.Repeat.Alternatives.Add(new SymbolGroup
                {
                    Meter = _score.SymbolGroups.Last().Meter,
                    Tempo = _score.SymbolGroups.Last().Tempo,
                });

                foreach (var token in alt)
                {
                    if (token is Note note)
                    {
                        _currentGroup.Repeat.Alternatives.Last().Symbols.Add(GetNote(note));
                    }

                    if (token is Rest rest)
                    {
                        _currentGroup.Repeat.Alternatives.Last().Symbols.Add(GetRest(rest));
                    }
                }
            }

            _score.SymbolGroups.Add(_currentGroup);
        }
Ejemplo n.º 14
0
 /// <summary>
 /// 设置TreeNode的数据
 /// </summary>
 /// <param name="node"></param>
 /// <param name="symbolGroup"></param>
 private void SetTreeNode(TreeNode node, SymbolGroup symbolGroup)
 {
     try
     {
         SymbolGroups groups = symbolGroup.ChildGroups;
         for (int i = 0; i < groups.Count; i++)
         {
             SymbolGroup group = groups[i];
             node.Nodes.Add(group.Name);
             node.Nodes[i].Tag = group;
             if (group != null)
             {
                 SetTreeNode(node.Nodes[i], group);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 15
0
        public void AddSymbolGroup(SymbolGroup group)
        {
            AddTimeSignature(group.Meter);

            if (group.Repeat != null)
            {
                _symbols.Add(new Barline()
                {
                    RepeatSign = RepeatSignType.Forward
                });
            }

            foreach (var symbol in group.Symbols)
            {
                if (symbol is Note note)
                {
                    AddNote(note);
                }

                if (symbol is Rest rest)
                {
                    AddRest(rest);
                }
            }

            if (_buffer.Count > 0)
            {
                FlushBuffer();
            }
            if (_notes.Count > 0)
            {
                Build();
            }

            if (group.Repeat != null)
            {
                AddRepeat(group.Repeat);
            }
        }
        public void AddSymbolGroup(SymbolGroup group)
        {
            AddTimeSignature(group.Meter);
            AddTempo(group.Tempo);

            if (group.Repeat != null)
            {
                _scopes++;
                _output  = _output.TrimEnd(' ', '\n', '|');
                _output += $"\n{new string(' ', _scopes * SPACES_IN_TAB)}\\repeat volta {group.Repeat.Times} {{\n{new string(' ', _scopes * SPACES_IN_TAB)}";
            }

            foreach (var symbol in group.Symbols)
            {
                if (symbol is Note note)
                {
                    AddNote(note);
                }

                if (symbol is Rest rest)
                {
                    AddRest(rest);
                }
            }

            if (group.Repeat != null)
            {
                _output  = _output.TrimEnd(' ', '\n', '|');
                _output += $"\r{new string(' ', --_scopes * SPACES_IN_TAB)}}}\n{new string(' ', _scopes * SPACES_IN_TAB)}";
            }

            if (group.Repeat != null)
            {
                AddRepeat(group.Repeat);
            }
        }
Ejemplo n.º 17
0
 private void SetTreeGroup(SymbolGroup symbolGroup)
 {
     try
     {
         SymbolGroups groups = symbolGroup.ChildGroups;
         for (int i = 0; i < groups.Count; i++)
         {
             SymbolGroup group = groups[i];
             if (group.Name == "树木")
             {
                 m_symbolTreeMarkerGroup = group;
             }
             //string str = group.Name;
             if (group != null)
             {
                 SetTreeGroup(group);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 18
0
        public void SaveChanges()
        {
            List <string> updatePortfolios = new List <string>();

            SymbolGroup portChanged;

            if (ddlPortfolios.SelectedItem != null)
            {
                //Create a new portfolio
                portChanged = new SymbolGroup()
                {
                    Name  = ddlPortfolios.SelectedItem.Text == Program.LanguageDefault.DictionaryTabAssets["tabAll"] ? "All" : ddlPortfolios.SelectedItem.Text,
                    Type  = (int)DataServer.Interface.GroupType.Portfolio,
                    Index = ParentControl.GetPortfolioNewIndex()
                };
                List <string> Symbols = new List <string>();
                foreach (var r in radListControl2.Items)
                {
                    string[] codeParse = r.Text.Split(new[] { ' ' });
                    string   newAsset  = codeParse[0];
                    Symbols.Add(newAsset);
                }
                portChanged.Symbols = string.Join(",", Symbols.ToArray());
                //Replace it on User's Portfolios
                List <string> SymbolsNew = new List <string>();

                foreach (var p in ParentControl.UserPortfolios)
                {
                    if (p.Name != portChanged.Name)
                    {
                        continue;
                    }

                    // if (UnorderedEqual(p.Symbols, portChanged.Symbols))
                    //  continue;
                    SymbolsNew = p.Symbols.Split(new char[] { ',' }).ToList();
                    //Remove os simbolos removidos
                    if (!UnorderedEqual(SymbolsNew, Symbols.ToArray()))
                    {
                        for (int i = 0; i < SymbolsNew.Count; i++)
                        {
                            if (!Symbols.Any(s => s == SymbolsNew[i]))
                            {
                                //Update portfolio "All":
                                bool remove = true;
                                // This symbol exists in another portfolio?
                                foreach (SymbolGroup port in ParentControl.UserPortfolios.GetRange(1, ParentControl.UserPortfolios.Count() - 1))
                                {
                                    if (port.Name == portChanged.Name)
                                    {
                                        continue;
                                    }
                                    if (port.Symbols.Split(new char[] { ',' }).ToList().Exists(s => s == SymbolsNew[i]))
                                    {
                                        remove = false;
                                    }
                                }
                                if (remove)
                                {
                                    List <string> userSymbols = ParentControl.UserPortfolios[0].Symbols.Split(new char[] { ',' }).ToList();
                                    if (userSymbols.Remove(SymbolsNew[i]))
                                    {
                                        ParentControl.UserPortfolios[0].Symbols = string.Join(",", userSymbols.ToArray());
                                    }
                                    ParentControl.UserPortfolios[0].Symbols = string.Join(",", userSymbols.ToArray());
                                    List <Symbol> updateSync = new List <Symbol>();
                                    foreach (string s in userSymbols)
                                    {
                                        updateSync.Add(new Symbol()
                                        {
                                            Code = s
                                        });
                                    }
                                    SqlConnection _con = DBlocalSQL.Connect();
                                    DBlocalSQL.SaveSymbols(updateSync, _con, true);
                                    DBlocalSQL.Disconnect(_con);
                                    if (!updatePortfolios.Exists(s => s == "All"))
                                    {
                                        updatePortfolios.Insert(0, "All");
                                    }
                                }

                                SymbolsNew.Remove(SymbolsNew[i]);
                                i--;
                            }
                        }
                    }
                    List <string> symbolsRequest = new List <string>();
                    //insere os simbolos inseridos
                    foreach (string symbol in Symbols)
                    {
                        if (!SymbolsNew.Any(s => s == symbol))
                        {
                            SymbolsNew.Add(symbol);
                            //Update portfolio "All":
                            if (!ParentControl.UserPortfolios[0].Symbols.Split(new char[] { ',' }).ToList().Exists(s => s == symbol))
                            {
                                ParentControl.UserPortfolios[0].Symbols += "," + symbol;

                                //Add request to list:
                                symbolsRequest.Add(symbol);

                                List <Symbol> updateSync = new List <Symbol>();
                                foreach (string s in SymbolsNew)
                                {
                                    updateSync.Add(new Symbol()
                                    {
                                        Code = s
                                    });
                                }
                                SqlConnection _con = DBlocalSQL.Connect();
                                DBlocalSQL.SaveSymbols(updateSync, _con, true);
                                DBlocalSQL.Disconnect(_con);
                                if (!updatePortfolios.Exists(s => s == "All"))
                                {
                                    updatePortfolios.Insert(0, "All");
                                }
                            }
                        }
                    }
                    if (symbolsRequest.Count() > 0)
                    {
                        //Sync new symbol with HUB:
                        MessageService.SubmitRequest(new MSRequest("INSERT SYMBOL m" + ParentControl.MFrmMain2._messageRequestID, MSRequestStatus.Pending,
                                                                   MSRequestType.GetHistoricalData,
                                                                   MSRequestOwner.M4,
                                                                   new object[] { symbolsRequest, (int)BaseType.Days }));
                        ParentControl.MFrmMain2.AddRequestedOperation(new Operations("m" + ParentControl.MFrmMain2._messageRequestID, M4Core.Enums.TypeOperations.LoadSelectView,
                                                                                     new object[] { }));
                    }

                    updatePortfolios.Add(p.Name);

                    p.Symbols = string.Join(",", SymbolsNew.ToArray());
                    break;
                }

                if (updatePortfolios.Count > 0)
                {
                    frmMain2.SaveUserPortfolios(ParentControl.UserPortfolios.GetRange(1, ParentControl.UserPortfolios.Count() - 1));
                    frmMain2.ReloadStockListPortfolios();
                    //Update PortfolioView1
                    ParentControl.LoadPortfolios(updatePortfolios);
                }
            }
            Changes = false;
        }
Ejemplo n.º 19
0
 private ValueTask HandleLocationAsync(SymbolGroup group, ISymbol symbol, ReferenceLocation location)
 => _progress.OnReferenceFoundAsync(group, symbol, location);
Ejemplo n.º 20
0
        /// <summary>
        /// 将SymbolGroup中的符号,通过大小和几何对象绘制到FlowLayoutPanel中
        /// </summary>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <param name="geometry"></param>
        /// <param name="panel"></param>
        /// <param name="symbolGroup"></param>
        private void PaintSymbols(Int32 width, Int32 height, Geometry geometry, FlowLayoutPanel flowLayoutPanel, SymbolGroup symbolGroup)
        {
            try
            {
                flowLayoutPanel.Controls.Clear();
                Int32 count = symbolGroup.Count;
                Int32 row   = 1;
                // 循环得到符号并将符号添加到PictureBox,后将PictureBox添加到FlowLayoutPanel
                for (int i = 0; i < count; i++)
                {
                    Symbol symbol = symbolGroup[i];
                    // 初始化PictureBox对象
                    PictureBox pictureBox = new PictureBox();
                    pictureBox.Size        = new Size(width, height);
                    pictureBox.Name        = symbol.Name;
                    pictureBox.BorderStyle = BorderStyle.FixedSingle;
                    pictureBox.Tag         = symbol;
                    //绘制符号
                    DrawSymbol(symbol, geometry, width, height, pictureBox);
                    //注册PictureBox的点击事件
                    pictureBox.Click      += new EventHandler(pictureBox_Click);
                    pictureBox.MouseLeave += new EventHandler(pictureBox_MouseLeave);
                    if (i % (flowLayoutPanel.Width / width) == 0)
                    {
                        row++;
                    }
                    flowLayoutPanel.Controls.Add(pictureBox);
                }

                flowLayoutPanel.Refresh();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 21
0
 internal static IFileLocator GetLocator()
 {
     return(SymbolGroup.CreateFromSymbolPath($"srv*{Helpers.TestWorkingDirectory}*http://msdl.microsoft.com/download/symbols"));
 }
Ejemplo n.º 22
0
        //................符号面板控件的事件响应.....................//

        /// <summary>
        /// 符号树的节点点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeViewMarkerBrowse_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            SymbolGroup group = e.Node.Tag as SymbolGroup;

            PaintSymbols(50, 50, m_sampleRun.Point, flowLayoutPanelMarker, group);
        }
Ejemplo n.º 23
0
        //...................线型面板控件的事件响应........................//

        /// <summary>
        /// 线型树的节点点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void treeViewLine_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            SymbolGroup group = e.Node.Tag as SymbolGroup;

            PaintSymbols(75, 75, m_sampleRun.Line, flowLayoutPanelLine, group);
        }