Пример #1
0
        protected void context_ParameterChanged(object sender, EventArgs e)
        {
            if (context != null)
            {
                List <StoreWorldDetail> list = context.TakeWorldDetail.GetDetailList();
                if (list != null)
                {
                    repWorld.Items.Clear();
                    m_forReposit.Clear();
                    foreach (StoreWorldDetail var in list)
                    {
                        int          imageindex = 2;
                        Domain.World item       = context.TakeStoreWorld.GetWorld(var.StoreWorldId);
                        switch (item.WorldTypeID)
                        {
                        case WorldType.Administration: imageindex = 0; break;

                        case WorldType.CashDesk: imageindex = 1; break;

                        default: imageindex = 2; break;
                        }
                        repWorld.Items.Add(new DevExpress.XtraEditors.Controls.
                                           ImageComboBoxItem(item.Name, item, imageindex));
                        m_forReposit.Add(var.StoreWorldId, item);
                    }
                    BaseRow row = vGrid.FocusedRow;
                    vGrid.DataSource = list;
                    vGrid.FocusedRow = row;
                }
            }
        }
Пример #2
0
        private void ProcessRow(BaseRow row)
        {
            if (row == null)
            {
                return;
            }

            var sb = new StringBuilder();

            sb.AppendFormat("Data received ({0}) ", row.RowType);

            switch (row.RowType)
            {
            case RowType.Offer:
            {
                var r = row as OfferRow;
                sb.AppendFormat("Instrument={0}, Ask={1}, Bid={2}, Volume={3}, High={4}, Low={5}", r.Instrument, r.Ask, r.Bid, r.Volume, r.High, r.Low);
            }
            break;

            case RowType.ClosedTrade:
            {
                var r = row as ClosedTradeRow;
                sb.AppendFormat("TradeID={0}, Buy/Sell={1}, OpenRate={2}, CloseRate={3}, Profit/Loss={4}", r.TradeID, r.BuySell, r.OpenRate, r.CloseRate, r.GrossPL);
            }
            break;
            }

            this.LogInternal(sb.ToString());
        }
Пример #3
0
        private void ProcessRow(BaseRow row)
        {
            if (row == null)
            {
                return;
            }

            switch (row.RowType)
            {
            case RowType.MarketData:
            {
                var sb = new StringBuilder();
                var r  = row as MarketDataRow;

                if (r.IsBar)
                {
                    sb.AppendFormat("MarketData Instrument={0}, Time={1}, AskOpen=<b>{2}</b>, AskHigh={3}, AskLow={4}, AskClose=<b>{5}</b>, Volume={6}",
                                    r.Instrument, r.Time.ToString("HH:mm"), r.AskOpen, r.AskHigh, r.AskLow, r.AskClose, r.Volume);
                }
                else
                {
                    sb.AppendFormat("MarketData Instrument={0}, Time={1}, Ask={2}, Bid={3}",
                                    r.Instrument, r.Time.ToString("HH:mm:ss"), r.Ask, r.Bid);
                }

                this.LogInternal(sb.ToString());
            }
            break;
            }
        }
Пример #4
0
        private IEnumerable <BaseRow> GetGenericResponse(O2GTablesUpdatesReader reader)
        {
            var rows = new List <BaseRow>();

            for (var i = 0; i < reader.Count; i++)
            {
                var type = reader.getUpdateTable(i);

                BaseRow row = null;

                switch (type)
                {
                case O2GTableType.Accounts:
                {
                    // AccountRowEx - so we can get hold of O2GAccountRow internally when needed.
                    row = this.GetRow <AccountRowEx, O2GAccountRow>(reader.getAccountRow(i));
                    break;
                }

                case O2GTableType.ClosedTrades:
                {
                    row = this.GetRow <ClosedTradeRow, O2GClosedTradeRow>(reader.getClosedTradeRow(i));
                    break;
                }

                case O2GTableType.Messages:
                {
                    row = this.GetRow <MessageRow, O2GMessageRow>(reader.getMessageRow(i));
                    break;
                }

                case O2GTableType.Offers:
                {
                    row = this.GetRow <OfferRow, O2GOfferRow>(reader.getOfferRow(i));
                    break;
                }

                case O2GTableType.Orders:
                {
                    row = this.GetRow <OrderRow, O2GOrderRow>(reader.getOrderRow(i));
                    break;
                }

                case O2GTableType.Trades:
                {
                    row = this.GetRow <TradeRow, O2GTradeRow>(reader.getTradeRow(i));
                    break;
                }
                }

                if (row != null)
                {
                    row.UpdateType = ConvertersInternal.GetUpdateType(reader.getUpdateType(i));
                    rows.Add(row);
                }
            }

            return(rows);
        }
 public RowInplaceEditorHelper(BaseRow row, RepositoryItem inplaceEditor)
 {
     _Row   = row;
     _Item  = inplaceEditor;
     _VGrid = _Row.Grid;
     _VGrid.CustomDrawRowHeaderCell += vGrid_CustomDrawRowHeaderCell;
     _VGrid.MouseDown += vGrid_MouseDown;
 }
