Esempio n. 1
0
        private string GetQueryControlValue(DataSet dsQuery, int Id)
        {
            var qcv = (from QueryControl in dsQuery.Tables["tblkQueryControls"].AsEnumerable()
                       where QueryControl.Field <int>("Id") == Id
                       select QueryControl.Field <String>("ItemDescription")).ElementAt(0);

            return(qcv);
        }
        public PluginWindowManager(QueryControl qc)
        {
            Timer timer = new Timer {
                Interval = 100
            };

            this._tmr          = timer;
            this._queryControl = qc;
            this._tmr.Tick    += new EventHandler(this._tmr_Tick);
        }
Esempio n. 3
0
 internal void CheckQuery(QueryControl qc)
 {
     if ((this._resultsTorn && (qc != null)) && (this.FindQueryControlPanel(qc) == null))
     {
         Control control = qc.DetachResultsControl();
         control.Tag = qc;
         base.Controls.Add(control);
         control.BringToFront();
     }
 }
 public void LoadList(object list, TableDisplay tableDisplay)
 {
     try
     {
         QueryControl.LoadList(list, tableDisplay);
     }
     catch (Exception e)
     {
     }
 }
Esempio n. 5
0
 internal void QueryClosed(QueryControl qc)
 {
     if (this._resultsTorn && (qc != null))
     {
         Control control = this.FindQueryControlPanel(qc);
         if (control != null)
         {
             control.Dispose();
         }
     }
 }
Esempio n. 6
0
 public void setGameAdvisorsQuery(PlayerData[] advisors)
 {
     this.queryObjects = advisors;
     string[] titles = { "Id", "FirstName", "LastName", "City", "Country", "Phone", "AdviseTo_Name" };
     string[] types = { "int", "char", "char", "char", "char", "phone", "int" };
     bool[] readOnly = { true, false, false, false, false, false, false };
     bool[] nullable = { false, false, true, true, true, true, true };
     ctrl = new QueryControl(queryObjects, titles, types, readOnly, nullable);
     tableElementHost.Child = ctrl;
     ctrl.setSelectionType(cbDelType.SelectedIndex == 1);
 }
Esempio n. 7
0
 public void setCitiesChampionshipsNum(CityChampionships[] citiesChmps)
 {
     this.queryObjects = citiesChmps;
     string[] titles = { "City", "NumberOfChampionships" };
     string[] types = { "char", "int" };
     bool[] readOnly = { true, true };
     bool[] nullable = { false, false };
     ctrl = new QueryControl(queryObjects, titles, types, readOnly, nullable);
     tableElementHost.Child = ctrl;
     ctrl.setSelectionType(cbDelType.SelectedIndex == 1);
 }
Esempio n. 8
0
 public void setChampionshipsQuery(ChampionshipData[] chmps)
 {
     this.queryObjects = chmps;
     string[] titles = { "Id", "City", "StartDate", "EndDate", "Picture" };
     string[] types = { "int", "char", "datetime", "datetime", "image" };
     bool[] readOnly = { true, false, false, false, false };
     bool[] nullable = { false, false, false, true, true };
     ctrl = new QueryControl(queryObjects, titles, types, readOnly, nullable);
     tableElementHost.Child = ctrl;
     ctrl.setSelectionType(cbDelType.SelectedIndex == 1);
 }
Esempio n. 9
0
 internal void QueryActivated(QueryControl qc)
 {
     if (this._resultsTorn && (qc != null))
     {
         Control control = this.FindQueryControlPanel(qc);
         if (control != null)
         {
             control.Show();
             control.BringToFront();
         }
     }
 }
Esempio n. 10
0
        protected override void OnMove(EventArgs e)
        {
            base.OnMove(e);
            Action a = delegate {
                foreach (Control control in base.Controls.Cast <Control>().ToArray <Control>())
                {
                    QueryControl tag = control.Tag as QueryControl;
                    if (tag != null)
                    {
                        tag.AncestorMoved();
                    }
                }
            };

            a();
            Program.RunOnWinFormsTimer(a, 100);
        }
