Ejemplo n.º 1
0
        void OnPlayClicked(object o, EventArgs e)
        {
            ConnectForm  form   = new ConnectForm();
            DialogResult result = form.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                return;
            }

            Client client = new Client(form);

            AddScene(new GameScene(client));
        }
Ejemplo n.º 2
0
 private void btnPartFind_Click(object sender, EventArgs e)
 {
     client = Common.Util.Service;
     draw   = Common.Util.Drawing;
     if (draw != null)
     {
         ConnectForm f = new ConnectForm(Common.Util.paramsEntity(draw), CommonUntils.RelationType.ALL);
         f.ShowDialog();
     }
     else
     {
         MessageBox.Show("图纸对象为空!");
     }
 }
Ejemplo n.º 3
0
        private void Connect()
        {
            ConnectForm connectForm = new ConnectForm();

            if (connectForm.ShowDialog() == DialogResult.OK)
            {
                DataContext     = connectForm.DataContext;
                DataContext.Log = logViewer.TextBoxWriter;

                ProgressDialog = new ProgressDialog(false);
                initializeBackgroundWorker.RunWorkerAsync();
                ProgressDialog.ShowDialog(this);
            }
        }
Ejemplo n.º 4
0
        private ConnectionResponse AcceptCallback(IPEndPoint iPEndPoint, ConnectionData connectionData)
        {
            if (InvokeRequired)
            {
                return(Invoke(() => AcceptCallback(iPEndPoint, connectionData)));
            }

            bool result = false;
            var  c      = new ConnectForm(iPEndPoint, connectionData);

            c.ConnectCallback = () => result = true;
            c.ShowDialog(this);

            return(new ConnectionResponse(result, connectionData));
        }
Ejemplo n.º 5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var cf = new ConnectForm();
            var dr = cf.ShowDialog();

            if (dr != DialogResult.OK)
            {
                Application.Exit();
            }
            connection = cf.Connection;
            tv.BeginUpdate();
            var command = connection.CreateCommand();

            command.CommandText = Database.GetRootNodes;
            command.CommandType = CommandType.StoredProcedure;
            using (var reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    tv.Nodes.Add(reader[0].ToString(),
                                 NodeText(reader[0], reader[1]));
                    parents.Add((Int16)reader[0]);
                }
            }
            command.CommandText = Database.GetChildNodes;
            command.Parameters.Add(ProcParam.Parent, SqlDbType.SmallInt);
            TreeNode[] tn;
            while (parents.Count > 0)
            {
                command.Parameters[0].Value = parents[0];
                tn = tv.Nodes.Find(parents[0].ToString(), true);
                if (tn.Length > 0)
                {
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            tn[0].Nodes.Add(reader[0].ToString(),
                                            NodeText(reader[0], reader[1]));
                            parents.Add(reader.GetInt16(0));
                        }
                    }
                    parents.RemoveAt(0);
                }
            }
            tv.EndUpdate();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Launching client window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            var connectForm = new ConnectForm();
            if (connectForm.ShowDialog() != true)
                return;
            var chatClient = new ChatClient(connectForm.PortNumber, connectForm.IpAddress, connectForm.UserName);
            if (!chatClient.IsConnected)
            {
                Current.Shutdown();
                return;
            }

            RegistryHelper.Read(chatClient);

            var clientForm = new ClientWindow(chatClient);
            clientForm.Show();
        }
Ejemplo n.º 7
0
        private void ShowConnectionForm()
        {
            foreach (Form form in Application.OpenForms)
            {
                if (form.GetType() == typeof(ConnectForm))
                {
                    form.Activate();
                    return;
                }
            }

            ConnectForm settingsForm = new ConnectForm()
            {
                MdiParent = this
            };

            settingsForm.Show();
        }
