private void StartConsumeMessages()
        {
            var canStart = !string.IsNullOrEmpty(ZookeeperHostServer) &&
                           !string.IsNullOrEmpty(KafkaHostServer) &&
                           TopicItems.Any() &&
                           !string.IsNullOrEmpty(SelectedTopic);

            if (!canStart)
            {
                MessageBox.Show("Can't start consumer, please check zookeeper host, kafka host and selected topic!");
                return;
            }
            ReceivedMessages.Clear();
            Tables.Clear();
            _cancelConsume = new CancellationTokenSource();
            CurrentStatus  = $"Consuming messages from topic:{SelectedTopic} ...";
            DEKafkaMessageViewer.Common.KafkaConsumer consumer = new Common.KafkaConsumer();
            var groupId = Guid.NewGuid().ToString();

            consumer.ConsumeAsync(KafkaHostServer, SelectedTopic, groupId, _cancelConsume, (resultMsg) =>
            {
                var msgBody = resultMsg.Message;
                EnableStop  = true;
                OnMessageConsumed(msgBody);
            });
        }
Пример #2
0
        private void OnSearch()
        {
            if (!Id.HasValue)
            {
                return;
            }

            if (_history.Any())
            {
                if (_history.Peek() != Id.Value)
                {
                    _history.Push(Id.Value);
                }
            }
            else
            {
                _history.Push(Id.Value);
            }

            Tables.Clear();
            foreach (var table in DbManager.Search(ConnectionString, Id.Value).OrderBy(x => x.Name))
            {
                Tables.Add(table);
            }

            BackCommand.OnCanExecuteChanged();
        }
Пример #3
0
        private void LoadConfigExecute(object sender)
        {
            var fileDialog = new OpenFileDialog();

            fileDialog.Multiselect     = false;
            fileDialog.CheckFileExists = true;
            fileDialog.DefaultExt      = "*.msConfigStore";
            fileDialog.Filter          = "ConfigFile (*.msConfigStore)|*.msConfigStore";
            var result = fileDialog.ShowDialog();

            if (result.HasValue && result.Value && File.Exists(fileDialog.FileName))
            {
                Tables.Clear();
                Views.Clear();
                StoredProcs.Clear();
                SelectedTable = null;

                var         binFormatter = new BinaryFormatter();
                ConfigStore options;
                try
                {
                    using (var fs = fileDialog.OpenFile())
                    {
                        options = (ConfigStore)binFormatter.Deserialize(fs);
                    }
                }
                catch (Exception)
                {
                    Status = "File is an in invalid format";
                    return;
                }

                var version = typeof(SharedMethods).Assembly.GetName().Version;
                if (new Version(options.Version) != version)
                {
                    var messageBoxResult = MessageBox.Show(Application.Current.MainWindow,
                                                           "Warning Version missmatch",
                                                           string.Format("The current Entity Creator version ({0}) is not equals the version ({1}) you have provided.",
                                                                         version, options.Version),
                                                           MessageBoxButton.OKCancel);

                    if (messageBoxResult == MessageBoxResult.Cancel)
                    {
                        return;
                    }
                }

                if (options.SourceConnectionString != null)
                {
                    ConnectionString = options.SourceConnectionString;
                    CreateEntrysAsync(ConnectionString, "", string.Empty).ContinueWith(task =>
                    {
                        foreach (var optionsAction in options.Actions)
                        {
                            optionsAction.Replay(this);
                        }
                    });
                }
            }
        }
Пример #4
0
        public void AppendFrom(ITable table)
        {
            if (Tables.Count == 0)
            {
                SelectTable = table;
            }

            string key = table.Datasource + table.Owner + table.Name;

            if (Tables.Count > 1 && !JoinInWhereClause)
            {
                Tables.Clear();
                Tables.Add(key, SelectTable);
            }

            if (Tables.Count > 0 && !JoinInWhereClause)
            {
                return;
            }

            if (!Tables.ContainsKey(key))
            {
                Tables.Add(key, table);
            }
        }
