示例#1
0
        private void ReloadQuotesFromFile(SymbolArchiveInfo smbInf, bool promptAndUpdateCharts)
        {
            // подкачать котировки из файла
            // ReSharper disable LocalizableElement
            var dlg = new OpenFileDialog
            {
                CheckFileExists = true,
                Title           = "Выберите файл котировок " + smbInf.Symbol,
                DefaultExt      = "quote",
                Filter          = "Все файлы|*.*|Котировки (*.quote)|*.quote"
            };

            // ReSharper restore LocalizableElement

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            List <CandleData> quotes;
            var ext = Path.GetExtension(dlg.FileName).ToLower();

            try
            {
                quotes = ext == ".csv" ? CandleData.LoadFromCsvFile(dlg.FileName)
                    : CandleData.LoadFromFile(dlg.FileName, smbInf.Symbol);
            }
            catch (Exception ex)
            {
                Logger.ErrorFormat("Ошибка чтения котировок из файла \"{0}\": {1}",
                                   dlg.FileName, ex);

                MessageBox.Show(string.Format(Localizer.GetString("MessageErrorReadingQuotes") + ": \"{0}\"", ex.Message),
                                Localizer.GetString("TitleError"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MergeQuotes(smbInf.Symbol, quotes);

            if (promptAndUpdateCharts)
            {
                if (MessageBox.Show(this, Localizer.GetString("MessageUpdateChartsBy") + " " + smbInf.Symbol + "?",
                                    Localizer.GetString("TitleConfirmation"),
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    MainForm.Instance.ReopenChartsSafe(smbInf.Symbol);
                }
            }
        }
示例#2
0
        private void SetupGrid()
        {
            var blank = new SymbolArchiveInfo(string.Empty, null);

            grid.Columns.Add(new FastColumn(blank.Property(p => p.Selected), Localizer.GetString("TitleChoice"))
            {
                ColumnWidth            = 49,
                ImageList              = imageListSelected,
                SortOrder              = FastColumnSort.Descending,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor  = Cursors.Hand
            });

            grid.Columns.Add(new FastColumn(blank.Property(p => p.IsFavorite), "*")
            {
                ColumnWidth            = 25,
                ImageList              = imageListFavorite,
                SortOrder              = FastColumnSort.Descending,
                IsHyperlinkStyleColumn = true,
                HyperlinkActiveCursor  = Cursors.Hand
            });
            grid.Columns.Add(new FastColumn(blank.Property(p => p.Loaded), Localizer.GetString("TitleLoaded"))
            {
                ColumnWidth = 64,
                formatter   = v => (bool)v ? Localizer.GetString("TitleYes") : Localizer.GetString("TitleNo"),
                SortOrder   = FastColumnSort.Descending
            });
            grid.Columns.Add(new FastColumn(blank.Property(p => p.Symbol), Localizer.GetString("TitleInstrument"))
            {
                ColumnWidth = 75,
                SortOrder   = FastColumnSort.Ascending
            });
            grid.Columns.Add(new FastColumn(blank.Property(p => p.DateRange), Localizer.GetString("TitleInterval"))
            {
                ColumnMinWidth = 190
            });
            grid.Columns.Add(new FastColumn(blank.Property(p => p.GapsTotalString),
                                            Localizer.GetString("TitleGapsCountShort"))
            {
                ColumnWidth = 85
            });
            grid.UserHitCell += GridUserHitCell;
            grid.CheckSize(true);
            grid.CalcSetTableMinWidth();
        }
示例#3
0
        private void SetupGrid()
        {
            var blank = new SymbolArchiveInfo(string.Empty, null);
            grid.Columns.Add(new FastColumn(blank.Property(p => p.Selected), Localizer.GetString("TitleChoice"))
                {
                    ColumnWidth = 49,
                    ImageList = imageListSelected,
                    SortOrder = FastColumnSort.Descending,
                    IsHyperlinkStyleColumn = true,
                    HyperlinkActiveCursor = Cursors.Hand
                });

            grid.Columns.Add(new FastColumn(blank.Property(p => p.IsFavorite), "*")
                {
                    ColumnWidth = 25,
                    ImageList = imageListFavorite,
                    SortOrder = FastColumnSort.Descending,
                    IsHyperlinkStyleColumn = true,
                    HyperlinkActiveCursor = Cursors.Hand
                });
            grid.Columns.Add(new FastColumn(blank.Property(p => p.Loaded), Localizer.GetString("TitleLoaded"))
                {
                    ColumnWidth = 64,
                    formatter = v => (bool) v ? Localizer.GetString("TitleYes") : Localizer.GetString("TitleNo"),
                    SortOrder = FastColumnSort.Descending
                });
            grid.Columns.Add(new FastColumn(blank.Property(p => p.Symbol), Localizer.GetString("TitleInstrument"))
                {
                    ColumnWidth = 75,
                    SortOrder = FastColumnSort.Ascending
                });
            grid.Columns.Add(new FastColumn(blank.Property(p => p.DateRange), Localizer.GetString("TitleInterval"))
                {
                    ColumnMinWidth = 190
                });
            grid.Columns.Add(new FastColumn(blank.Property(p => p.GapsTotalString),
                                            Localizer.GetString("TitleGapsCountShort")) {ColumnWidth = 85});
            grid.UserHitCell += GridUserHitCell;
            grid.CheckSize(true);
            grid.CalcSetTableMinWidth();
        }
示例#4
0
        private void ReloadQuotesFromFile(SymbolArchiveInfo smbInf, bool promptAndUpdateCharts)
        {
            // подкачать котировки из файла
            // ReSharper disable LocalizableElement
            var dlg = new OpenFileDialog
                {
                    CheckFileExists = true,
                    Title = "Выберите файл котировок " + smbInf.Symbol,
                    DefaultExt = "quote",
                    Filter = "Все файлы|*.*|Котировки (*.quote)|*.quote"
                };
            // ReSharper restore LocalizableElement

            if (dlg.ShowDialog() != DialogResult.OK) return;
            List<CandleData> quotes;
            try
            {
                quotes = CandleData.LoadFromFile(dlg.FileName, smbInf.Symbol);
            }
            catch (Exception ex)
            {
                Logger.ErrorFormat("Ошибка чтения котировок из файла \"{0}\": {1}",
                                   dlg.FileName, ex);

                MessageBox.Show(string.Format(Localizer.GetString("MessageErrorReadingQuotes") + ": \"{0}\"", ex.Message),
                                Localizer.GetString("TitleError"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            MergeQuotes(smbInf.Symbol, quotes);

            if (promptAndUpdateCharts)
            {
                if (MessageBox.Show(this, Localizer.GetString("MessageUpdateChartsBy") + " " + smbInf.Symbol + "?",
                    Localizer.GetString("TitleConfirmation"),
                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    MainForm.Instance.ReopenChartsSafe(smbInf.Symbol);
            }
        }