Ejemplo n.º 1
0
        public async void Connect(string address, string dataBaseName, string tags, string filterExpression, bool isDevmode)
        {
            this.DisplayName = "connecting...";

            try
            {
                this.BeginProgress();
                var metaData = await Task.Run(() => this.service.GetDataGenerationData(address, dataBaseName, tags, filterExpression, isDevmode, -1));

                using (var stream = new MemoryStream())
                {
                    this.serializer.Serialize(stream, metaData);
                    stream.Position = 0;
                    this.dataSet    = CremaReader.Read(stream);
                }

                this.tables.Clear();

                foreach (var item in this.dataSet.Tables.OrderBy(i => i.Name))
                {
                    this.tables.Add(new ItemViewModel(item));
                }
                this.EndProgress();
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e);
                this.EndProgress();
                this.Dispose();
                return;
            }

            this.DisplayName = address;
            this.NotifyOfPropertyChange(() => this.ItemsSource);
        }
Ejemplo n.º 2
0
        public async void Open(string filename)
        {
            try
            {
                this.DisplayName = "loading...";
                this.BeginProgress();
                this.dataSet = await Task.Run(() => CremaReader.Read(filename));

                this.tables = new ObservableCollection <ItemViewModel>();

                foreach (var item in this.dataSet.Tables.OrderBy(i => i.Name))
                {
                    this.tables.Add(new ItemViewModel(item));
                }

                this.EndProgress();
            }
            catch (Exception e)
            {
                AppMessageBox.ShowError(e.Message);
                this.EndProgress();
                this.Dispose();
                return;
            }

            this.DisplayName = Path.GetFileName(filename);
            this.Comment     = filename;
            this.NotifyOfPropertyChange(() => this.ItemsSource);
        }
Ejemplo n.º 3
0
        private IDataSet GetSerializedDataSet(SerializationSet generationData)
        {
            var serializer = this.fixture.CremaHost.GetService <IEnumerable <IDataSerializer> >().First(o => o.Name == "bin");
            var ms         = new MemoryStream();

            serializer.Serialize(ms, generationData);
            ms.Position = 0;
            var dataSet = CremaReader.Read(ms);

            return(dataSet);
        }