Пример #5
0
        private void PrepareMapFile()
        {
            if (map == null)
            {
                return;
            }

            var root = map.Element("XDFFORMAT");

            if (root == null)
            {
                return;
            }

            var header = root.Element("XDFHEADER");

            if (header == null)
            {
                return;
            }

            Categories.Clear();
            foreach (var category in header.Elements("CATEGORY"))
            {
                Categories.Add(category.Attribute("index").Value, category.Attribute("name").Value);
            }

            Tables.Clear();
            foreach (var table in root.Elements("XDFTABLE"))
            {
                Tables.Add(new Table(table));
            }
        }
Пример #6
0
 /// <summary>
 ///		Limpia los esquemas
 /// </summary>
 public void Clear()
 {
     Tables.Clear();
     Triggers.Clear();
     Views.Clear();
     Routines.Clear();
 }
Пример #7
0
 public Diagram(Model model)
 {
     Tables.Clear();
     ZOrder.Clear();
     //Relationships.Clear();
     Model = model;
 }
Пример #8
0
        public bool SaveDefinitions()
        {
            string ValidFilename(string b)
            {
                return(string.Join("_", b.Split(Path.GetInvalidFileNameChars(), StringSplitOptions.RemoveEmptyEntries)).TrimEnd('.') + ".xml");
            }

            try
            {
                _loading = true;

                var builds = Tables.OrderBy(x => x.Name).GroupBy(x => x.Build).ToList();
                Tables.Clear();
                foreach (var build in builds)
                {
                    Definition _def = new Definition
                    {
                        Build  = build.Key,
                        Tables = new HashSet <Table>(build)
                    };

                    XmlSerializer ser = new XmlSerializer(typeof(Definition));
                    using (var fs = new FileStream(Path.Combine(DEFINITION_DIR, ValidFilename(BuildText(build.Key))), FileMode.Create))
                        ser.Serialize(fs, _def);
                }

                _loading = false;
                return(true);
            }
            catch (Exception)
            {
                _loading = false;
                return(false);
            }
        }
Пример #9
0
        private async void RetrieveTablesAsync()
        {
            IsBusy             = true;
            BusyMessage        = "Retrieving tables...";
            Tables.IsNotifying = false;
            Tables.Clear();
            _selectedTables.Clear();
            try
            {
                if (SelectedDatabase != null)
                {
                    using (var conn = new SqlConnection(ConnectionString))
                    {
                        await conn.OpenAsync();

                        IEnumerable <Table> tbls = await Task.Run(
                            () => Model.retrieveTables(conn,
                                                       new GenerationOptions(SelectedDatabase,
                                                                             FSharpOption <String> .None,
                                                                             new FSharpOption <string>("Id$"),
                                                                             true)));

                        Tables.AddRange(tbls);
                    }
                }
            }
            finally
            {
                IsBusy             = false;
                BusyMessage        = String.Empty;
                Tables.IsNotifying = true;
                Tables.Refresh();
            }
        }