Пример #6
0
 private AppearanceObject checkGetNormalRowStyle(BaseRow row)
 {
     return(_normalRowStyle ??
            (_normalRowStyle = new AppearanceObject
     {
         BackColor =
             row.Appearance.BackColor == Color.Empty ? SystemColors.Window : row.Appearance.BackColor
     }));
 }
        private void VerifyStatuses()
        {
            BaseRow focusedRow    = this.propertyGridControl.FocusedRow;
            bool    isCategoryRow = this.propertyGridControl.IsCategoryRow(focusedRow);
            bool    hasParent     = focusedRow.ParentRow != null;
            bool    hasChildren   = focusedRow.HasChildren;
            bool    isExpanded    = focusedRow.Expanded;

            this.expandBarButtonItem.Enabled   = (hasChildren && !isExpanded);
            this.collapseBarButtonItem.Enabled = (hasChildren && isExpanded) || hasParent;
        }
Пример #8
0
        public object FieldFindGetValue(string id)
        {
            object  value = null;
            BaseRow row   = vGridControl1.Rows.GetRowByFieldName(id);

            if (row != null)
            {
                value = row.Properties.Value;
            }
            return(value);
        }
Пример #9
0
        public object ItemGetValue(int index)
        {
            object value = null;

            if (index >= 0 && index < vGridControl1.Rows.Count)
            {
                BaseRow row = vGridControl1.Rows[index];
                if (row != null)
                {
                    value = row.Properties.Value;
                }
            }
            return(value);
        }
Пример #10
0
        private BaseRowViewInfo GetRowInfo(BaseRow row)
        {
            var rowsViewInfo = SimplePropertiesGrid.ViewInfo.RowsViewInfo;

            for (var i = 0; i < rowsViewInfo.Count; i++)
            {
                var info = rowsViewInfo[i];
                if (info.Row == row)
                {
                    return(info);
                }
            }
            return(null);
        }
Пример #11
0
        // 是否保存密码,点击时更新vGridControl状态
        void edtSavePassword_EditValueChanged(object sender, EventArgs e)
        {
            CheckEdit editCheck = sender as CheckEdit;

            VGridRows rows = this.vGridControl.Rows;

            if (rows != null)
            {
                BaseRow row = rows["itemSavePassword"];
                if (row != null)
                {
                    row.Properties.Value = editCheck.EditValue;
                }
            }
        }
        private void NewMethod()
        {
            BaseRow focusedRow    = this.propertyGridControl1.FocusedRow;
            bool    isExpanded    = focusedRow.Expanded;
            bool    isCategoryRow = this.propertyGridControl1.IsCategoryRow(focusedRow);

            if (isCategoryRow)
            {
                this.expandBarButtonItem.Enabled   = !isExpanded;
                this.collapseBarButtonItem.Enabled = isExpanded;
            }
            else
            {
                this.expandBarButtonItem.Enabled   = false;
                this.collapseBarButtonItem.Enabled = false;
            }
        }