Esempio n. 11
0
 private void UntearResults()
 {
     foreach (Control control in base.Controls.Cast <Control>().ToArray <Control>())
     {
         QueryControl tag = control.Tag as QueryControl;
         if (!((tag == null) || tag.IsDisposed))
         {
             control.Parent = null;
             tag.AttachResultsControl(control);
         }
         else
         {
             control.Dispose();
         }
     }
     this._resultsTorn = false;
     base.Hide();
 }
Esempio n. 12
0
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     if ((base.DialogResult == DialogResult.OK) && (this.lstResults.SelectedItems.Count > 0))
     {
         foreach (QueryMatch match in this.lstResults.SelectedItems)
         {
             match.Query.Open();
         }
         QueryControl qc = MainForm.Instance.CurrentQueryControl;
         if (qc != null)
         {
             Program.RunOnWinFormsTimer(delegate {
                 if (!qc.IsDisposed)
                 {
                     qc.FocusQuery();
                 }
             });
         }
     }
 }
        public void selected_query(Query query)
        {
            switch (query)
            {
            case Query.AllGuestRequest:
                QueryControl.LoadList(MainWindow.bl.GetAllGuestRequests(), new GuestRequestTableDisplay());
                break;

            case Query.AllHostingUnit:
                QueryControl.LoadList(MainWindow.bl.GetAllHostingUnits(), new HostingUnitTableDisplay());
                break;

            case Query.AllOrders:
                QueryControl.LoadList(MainWindow.bl.GetAllOrders(), new OrderTableDisplay());
                break;

            case Query.GroupGuestRequestByArea:
                Dictionary <AreaCode, List <GuestRequest> > group = MainWindow.bl.getGuestRequestGroupedByArea();
                QueryControl.LoadList(group.DictionaryToListItems <AreaCode, GuestRequest>(), new GuestRequestTableDisplay());
                break;

            case Query.GroupHostingUnitByArea:
                Dictionary <AreaCode, List <HostingUnit> > group2 = MainWindow.bl.getHostingUnitGroupedByArea();
                QueryControl.LoadList(group2.DictionaryToListItems <AreaCode, HostingUnit>(), new HostingUnitTableDisplay());
                break;

            case Query.GroupGuestRequestByAmountPeople:
                Dictionary <int, List <GuestRequest> > group3 = MainWindow.bl.getGuestRequestGroupedByNumOfPeople();
                QueryControl.LoadList(group3.DictionaryToListItems <int, GuestRequest>(), new GuestRequestTableDisplay());
                break;

            case Query.GroupHostByNumUnits:
                Dictionary <int, List <Host> > group4 = MainWindow.bl.getHostGroupedByNumUnits();
                QueryControl.LoadList(group4.DictionaryToListItems <int, Host>(), new HostTableDisplay());
                break;

            default:
                break;
            }
        }
Esempio n. 14
0
        public static bool HandleKey(MainForm form, QueryControl qc, Keys keyData)
        {
            HotKeyManager manager = new HotKeyManager(form, qc);

            if (manager.HandleCommonQuerylessKeys(keyData))
            {
                return(true);
            }
            if (manager.CurrentQueryControl == null)
            {
                return(false);
            }
            if (manager.HandleCommonKeys(keyData))
            {
                return(true);
            }
            if (UseStudioKeys)
            {
                return(manager.HandleStudioKey(keyData));
            }
            return(manager.HandleSSMSKey(keyData));
        }
