Exemplo n.º 1
0
        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections
            ServicePointManager.DefaultConnectionLimit = 12;

            bool result = base.OnStart();

            string id = RoleEnvironment.CurrentRoleInstance.Id;

            instanceID = "i";

            int pos1 = id.IndexOf("BusRole");

            if (pos1 >= 0)
            {
                instanceID = id.Substring(pos1 + "BusRole".Length + 1);
            }
            else
            {
                instanceID = id;
            }

            gvars.iid = instanceID.ToString();

            storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(Properties.Settings.Default.storage);

            ps = new PublicStore(storageAccount, "base");

            log = new log("base", "LogsServicebusWorker", storageAccount);

            l("BusRole has been started");

            return(result);
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            options.AutoComplete     = false;
            options.AutoRenewTimeout = TimeSpan.FromMinutes(1);

            Client.OnMessage((message) =>
            {
                try
                {
                    // Process message from subscription.
                    l("Echo: " + message.GetBody <string>());

                    // Remove message from subscription.
                    message.Complete();
                }
                catch (Exception)
                {
                    // Indicates a problem, unlock message in subscription.
                    message.Abandon();
                }
            }, options);

            new Thread(() =>
            {
                try
                {
                    l("Loading");
                    storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(Properties.Settings.Default.storage);

                    ps = new PublicStore(storageAccount, "base");

                    dlog = new log("base", "LogsAdminDebug", storageAccount);

                    this.Invoke((MethodInvoker) delegate()
                    {
                        this.toolStrip1.Visible = true;
                    });

                    g("Load successful");
                }
                catch (Exception ex1)
                {
                    ex(System.Reflection.MethodBase.GetCurrentMethod().Name + " " + ex1.ToString());
                }
            }).Start();
        }
Exemplo n.º 3
0
        private void Updater()
        {
            // Read the contents of testDialog's TextBox.
            l("Validating web credentials...");
            string s = "";

            this.Invoke((MethodInvoker) delegate()
            {
                s = channel.Cred(Properties.Settings.Default.webus, Properties.Settings.Default.webtok, gvars.lip);
            });

            if (s.Contains("error"))
            {
                ps  = null;
                log = null;

                el(s);
                el("Please update with valid web user and web token to continue.");

                this.Invoke((MethodInvoker) delegate()
                {
                    this.Text = "Infinity Tools - Not signed in";
                    this.signInToolStripMenuItem.Text      = "Sign In";
                    this.signInToolStripMenuItem.BackColor = Color.IndianRed;
                });
            }
            else
            {
                storageAccount = Microsoft.WindowsAzure.Storage.CloudStorageAccount.Parse(rehpis.Decrypt(s, Properties.Settings.Default.webus));

                ps = new PublicStore(storageAccount, Properties.Settings.Default.webus);

                log = new log(Properties.Settings.Default.webus, "LogsLocalTools", storageAccount);
                lS(Properties.Settings.Default.webus + " authenticated");
                g("Credentials validated.");
                this.Invoke((MethodInvoker) delegate()
                {
                    this.Text = "Infinity Tools - Signed in";
                    this.signInToolStripMenuItem.Text      = "Signed In";
                    this.signInToolStripMenuItem.BackColor = Color.Green;
                });
            }
        }