Ejemplo n.º 8
0
        private void connectButton_Click(object sender, EventArgs e)
        {
            using (var cf = new ConnectForm())
            {
                if (_connectionInfo != null)
                {
                    cf.Server  = _connectionInfo.DataSource;
                    cf.SQLAuth = !_connectionInfo.IntegratedSecurity;
                    if (cf.SQLAuth)
                    {
                        cf.UserName = _connectionInfo.UserID;
                        cf.Password = _connectionInfo.Password;
                    }
                }
                if (cf.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                _connectionInfo = new SqlConnectionStringBuilder
                {
                    DataSource         = cf.Server,
                    IntegratedSecurity = !cf.SQLAuth
                };
                if (cf.SQLAuth)
                {
                    _connectionInfo.UserID   = cf.UserName;
                    _connectionInfo.Password = "******";
                }
                connectionLabel.Text = _connectionInfo.ConnectionString;
                if (cf.SQLAuth)
                {
                    _connectionInfo.Password = cf.Password;
                }

                if (_connection != null && _connection.State == ConnectionState.Open)
                {
                    _connection.Close();
                }
                _connection = new SqlConnection(_connectionInfo.ConnectionString);
                _connection.Open();

                autoRefreshCheckBox.Enabled = secNumericUpDown.Enabled = true;
            }
        }
Ejemplo n.º 9
0
        public void Database_Connect()
        {
            if (DiscardChangesCheck())
            {
                return;
            }

            if (ConnectForm.Show() == DialogResult.Cancel)
            {
                return;
            }

            switch (ConnectForm.LocalInstanceType)
            {
            case EmbeddedInstanceType.None:
                if (SelectDatabaseForm.Show(ConnectForm.Server) == DialogResult.Cancel)
                {
                    return;
                }
                break;

            case EmbeddedInstanceType.PowerBI:
                if (Preferences.Current.AllowUnsupportedPBIFeatures)
                {
                    MessageBox.Show("Experimental Power BI features is enabled. You can edit any object and property of this Power BI Desktop model, but be aware that many types of changes ARE NOT CURRENTLY SUPPORTED by Microsoft.\n\nKeep a backup of your .pbix file and proceed at your own risk.", "Power BI Desktop Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                break;

            case EmbeddedInstanceType.Devenv:
                MessageBox.Show("You are connecting to an integrated workspace in Visual Studio.\n\nChanges made through Tabular Editor may not be properly persisted to the Tabular Project in Visual Studio and may corrupt your model file.\n\nMake sure to keep a backup of the Model.bim file and proceed at your own risk.", "Connecting to embedded model", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;
            }

            UI.StatusLabel.Text = "Opening Model from Database...";
            ClearUI();
            UpdateUIText();

            Database_Open(ConnectForm.ConnectionString,
                          string.IsNullOrEmpty(ConnectForm.LocalInstanceName) ? SelectDatabaseForm.DatabaseName : null);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Launching client window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
            var connectForm = new ConnectForm();

            if (connectForm.ShowDialog() != true)
            {
                return;
            }
            var chatClient = new ChatClient(connectForm.PortNumber, connectForm.IpAddress, connectForm.UserName);

            if (!chatClient.IsConnected)
            {
                Current.Shutdown();
                return;
            }

            RegistryHelper.Read(chatClient);

            var clientForm = new ClientWindow(chatClient);

            clientForm.Show();
        }
        public void Database_Connect()
        {
            if (DiscardChangesCheck())
            {
                return;
            }

            if (ConnectForm.Show() == DialogResult.Cancel)
            {
                return;
            }

            switch (ConnectForm.LocalInstanceType)
            {
            case EmbeddedInstanceType.None:
                if (SelectDatabaseForm.Show(ConnectForm.Server) == DialogResult.Cancel)
                {
                    return;
                }
                break;

            case EmbeddedInstanceType.PowerBI:
                MessageBox.Show("You are connecting to a Tabular model in Power BI Desktop.\n\nTabular Editor uses the TOM to make changes to the model, which is UNSUPPORTED and could corrupt your .pbix file.\n\nPower BI Desktop will not synchronize the user interface with the changes you apply to the model until you manually refresh the model in Power BI Desktop.\n\nMake sure to keep a backup of the .pbix file, and proceed at your own risk.", "Connecting to embedded model", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;

            case EmbeddedInstanceType.Devenv:
                MessageBox.Show("You are connecting to an integrated workspace in Visual Studio.\n\nChanges made through Tabular Editor may not be properly persisted to the Tabular Project in Visual Studio and may corrupt your model file.\n\nMake sure to keep a backup of the Model.bim file and proceed at your own risk.", "Connecting to embedded model", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                break;
            }

            UI.StatusLabel.Text = "Opening Model from Database...";
            ClearUI();
            UpdateUIText();

            Database_Open(ConnectForm.ConnectionString,
                          string.IsNullOrEmpty(ConnectForm.LocalInstanceName) ? SelectDatabaseForm.DatabaseID : null);
        }
Ejemplo n.º 12
0
 private void btnPartFind_Click(object sender, EventArgs e)
 {
     client = Common.Util.Service;
     draw = Common.Util.Drawing;
     if (draw != null)
     {
         ConnectForm f = new ConnectForm(Common.Util.paramsEntity(draw), CommonUntils.RelationType.ALL);
         f.ShowDialog();
     }
     else
     {
         MessageBox.Show("图纸对象为空!");
     }
 }
Ejemplo n.º 13
0
        public bool LaunchProcess(string args, CommandDialog cd, bool bShowProgress = false, string sDestination = "")
        {
            try
            {
                strMessage = string.Empty;
                Process build = new Process();

                Thread thDialog = null;
                if (bShowProgress)
                {
                    if (cd == CommandDialog.Copy)
                    {
                        if (pf == null)
                        {
                            pf = new ProgressForm();
                        }
                        pf.SetProcess(build);
                        pf.SetProgress(string.Empty, 0, sDestination);
                        thDialog = new Thread(() => ThreadProcCopy());
                        thDialog.Start();
                    }
                    else if (cd == CommandDialog.Connect)
                    {
                        if (cf == null)
                        {
                            cf = new ConnectForm();
                        }
                        DeviseAddr addr = new DeviseAddr();
                        if (!string.IsNullOrEmpty(addr.ConnectionType) && addr.ConnectionType.Equals("usb") &&
                            !string.IsNullOrEmpty(addr.UsbDevice))
                        {
                            cf.SetIP(addr.UsbDevice);
                        }
                        else
                        {
                            cf.SetIP(addr.ToString());
                        }

                        thDialog = new Thread(() => ThreadProcConnect());
                        thDialog.Start();
                    }
                    else if (cd == CommandDialog.CreateScreenShot)
                    {
                        if (of == null)
                        {
                            of = new OperationForm(OperationForm.TypeOp.CreateScreenShot);
                        }
                        of.SetOperation("Creating ScreenShot");
                        thDialog = new Thread(() => ThreadProcOperation());
                        thDialog.Start();
                    }
                    else if (cd == CommandDialog.Install)
                    {
                        if (of == null)
                        {
                            of = new OperationForm(OperationForm.TypeOp.Install);
                        }
                        of.SetOperation("Install " + args.Substring(args.LastIndexOf("\\") + 1).TrimEnd('\"'));
                        thDialog = new Thread(() => ThreadProcOperation());
                        thDialog.Start();
                    }
                    else if (cd == CommandDialog.Delete)
                    {
                        if (of == null)
                        {
                            of = new OperationForm(OperationForm.TypeOp.Delete);
                        }
                        of.SetOperation("Deleting");
                        thDialog = new Thread(() => ThreadProcOperation());
                        thDialog.Start();
                    }
                }

                build.StartInfo.WorkingDirectory = Path.GetDirectoryName(FindADB());

                if (string.IsNullOrEmpty(build.StartInfo.WorkingDirectory))
                {
                    if (bShowProgress && pf != null)
                    {
                        pf.SetProgress(string.Empty, 0);
                        pf.InternalCloseDialog();
                        pf = null;
                    }
                    if (bShowProgress && cf != null)
                    {
                        cf.InternalCloseDialog();
                        cf = null;
                    }
                    if (bShowProgress && of != null)
                    {
                        of.InternalCloseDialog();
                        of = null;
                    }
                    strMessage = "Can not find adb.exe";
                    return(false);
                }

                build.StartInfo.FileName  = FindADB();
                build.StartInfo.Arguments = args;

                build.StartInfo.UseShellExecute        = false;
                build.StartInfo.RedirectStandardOutput = true;
                build.StartInfo.RedirectStandardError  = true;
                build.StartInfo.CreateNoWindow         = true;
                build.ErrorDataReceived  += build_ErrorDataReceived;
                build.OutputDataReceived += build_ErrorDataReceived;
                build.EnableRaisingEvents = true;
                build.Start();
                build.BeginOutputReadLine();
                build.BeginErrorReadLine();
                build.WaitForExit();

                if (bShowProgress)
                {
                    if (cd == CommandDialog.Copy)
                    {
                        if (build.ExitCode < 0)
                        {
                            if (!string.IsNullOrEmpty(sDestination))
                            {
                                if (File.Exists(sDestination))
                                {
                                    File.Delete(sDestination);
                                }
                                else if (Directory.Exists(sDestination))
                                {
                                    //Directory.Delete(sDestination, true);
                                }
                            }
                        }

                        if (pf != null)
                        {
                            pf.SetProgress(string.Empty, 0);
                            pf.InternalCloseDialog();
                            pf = null;
                        }
                    }
                    else if (cd == CommandDialog.Connect)
                    {
                        cf.InternalCloseDialog();
                        cf = null;
                    }
                    else if (cd == CommandDialog.CreateScreenShot || cd == CommandDialog.Delete || cd == CommandDialog.Install)
                    {
                        of.InternalCloseDialog();
                        of = null;
                    }
                }

                return(true);
            }
            catch (Exception e)
            {
                if (bShowProgress)
                {
                    if (cd == CommandDialog.Copy)
                    {
                        if (pf != null)
                        {
                            pf.SetProgress(string.Empty, 0);
                            pf.InternalCloseDialog();
                            pf = null;
                        }
                    }
                    else if (cd == CommandDialog.Connect)
                    {
                        cf.InternalCloseDialog();
                        cf = null;
                    }
                    else if (cd == CommandDialog.CreateScreenShot || cd == CommandDialog.Delete)
                    {
                        of.InternalCloseDialog();
                        of = null;
                    }
                }

                strMessage = e.Message;
                return(false);
            }
        }