Esempio n. 15
0
        private void InitUserControls(IntegrationTestsRunner runner)
        {
            _home = new HomeControl(runner);
            formFunctionPointer      += new functioncall(RenameDB);
            editTablePointer         += new functioncall2(EditTable);
            _home.userFunctionPointer = formFunctionPointer;
            _home.tableEditPointer    = editTablePointer;
            //------------------------------------------------------------

            _renameDBControl     = new RenameDBControl(runner);
            renameDbNamePointer += new renamecall(HomePage);
            _renameDBControl.userSaveControl = renameDbNamePointer;
            //------------------------------------------------------------
            _tableControl = new TableControl(runner);
            tablePointer += new renamecall(HomePage);
            _tableControl.tablePointer = tablePointer;
            //------------------------------------------------------------
            _queryControl = new QueryControl(runner);
            queryPointer += new queryResultcall(ShowResult);
            _queryControl.queryPointer = queryPointer;
            //------------------------------------------------------------
            _resultControl = new ResultControl(runner);
        }
Esempio n. 16
0
 public QueryViewModel(MainWindow window, QueryControl control)
 {
     this.mainWindow = window;
     PIC             = "../image/扫描.png";
     if (PublicData.ServerConfig.model.Equals("0"))
     {
         Model = "离线模式";
     }
     else
     {
         Model = "普通模式";
     }
     thread = new Thread(new ThreadStart(() => {
         while (result)
         {
             if (!PublicData.ServerConfig.connState)
             {
                 PublicData.ServerConfig.wirelessRfid.conn();
                 PublicData.ServerConfig.wirelessRfid.conset();
             }
             lock (PublicData.ServerConfig.EpcS)
             {
                 ///获取2集合不重叠部分
                 var list = (from c in PublicData.ServerConfig.EpcS
                             where !(from d in PublicData.ServerConfig.UEpcS select d).Contains(c)
                             select c).ToList();
                 int i = List.Count() + 1;
                 GetSelArcByEpc getSel = new GetSelArcByEpc();
                 foreach (var temp in list)
                 {
                     object errorMsg = temp;
                     if (getSel.SelArcByEpc(ref errorMsg))
                     {
                         ReturnInfo info = errorMsg as ReturnInfo;
                         if (info.TrueOrFalse)
                         {
                             InventoryInfo inventoryInfo = info.Result as InventoryInfo;
                             inventoryInfo.order         = i;
                             i++;
                             List <InventoryInfo> inventoryInfos = List as List <InventoryInfo>;
                             inventoryInfos.Add(inventoryInfo);
                             List = new List <InventoryInfo>();
                             List = inventoryInfos;
                             control.Dispatcher.BeginInvoke((Action) delegate
                             {
                                 control.grid.ItemsSource = null;
                                 control.grid.ItemsSource = List;
                             });
                             PublicData.ServerConfig.UEpcS.Add(temp);
                         }
                         else
                         {
                             setError(info.Result.ToString());
                             break;
                         }
                     }
                     else
                     {
                         setError(errorMsg.ToString());
                         break;
                     }
                 }
                 Total = "已扫描到标签数量:" + PublicData.ServerConfig.UEpcS.Count;
             }
             Thread.Sleep(1000);
         }
         thread.Abort();
         thread = null;
     }));
     thread.IsBackground = true;
     thread.Start();
 }
Esempio n. 17
0
 public void setPlayersGamesNum(PlayerGames[] playersGames)
 {
     this.queryObjects = playersGames;
     string[] titles = { "Name", "NumberOfGames" };
     string[] types = { "char", "int" };
     bool[] readOnly = { true, true };
     bool[] nullable = { false, false };
     ctrl = new QueryControl(queryObjects, titles, types, readOnly, nullable);
     tableElementHost.Child = ctrl;
     ctrl.setSelectionType(cbDelType.SelectedIndex == 1);
 }