Пример #13
0
        // 连接服务器
        private void btnConnect_Click(object sender, EventArgs e)
        {
            VGridRows rows = this.vGridControl.Rows;

            if (rows != null)
            {
                BaseRow row = rows["itemServer"];
                if (row != null && row.Properties.Value != null)
                {
                    Server = row.Properties.Value.ToString();
                }
                row = rows["itemUserName"];
                if (row != null && row.Properties.Value != null)
                {
                    UserName = row.Properties.Value.ToString();
                }
                row = rows["itemPassword"];
                if (row != null && row.Properties.Value != null)
                {
                    Password = row.Properties.Value.ToString();
                }
                row = rows["itemSavePassword"];
                if (row != null && row.Properties.Value != null)
                {
                    SavePassword = row.Properties.Value.ToString();
                }

                XML.Clear(xmlFile);
                XML.Update(xmlFile, "Server", "server", Server);
                int nIndex = 1;
                for (int i = 1; i < comboBoxServer.Items.Count + 1; i++)
                {
                    if (comboBoxServer.Items[i - 1].ToString() != Server)
                    {
                        XML.Update(xmlFile, "Server", "server" + nIndex, comboBoxServer.Items[i - 1].ToString());
                        nIndex++;
                    }
                }
                XML.Update(xmlFile, "UserName", "", UserName);
                XML.Update(xmlFile, "Password", "", Password);
                XML.Update(xmlFile, "SavePassword", "", SavePassword);
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
 public override void Execute(BaseRow row)
 {
     if (row is MultiEditorRow)
     {
         if ((row as MultiEditorRow).PropertiesCollection[fieldName] != null)
         {
             MultiEditorRow mRow = row as MultiEditorRow;
             FocusRow(row);
             row.Grid.FocusedRecordCellIndex = mRow.PropertiesCollection.IndexOf(mRow.PropertiesCollection[fieldName]);
         }
         else
         if (row.Properties.FieldName == fieldName)
         {
             FocusRow(row);
         }
     }
 }
Пример #15
0
        private void collapseBarButtonItem_ItemClick(object sender, ItemClickEventArgs e)
        {
            BaseRow focusedRow  = this.propertyGridControl.FocusedRow;
            bool    hasParent   = focusedRow.ParentRow != null;
            bool    hasChildren = focusedRow.HasChildren;
            bool    isExpanded  = focusedRow.Expanded;

            if (hasChildren && isExpanded)
            {
                this.propertyGridControl.FocusedRow.Expanded = false;
            }
            else if (hasParent)
            {
                focusedRow.ParentRow.Expanded = false;
            }
            this.VerifyStatuses( );
        }
Пример #16
0
        // 初始化登录窗口
        private void LoginForm_Load(object sender, EventArgs e)
        {
            VGridRows rows = this.vGridControl.Rows;

            if (rows != null)
            {
                UserName = XML.Read(xmlFile, "UserName", "");
                Password = XML.Read(xmlFile, "Password", "");

                BaseRow row = rows["itemUserName"];
                if (row != null)
                {
                    row.Properties.Value = UserName;
                }
                row = rows["itemPassword"];
                if (row != null)
                {
                    row.Properties.Value = Password;
                }
            }
        }
 private void FocusRow(BaseRow row)
 {
     row.Grid.MakeRowVisible(row);
     row.Grid.FocusedRow = row;
     isRowFound          = true;
 }
Пример #18
0
 public override void Execute(BaseRow row)
 {
     if (row.Visible == false && row.OptionsRow.AllowMoveToCustomizationForm)
     {
         row.Visible = true;
     }
 }
Пример #19
0
 public override void Execute(BaseRow row)
 {
     //if (row.Visible == true)
     //{
     if (al.Contains(row.Properties.FieldName) || al.Contains(row.Properties.FieldName.Replace("打分", "").ToString()))
     {
         row.Visible = true;
     }
     else
     {
         row.Visible = false;
     }
     //}
 }
Пример #20
0
 private void LocalizeRow(BaseRow row)
 {
     if (row.Properties.Caption.IndexOf("<LOC>") < 0)
     {
         row.Properties.Caption = "<LOC>" + row.Properties.Caption;
     }
     row.Properties.Caption = Loc.Get(row.Properties.Caption);
     foreach (BaseRow row2 in row.ChildRows)
     {
         this.LocalizeRow(row2);
     }
 }
Пример #21
0
        // 初始化登陆窗口
        private void LoginForm_Load(object sender, EventArgs e)
        {
            VGridRows rows = this.vGridControl.Rows;

            if (rows != null)
            {
                int    nIndex        = 1;
                string historyServer = string.Empty;
                while (true)
                {
                    historyServer = XML.Read(xmlFile, "Server", "server" + nIndex);
                    if (historyServer == "" || historyServer == string.Empty)
                    {
                        break;
                    }
                    else
                    {
                        if (comboBoxServer.Items.Contains(historyServer) == false)
                        {
                            comboBoxServer.Items.Add(historyServer);
                        }
                    }
                    nIndex++;
                }


                Server       = XML.Read(xmlFile, "Server", "server");
                UserName     = XML.Read(xmlFile, "UserName", "");
                Password     = XML.Read(xmlFile, "Password", "");
                SavePassword = XML.Read(xmlFile, "SavePassword", "");

                if (comboBoxServer != null)
                {
                    if (comboBoxServer.Items.Contains(Server) == false)
                    {
                        comboBoxServer.Items.Insert(0, Server);
                    }
                }

                BaseRow row = rows["itemServer"];
                if (row != null)
                {
                    row.Properties.Value = Server;
                }
                row = rows["itemUserName"];
                if (row != null)
                {
                    row.Properties.Value = UserName;
                }
                row = rows["itemPassword"];
                if (row != null)
                {
                    row.Properties.Value = Password;
                }
                row = rows["itemSavePassword"];
                if (row != null)
                {
                    bool savePassword = true;
                    bool.TryParse(SavePassword, out savePassword);
                    row.Properties.Value = savePassword;
                }
            }
        }
Пример #22
0
 public override void Execute(BaseRow row)
 {
     //if (row.Visible == false && row.OptionsRow.AllowMoveToCustomizationForm)
     //{
     //    if (!al.Contains(row.Properties.FieldName))
     //    {
     //        al.Add(row.Properties.FieldName);
     //    }
     //}
     if (row.Visible == true)
     {
         if (!al.Contains(row.Properties.FieldName))
         {
             al.Add(row.Properties.FieldName);
         }
     }
 }
Пример #23
0
        /// <summary>
        /// 单击VGridview生成图表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StatisticsAndChart_vGridControl_MouseClick(object sender, MouseEventArgs e)
        {
            DevExpress.XtraVerticalGrid.VGridControl gridcontrol = new DevExpress.XtraVerticalGrid.VGridControl();
            gridcontrol = sender as DevExpress.XtraVerticalGrid.VGridControl;
            VGridHitInfo info = gridcontrol.CalcHitInfo(new Point(e.X, e.Y));

            //当左键单击HeaderCell时
            if (info.HitInfoType == HitInfoTypeEnum.HeaderCell &&
                info.Row.HasChildren &&
                e.Button == MouseButtons.Left &&
                info.Row.Properties.Caption.IndexOf('*') != 0)
            {
                BaseRow     baserow = gridcontrol.FocusedRow;
                CategoryRow gr      = baserow as CategoryRow;
                //根据tag加载列数据
                if (gr != null && gr.Tag != null)
                {
                    string[] data = null;
                    //判断字段类型是否为数值型
                    if (gridview.Columns[gr.Properties.Caption].ColumnType.IsValueType)
                    {
                        //读取tag中的数据至数组
                        double[]      doubledata = gr.Tag as double[];
                        List <double> doublelist = doubledata.ToList();
                        //计算唯一值及唯一值个数
                        List <double> d_uniquevalue = doubledata.Distinct().ToList();
                        int           d_uniquecount = d_uniquevalue.Count;
                        //当唯一值个数大于30时,执行分组处理
                        if (d_uniquecount > 30)
                        {
                            //计算分组间距
                            double interval = (d_uniquevalue.Max() - d_uniquevalue.Min()) / 25;
                            //计算图表中加入点的值
                            List <string> chart_uniquevalue = new List <string>();
                            for (int n = 0; n < 26; n++)
                            {
                                if (n == 25)
                                {
                                    chart_uniquevalue.Add((interval * n).ToString("0.0") + "-" + d_uniquevalue.Max().ToString("0.0"));
                                }
                                else
                                {
                                    chart_uniquevalue.Add((interval * n).ToString("0.0") + "-" + (interval * (n + 1)).ToString("0.0"));
                                }
                            }
                            double max = d_uniquevalue.Max();
                            //chart_uniquevalue.Add((d_uniquevalue.Max()).ToString());
                            //声明26个list类型的数组
                            List <double>[] findlist = new List <double> [26];
                            for (int n = 0; n < 26; n++)
                            {
                                findlist[n] = new List <double>();
                            }
                            //根据分组间距,将所有数据存放到对应的26个list中
                            for (int n = 0; n < doublelist.Count; n++)
                            {
                                findlist[(int)(doublelist[n] / interval)].Add(doublelist[n]);
                            }
                            //完成分组
                            //清除图表数据,重新载入数据
                            for (int i = 0; i < StatisticsChart_chart1.Series.Count; i++)
                            {
                                StatisticsChart_chart1.Series.RemoveAt(i);
                            }
                            //创建图表
                            Series series = new Series(gr.Properties.Caption + "_Count", ViewType.Bar);
                            for (int n = 0; n < 26; n++)
                            {
                                series.Points.Add(new SeriesPoint(chart_uniquevalue[n].ToString(), findlist[n].Count));
                            }
                            StatisticsChart_chart1.Series.Add(series);
                        }
                        else
                        {
                            data = new string[gridview.RowCount];
                            for (int i = 0; i < doubledata.Count(); i++)
                            {
                                data[i] = doubledata[i].ToString();
                            }
                        }
                    }
                    else
                    {
                        data = new string[gridview.RowCount];
                        data = gr.Tag as string[];
                    }
                    if (data != null)
                    {
                        List <string> datalist = data.ToList();
                        //获取唯一值
                        List <string> UniqueValue = data.Distinct().ToList();
                        int           uniquecount = UniqueValue.Count;
                        if ((uniquecount <= 300) || (uniquecount > 300 && (MessageBox.Show("分类数较多,是否继续?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)))
                        {
                            //清除图表数据,重新载入数据
                            for (int i = 0; i < StatisticsChart_chart1.Series.Count; i++)
                            {
                                StatisticsChart_chart1.Series.RemoveAt(i);
                            }
                            //创建图表
                            Series series1 = new Series("", ViewType.Bar);
                            for (int i = 0; i < uniquecount; i++)
                            {
                                series1.Points.Add(new SeriesPoint(UniqueValue[i], (datalist.FindAll(value => value.Contains(UniqueValue[i]))).Count));
                            }
                            StatisticsChart_chart1.Series.Add(series1);
                        }
                    }
                    //生成X坐标轴名称
                    XYDiagram diagram = (XYDiagram)StatisticsChart_chart1.Diagram;
                    diagram.AxisX.Title.Visible   = true;
                    diagram.AxisX.Title.Alignment = StringAlignment.Center;
                    diagram.AxisX.Title.Text      = info.Row.Properties.Caption;
                    //生成Y坐标轴名称
                    diagram.AxisY.Title.Visible   = true;
                    diagram.AxisY.Title.Alignment = StringAlignment.Center;
                    diagram.AxisY.Title.Text      = "Count";
                }
            }
        }
Пример #24
0
 private void RemoveEditor(BaseRow rowEdit, string propertyName)
 {
     SimplePropertiesGrid.Rows.Remove(rowEdit);
     SimplePropertiesGrid.Refresh();
     HideProperties.Add(propertyName, rowEdit);
 }
 public override bool CanContinueIteration(BaseRow row)
 {
     return(!isRowFound);
 }
 private void vGridControl1_StartDragRow(object sender, DevExpress.XtraVerticalGrid.Events.StartDragRowEventArgs e)
 {
     IsDragging = true;
     draggedRow = e.Row;
 }