Beispiel #1
0
        public override List<string> getAllDataBases()
        {
            connect();
            DataTable databases = null;

            try
            {
                using (sqlConnection)
                {
                    sqlConnection.Open();
                    databases = sqlConnection.GetSchema("Databases");
                    sqlConnection.Close();
                }
            }
            catch (SqlException ex)
            {
                System.Windows.MessageBox.Show(ex.ToString());
            }

            List<string> data = new List<string>();
            if (databases != null)
            {
                foreach (DataRow row in databases.Rows)
                {
                    data.Add(row.ItemArray[0].ToString());
                }
            }

            data.Remove("master");
            data.Remove("model");
            data.Remove("msdb");
            data.Remove("tempdb");

            return data;
        }
Beispiel #2
0
        public override List<string> getAllDataBases()
        {
            connect();

            MySqlCommand command = connection.CreateCommand();
            command.CommandText = "SHOW DATABASES;";
            //========================================================
            MySqlDataReader Reader;
            List<string> data = new List<string>();

            try
            {
                Reader = command.ExecuteReader();

                while (Reader.Read())
                {
                    //добавление баз данных всех
                    data.Add(Reader.GetValue(0).ToString());
                }

                disconnect();
            }
            catch (MySqlException ex)
            {
                System.Windows.MessageBox.Show(ex.ToString());
            }

            data.Remove("information_schema");
            data.Remove("performance_schema");
            data.Remove("mysql");

            return data;
        }
Beispiel #3
0
        /// <summary>
        /// Back, pop_back
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        private static IUndoRedoCommand _Pop(List<IUndoRedoCommand> list)
        {
            // 最後に追加したコマンドの取得
            var command = list.Last();
            // コマンドをリストから削除
            list.Remove(command);

            return command;
        }
Beispiel #4
0
 /// <summary>
 /// push_back, pop_front
 /// </summary>
 /// <param name="list"></param>
 /// <param name="command"></param>
 private static void _PushAndPopFront(List<IUndoRedoCommand> list, IUndoRedoCommand command)
 {
     // 最後にコマンドを追加
     list.Add(command);
     // 最初のコマンドを削除
     list.Remove(list.First());
 }
        private void selectedCellsChangedHandler(object param = null)
        {
            IEnumerable<object> selected = param as IEnumerable<object>;
            var selectedDataItems = selected.Cast<DataItemViewModel>().ToList();

            // Clone the SelectedEntries
            List<DataItemViewModel> clonedSelectedEntries = new List<DataItemViewModel>(selectedDataItems);

            // keep the previous entry that is part of the selection
            DataItemViewModel previousSelectedItem = null;

            // Keep the previous entry that is in the list
            DataItemViewModel previousItem = null;

            // build list backwards so that diffs happen in order going up
            int viewCount = Data.Count;
            for (int i = viewCount - 1; i >= 0; i--)
            {
                // Get current item in the list
                var currentItem = Data[i] as DataItemViewModel;

                // If the item is part of the selection we will want some kind of diff
                if (clonedSelectedEntries.Contains(currentItem))
                {
                    // If the previous selected item is null
                    // this means that it is the bottom most item in the selection
                    // and compare it to the previous non selected string
                    if (previousSelectedItem != null)
                    {
                        currentItem.PrevName = previousSelectedItem.Name;
                        currentItem.IsVisualDiffVisible = true;
                    }
                    else if (previousItem != null) // if there is a previous selected item compare the item with that one
                    {
                        currentItem.PrevName = previousItem.Name;
                        currentItem.IsVisualDiffVisible = true;
                    }
                    else //the selected item is the bottom item with nothing else to compare, so just show differences from an empty string
                    {
                        currentItem.PrevName = String.Empty;
                        currentItem.IsVisualDiffVisible = true;
                    }

                    // Set the previously selected item to the current item to keep for comparison with the next selected item on the way up
                    previousSelectedItem = currentItem;

                    // clean up
                    clonedSelectedEntries.Remove(currentItem);
                }
                else // if item is not part of the selection we will want the original text
                {
                    currentItem.PrevName = String.Empty;
                    currentItem.IsVisualDiffVisible = false;
                }

                // regardless of whether item is in selection or not we keep it as the previous item when we move up to the next one
                previousItem = currentItem;
            }
        }