Esempio n. 18
0
        private void FindAll()
        {
            StringBuilder builder = new StringBuilder("var search = new Regex (");

            if (this.chkWholeWord.Checked)
            {
                builder.Append("@\"\\b\" + ");
            }
            string str = this.cboText.Text.Trim().Replace("\"", "\"\"");

            if (!this.chkRegEx.Checked)
            {
                str = Regex.Escape(str);
            }
            builder.Append("@\"" + str + "\"");
            if (this.chkWholeWord.Checked)
            {
                builder.Append(" + @\"\\b\"");
            }
            if (!this.chkMatchCase.Checked)
            {
                builder.Append(", RegexOptions.IgnoreCase");
            }
            builder.AppendLine(");");
            builder.Append("\r\nvar queries =\r\n\tfrom query in ");
            if (!(!this.chkMyQueries.Checked || this.chkSamples.Checked))
            {
                builder.Append("Util.GetMyQueries()");
            }
            else if (!(this.chkMyQueries.Checked || !this.chkSamples.Checked))
            {
                builder.Append("Util.GetSamples()");
            }
            else
            {
                builder.Append("Util.GetMyQueries().Concat (Util.GetSamples())");
            }
            builder.AppendLine((Environment.Version.Major >= 4) ? ".AsParallel().AsOrdered()" : "");
            if ((!this.chkCSharp.Checked || !this.chkVB.Checked) || !this.chkSQL.Checked)
            {
                List <string> list = new List <string>();
                if (this.chkCSharp.Checked)
                {
                    list.Add("query.IsCSharp");
                }
                if (this.chkVB.Checked)
                {
                    list.Add("query.IsVB");
                }
                if (this.chkSQL.Checked)
                {
                    list.Add("query.IsSQL");
                }
                builder.AppendLine("\twhere " + string.Join(" || ", list.ToArray()));
            }
            builder.AppendLine("\tlet matches = search.Matches (query.Text)\r\n\twhere matches.Count > 0 || search.IsMatch (query.Name)\r\n\tgroup new { Query = query.OpenLink, Matches = query.FormatMatches (matches) } by query.Location;\r\n\r\nforeach (var item in queries)\r\n\titem.ToArray().Dump (item.Key);");
            string name = "Find: " + this.cboText.Text.Trim();

            if (name.Length > 30)
            {
                name = name.Substring(0, 0x19) + "...";
            }
            QueryControl qc = MainForm.Instance.AddQueryPage(false, false, builder.ToString(), 1, name, false, false, false);

            qc.Query.Repository  = null;
            qc.Query.ToDataGrids = false;
            qc.Query.IsModified  = false;
            qc.Query.OnQueryChanged();
            qc.SetSplitterHeight(0.2f);
            qc.Run();
            Program.RunOnWinFormsTimer(delegate {
                if (!qc.IsDisposed)
                {
                    qc.FocusQuery();
                }
            });
        }
Esempio n. 19
0
        private void cbQuery_SelectedIndexChanged(object sender, EventArgs e)
        {
            ctrl = null;
            tableElementHost.Child = null;

            switch (cbQuery.SelectedIndex)
            {
                case 0:
                    enableComponents(false, true);
                    mainForm.getClient().getAllUsers("Q", cbDelay.Checked);
                    break;
                case 1:
                    enableComponents(false, false);
                    mainForm.getClient().getAllGames(true, -1, "Q", cbDelay.Checked);
                    break;
                case 2:
                    enableComponents(false, true);
                    mainForm.getClient().getAllChampionships(-1, "Q", cbDelay.Checked);
                    break;
                case 3:
                case 4:
                    mainForm.getClient().getAllUsers("SQ", false);
                    break;
                case 5:
                case 6:
                    mainForm.getClient().getAllGames(false, -1, "SQ", false);
                    break;
                case 7:
                    mainForm.getClient().getAllChampionships(-1, "SQ", false);
                    break;
                case 8:
                    enableComponents(false, false);
                    mainForm.getClient().getPlayersGamesNum(cbDelay.Checked);
                    break;
                case 9:
                    enableComponents(false, false);
                    mainForm.getClient().getCitiesChampionshipsNum(cbDelay.Checked);
                    break;
            }
        }
Esempio n. 20
0
 private Control FindQueryControlPanel(QueryControl qc)
 {
     return(base.Controls.Cast <Control>().FirstOrDefault <Control>(c => (c.Tag == qc)));
 }