Пример #10
0
        void ExecuteLoadTablesCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                Tables.Clear();
                var tables = GetAllTablesAsync().Result;
                foreach (var table in tables)
                {
                    if (table.name != "sqlite_sequence")
                    {
                        Tables.Add(table);
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
Пример #11
0
 public void ReloadDatabase()
 {
     Tables.Clear();
     Triggers.Clear();
     LoadDatabase(_dbInfo.Path);
     CollectionViewSource.GetDefaultView(this.Tables).Refresh();
 }
Пример #12
0
        public void RegistryTables()
        {
            Tables.Clear();

            if (Matters == null)
            {
                Matters = new Matters();
            }
            RegistryTable("Matters", new Matter(), Matters);
            if (Specialities == null)
            {
                Specialities = new Specialities();
            }
            RegistryTable("Specialities", new Speciality(), Specialities);
            if (PassMatters == null)
            {
                PassMatters = new PassMatters();
            }
            RegistryTable("PassMatters", new PassMatter(), PassMatters);
            if (Enrollees == null)
            {
                Enrollees = new Enrollees();
            }
            RegistryTable("Enrollees", new Enrollee(), Enrollees);
        }
Пример #13
0
 ///<inheritdoc/>
 public void Reset()
 {
     Tables.Clear();
     Columns.Clear();
     Views.Clear();
     StoredProcedures.Clear();
     SchemaNames.Clear();
 }
 private void _PopulateTables(IEnumerable <Table> tables)
 {
     Tables.Clear();
     foreach (var table in tables)
     {
         Tables.Add(table);
     }
 }
        public void Clear()
        {
            foreach (var t in Tables)
            {
                t.Clear();
            }

            Tables.Clear();
        }
Пример #16
0
        public void UpdateTablesList()
        {
            List <string> tablesList = DB.connector.GetTablesList();

            Tables.Clear();
            foreach (var el in tablesList)
            {
                Tables.Add(el);
            }
        }
Пример #17
0
 public override void Clear()
 {
     Tables.Clear();
     Views.Clear();
     MaterializedViews.Clear();
     Indexes.Clear();
     Sequences.Clear();
     Synonyms.Clear();
     Triggers.Clear();
     StoredProcedures.Clear();
 }
Пример #18
0
        protected override void ObtainData(object sender, DoWorkEventArgs e)
        {
            Success = null;
            if (!m_Identified)
            {
                LoadingDataVm.SmallLoadingMessage = "Reaching the server ...";
                Thread.Sleep(1000);
                if (!m_Server.Connect())
                {
                    Success = false;
                    MessageBox.Show("Unreachable");
                    return;
                }

                m_Server.ServerLost += m_Server_ServerLost;
                m_Server.Start();

                LoadingDataVm.SmallLoadingMessage = "Checking Compatibility ...";
                Thread.Sleep(1000);
                var compat = m_Server.CheckServerCompatibility(typeof(App).Assembly.FullName);
                if (!compat.Success)
                {
                    Success = false;
                    MessageBox.Show($"{compat.MessageId}: {compat.Message}{Environment.NewLine}Server: {compat.ServerIdentification}{Environment.NewLine}Server protocol: {compat.ImplementedProtocolVersion}", "Server and client are not compatible");
                    return;
                }
                m_Game = compat.AvailableGames.FirstOrDefault();

                LoadingDataVm.SmallLoadingMessage = "Identifying the Player ...";
                Thread.Sleep(1000);
                if (!m_Server.Identify(m_Name))
                {
                    Success = false;
                    MessageBox.Show("Can't identify as " + m_Name);
                    return;
                }
                m_Identified = true;
            }

            LoadingDataVm.SmallLoadingMessage = "Getting List of tables ...";
            Thread.Sleep(1000);
            var tables = m_Server.ListTables(LobbyTypeEnum.QuickMode);

            if (tables == null)
            {
                Success = false;
                MessageBox.Show("Can't list tables!");
                return;
            }
            Tables.Clear();
            Tables.AddItems(tables);

            Success = true;
        }
 public void Refresh()
 {
     SetProgress(true);
     Tables.Clear();
     Helper.Refresh();
     foreach (var item in Helper)
     {
         Tables.Add(item);
     }
     SetProgress(false);
 }
Пример #20
0
 public void Clear()
 {
     Tables.Clear();
     Forms.Clear();
     Pages.Clear();
     Reports.Clear();
     XmlPorts.Clear();
     Codeunits.Clear();
     Queries.Clear();
     MenuSuites.Clear();
 }
Пример #21
0
 public void Reload()
 {
     Tables.Clear();
     Triggers.Clear();
     Indexes.Clear();
     _domains = null;
     _dbInfo  = new DatabaseInfo(new FirebirdInfo(_dbInfo.Path));
     LoadDatabase(_dbInfo.Path);
     AdditionalInfo.RefrechData(this);
     CollectionViewSource.GetDefaultView(this.Tables).Refresh();
 }
Пример #22
0
 public virtual void Reset()
 {
     try
     {
         this.Clear();
         Relations.Clear();
         Tables.Clear();
     }
     finally
     {
     }
 }
Пример #23
0
 private void AddTables()
 {
     Tables.Clear();
     foreach (object item in chkTables.Items)
     {
         var checkItem = (CheckListItem)item;
         if (!checkItem.IsChecked)
         {
             Tables.Add(checkItem.Label);
         }
     }
 }
Пример #24
0
 private void AddTables()
 {
     Tables.Clear();
     foreach (var item in chkTables.Items)
     {
         var checkItem = (CheckListItem)item;
         if ((!checkItem.IsChecked && !IncludeTables) ||
             (checkItem.IsChecked && IncludeTables))
         {
             Tables.Add(checkItem.Label);
         }
     }
 }
Пример #25
0
        public void Clear()
        {
            Tables.Clear();
#if NAV2009
            Forms.Clear();
            Dataports.Clear();
#endif
            Pages.Clear();
            Reports.Clear();
            XmlPorts.Clear();
            Codeunits.Clear();
            Queries.Clear();
            MenuSuites.Clear();
        }
Пример #26
0
        public void RegistryTables()
        {
            Tables.Clear();

            if (Matters == null)
            {
                Matters = new Matters();
            }
            RegistryTable("Matters", new Matter(), Matters);
            if (Specialities == null)
            {
                Specialities = new Specialities();
            }
            RegistryTable("Specialities", new Speciality(), Specialities);
            if (Specializations == null)
            {
                Specializations = new Specializations();
            }
            RegistryTable("Specializations", new Specialization(), Specializations);
            if (MattersCourses == null)
            {
                MattersCourses = new MattersCourses();
            }
            RegistryTable("MattersCourses", new MattersCourse(), MattersCourses);
            if (StudyGroups == null)
            {
                StudyGroups = new StudyGroups();
            }
            RegistryTable("StudyGroups", new StudyGroup(), StudyGroups);
            if (Students == null)
            {
                Students = new Students();
            }
            RegistryTable("Students", new Student(), Students);
            if (Performances == null)
            {
                Performances = new Performances();
            }
            RegistryTable("Performances", new Performance(), Performances);
            if (Semesters == null)
            {
                Semesters = new Semesters();
            }
            RegistryTable("Semesters", new Semester(), Semesters);
            if (Teachers == null)
            {
                Teachers = new Teachers();
            }
            RegistryTable("Teachers", new Teacher(), Teachers);
        }
Пример #27
0
        private void UpdateAvailableTables()
        {
            using (var dbHandler = new DatabaseHandler(selectedDatabase.DatabasePath))
            {
                Tables.Clear();

                var tables = dbHandler.GetTables();

                foreach (var table in tables)
                {
                    Tables.Add(table.Name);
                }
            }
        }
Пример #28
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     DialogResult = true;
     Tables.Clear();
     foreach (object item in chkTables.Items)
     {
         var checkItem = (CheckListItem)item;
         if (checkItem.IsChecked)
         {
             Tables.Add(checkItem.Label);
         }
     }
     Close();
 }
Пример #29
0
 private void OkButton_Click(object sender, RoutedEventArgs e)
 {
     DialogResult = true;
     Tables.Clear();
     foreach (var item in items.Where(m => m.TableInformation.HasPrimaryKey))
     {
         var checkItem = (CheckListItem)item;
         if ((!checkItem.IsChecked && !IncludeTables) ||
             (checkItem.IsChecked && IncludeTables))
         {
             Tables.Add(checkItem.TableInformation);
         }
     }
     Close();
 }
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     DialogResult = true;
     Tables.Clear();
     foreach (var item in items)
     {
         var checkItem = (CheckListItem)item;
         if ((!checkItem.IsChecked && !IncludeTables) ||
             (checkItem.IsChecked && IncludeTables))
         {
             Tables.Add(checkItem.Label);
         }
     }
     Close();
 }