Esempio n. 21
0
        private void cbSubQuery_SelectedIndexChanged(object sender, EventArgs e)
        {
            ctrl = null;
            tableElementHost.Child = null;

            switch (cbQuery.SelectedIndex)
            {
                case 3:
                    if (subQueryObjects != null && subQueryObjects is PlayerData[] && cbSubQuery.SelectedIndex >= 0 && cbSubQuery.SelectedIndex < subQueryObjects.Length)
                    {
                        enableComponents(true, false);
                        int id = ((PlayerData)subQueryObjects[cbSubQuery.SelectedIndex]).Id;
                        mainForm.getClient().getAllGames(true, id, "Q", cbDelay.Checked);
                    }
                    break;
                case 4:
                    if (subQueryObjects != null && subQueryObjects is PlayerData[] && cbSubQuery.SelectedIndex >= 0 && cbSubQuery.SelectedIndex < subQueryObjects.Length)
                    {
                        enableComponents(true, true);
                        int id = ((PlayerData)subQueryObjects[cbSubQuery.SelectedIndex]).Id;
                        mainForm.getClient().getAllChampionships(id, "Q", cbDelay.Checked);
                    }
                    break;
                case 5:
                    if (subQueryObjects != null && subQueryObjects is GameData[] && cbSubQuery.SelectedIndex >= 0 && cbSubQuery.SelectedIndex < subQueryObjects.Length)
                    {
                        enableComponents(true, true);
                        mainForm.getClient().getGamePlayers((GameData)subQueryObjects[cbSubQuery.SelectedIndex], cbDelay.Checked);
                    }
                    break;
                case 6:
                    if (subQueryObjects != null && subQueryObjects is GameData[] && cbSubQuery.SelectedIndex >= 0 && cbSubQuery.SelectedIndex < subQueryObjects.Length)
                    {
                        enableComponents(true, true);
                        mainForm.getClient().getGameAdvisors((GameData)subQueryObjects[cbSubQuery.SelectedIndex], cbDelay.Checked);
                    }
                    break;
                case 7:
                    if (subQueryObjects != null && subQueryObjects is ChampionshipData[] && cbSubQuery.SelectedIndex >= 0 && cbSubQuery.SelectedIndex < subQueryObjects.Length)
                    {
                        enableComponents(true, true);
                        mainForm.getClient().getChampionshipPlayers((ChampionshipData)subQueryObjects[cbSubQuery.SelectedIndex], cbDelay.Checked);
                    }
                    break;
            }
        }
Esempio n. 22
0
 public void setGamesQuery(GameData[] games)
 {
     this.queryObjects = games;
     string[] titles = { "Id", "Player1_Name", "Player2_Name", "Winner_Name", "BoardSize", "StartTime", "EndTime" };
     string[] types = { "int", "char", "char", "char", "int", "datetime", "datetime" };
     bool[] readOnly = { true, false, false, false, true, false, false };
     bool[] nullable = { false, false, false, true, false, false, false };
     ctrl = new QueryControl(queryObjects, titles, types, readOnly, nullable);
     tableElementHost.Child = ctrl;
     ctrl.setSelectionType(cbDelType.SelectedIndex == 1);
 }
Esempio n. 23
0
        /// <summary>
        /// Event used from menus to shell any number of Shell based UserControls into windows.
        /// TODO Clean this function up, there's a lot of redundant code here.
        /// </summary>
        public static async Task ShellWindowAsync(string windowName)
        {
            // First see if an instance of this window already exists.
            var instance = App.Conveyor.WindowList.Find(x => x.Name == windowName);

            if (instance != null)
            {
                // Focus and activate the existing window.
                instance.Activate();
                return;
            }

            if (windowName == "Directions Select")
            {
                var win = new DirectionsSelectWindow
                {
                    Owner = App.MainWindow
                };

                win.ShowDialog();
            }
            else if (windowName == "Variables")
            {
                // Pass the variable list collection we want to bind to this control.
                var win = new Shell(new VariableList(App.Settings.ProfileSettings.Variables), null)
                {
                    Name        = "Variables",
                    HeaderTitle = "Variables",
                    HeaderIcon  = Symbol.Account,
                    SecondaryButtonVisibility = Visibility.Collapsed
                };

                win.SetSizeAndPosition(.85);
                win.Show();
            }
            else if (windowName == "Aliases")
            {
                var win = new Shell(new AliasList(), null)
                {
                    Name        = "Aliases",
                    HeaderTitle = "Aliases",
                    HeaderIcon  = Symbol.Account,
                    SecondaryButtonVisibility = Visibility.Collapsed
                };

                win.SetSizeAndPosition(.85);
                win.Show();
            }
            else if (windowName == "Macros")
            {
                var win = new Shell(new MacroList(), null)
                {
                    Name        = "Macros",
                    HeaderTitle = "Macros",
                    HeaderIcon  = Symbol.Keyboard,
                    SecondaryButtonVisibility = Visibility.Collapsed
                };

                win.SetSizeAndPosition(.85);
                win.Show();
            }
            else if (windowName == "Triggers")
            {
                var win = new Shell(new TriggerList(), null)
                {
                    Name        = "Triggers",
                    HeaderTitle = "Triggers",
                    HeaderIcon  = Symbol.Directions,
                    SecondaryButtonVisibility = Visibility.Collapsed
                };

                win.SetSizeAndPosition(.85);
                win.Show();
            }
            else if (windowName == "Directions")
            {
                var win = new Shell(new DirectionList(), null)
                {
                    Name        = "Directions",
                    HeaderTitle = "Directions",
                    HeaderIcon  = Symbol.Map,
                    SecondaryButtonVisibility = Visibility.Collapsed
                };

                win.SetSizeAndPosition(.85);
                win.Show();
            }
            else if (windowName == "Database")
            {
                try
                {
                    // Setup the database control.
                    var ctrl = new QueryControl
                    {
                        ConnectionString = $"Data Source={App.Settings.ProfileSettings.SqliteDatabase}",
                        Theme            = ControlTheme.Gray
                    };

                    ctrl.ExpandTableNode();
                    ctrl.ExpandViewsNode();

                    // Removed dialog/blur
                    //var win = new Shell(ctrl, App.MainWindow)

                    var win = new Shell(ctrl, null)
                    {
                        Name        = "Database",
                        HeaderTitle = "Database Query Editor",
                        HeaderIcon  = Symbol.Tag,
                        SecondaryButtonVisibility = Visibility.Collapsed
                    };

                    await ctrl.RefreshSchemaAsync();

                    win.SetSizeAndPosition(.85);
                    win.Show();
                    //App.MainWindow.ShowDialog(win);
                }
                catch (Exception ex)
                {
                    App.Conveyor.EchoLog(ex.Message, LogType.Error);
                }
            }
            else if (windowName == "PackageManager")
            {
                try
                {
                    var win = new Shell(new PackageManager(), null)
                    {
                        Name        = "PackageManager",
                        HeaderTitle = "Package Manager",
                        HeaderIcon  = Symbol.SyncFolder,
                        SecondaryButtonVisibility = Visibility.Collapsed
                    };

                    win.SetSizeAndPosition(.85);
                    win.Show();
                }
                catch (Exception ex)
                {
                    App.Conveyor.EchoLog(ex.Message, LogType.Error);
                }
            }
            else if (windowName == "UpdateDLLPlugin")
            {
                var confirmDialog = new UpdateDialog()
                {
                    PluginsOnly = true
                };

                _ = await confirmDialog.ShowAsync();

                App.MainWindow.Interp.Conveyor.EchoText("\r\n");
                App.MainWindow.Interp.Conveyor.EchoLog("In order for the plugin updates to take effect you will need to close and then restart this application.", LogType.Warning);
            }
        }
Esempio n. 24
0
 private HotKeyManager(MainForm f, QueryControl qc)
 {
     this._mainForm     = f;
     this._queryControl = qc;
 }