Beispiel #1
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
 }
        //Load Clouds in another thread
        private void backgroundWorkerLoadClouds_DoWork(object sender, DoWorkEventArgs e)
        {
            List <Cloud> clouds = databaseService.GetAllClouds();

            foreach (var c in clouds)
            {
                CloudControl control = new CloudControl();
                switch (c.cloudType)
                {
                case "dropbox":
                    try
                    {
                        CloudUserInfo cloudUserInfoDropBox = dropBoxController.GetAccountInfo(c.token);
                        control.LabelTotalSpace.Text = MyUtils.GetFormatedSpaceInGB(cloudUserInfoDropBox.total_space) + " GB";
                        control.LabelFreeSpace.Text  = MyUtils.GetFormatedSpaceInGB(cloudUserInfoDropBox.free_space) + " GB";
                        int progress = (int)((cloudUserInfoDropBox.used_space * 100) / cloudUserInfoDropBox.total_space);
                        control.SetAvaible(progress);
                    }
                    catch (Exception)
                    {
                        Logger.Log("Error loading clouds, please check internet connection!");
                    }
                    control.LabelCloudName.Text        = c.name;
                    control.PictureBoxCloudImage.Image = mainWindowinstance.ImageListClouds.Images[0];
                    control.LabelId.Text = c.id.ToString();
                    break;

                case "box":
                    try
                    {
                        CloudUserInfo cloudUserInfoBox = boxController.GetAccountInfo(c.token);
                        control.LabelTotalSpace.Text = MyUtils.GetFormatedSpaceInGB(cloudUserInfoBox.total_space) + " GB";
                        control.LabelFreeSpace.Text  = MyUtils.GetFormatedSpaceInGB(cloudUserInfoBox.free_space) + " GB";
                        int progress = (int)((cloudUserInfoBox.used_space * 100) / cloudUserInfoBox.total_space);
                        control.SetAvaible(progress);
                    }
                    catch (Exception)
                    {
                        Logger.Log("Error loading clouds, please check internet connection!");
                    }
                    control.LabelCloudName.Text        = c.name;
                    control.PictureBoxCloudImage.Image = mainWindowinstance.ImageListClouds.Images[1];
                    control.LabelId.Text = c.id.ToString();
                    break;
                }
                control.OnUserControlDeleteCloudButtonClicked += (s, eve) => DeleteCloudButtonClicked(s, eve);
                backgroundWorkerLoadClouds.ReportProgress(1, control);
            }
        }
        private void DataTimer_Tick(object sender, EventArgs e)
        {
            Console.WriteLine("定时器");
            BmobWindows bmobWindows = CloudServiceHelper.BmobBuilder();

            bmobWindows.Get <CloudControl>("CloudControl", "W2obDDDL", (result, ex) =>
            {
                if (ex == null)
                {
                    if (result.deployCollectOpened.Get())
                    {
                        PresetInfo.StartAutoCollect = true;
                        if (!isWorking)
                        {
                            isWorking = true;
                            _commPresenter.DeviceGatherStart(OperateType.Gather);
                        }
                        CloudControl cloudControl       = new CloudControl();
                        cloudControl.objectId           = "W2obDDDL";
                        cloudControl.cloudCollectOpened = true;

                        if (currentCollectNum == 0)
                        {
                            cloudControl.cloudCollectProgress = 0;
                        }
                        else
                        {
                            int value = currentCollectNum * 100 / currentCollectSumNum;
                            cloudControl.cloudCollectProgress = value;
                            Console.WriteLine("当前进度:" + value);
                        }
                        bmobWindows.UpdateTaskAsync(cloudControl);
                        Console.WriteLine("数据发送完毕");
                    }
                    else
                    {
                        PresetInfo.StartAutoCollect = false;
                        isWorking = false;
                    }
                }
            });
        }
Beispiel #4
0
        public FormMainWindow()
        {
            InitializeComponent();

            #region CLOUD CONTROL
            try
            {
                cloud             = new CloudControl();
                this.cloud.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                           | System.Windows.Forms.AnchorStyles.Left)
                                                                          | System.Windows.Forms.AnchorStyles.Right)));
                this.cloud.BorderStyle   = System.Windows.Forms.BorderStyle.None;
                this.cloud.Font          = new System.Drawing.Font("Verdana", 8, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.cloud.LayoutType    = Gma.CodeCloud.Controls.LayoutType.Spiral;
                this.cloud.Location      = new System.Drawing.Point(16, 16);
                this.cloud.BackColor     = Color.Beige;
                this.cloud.MaxFontSize   = 24;
                this.cloud.MinFontSize   = 8;
                this.cloud.Name          = "cloudControl";
                this.cloud.Palette       = new System.Drawing.Color[] { System.Drawing.Color.LightGray };
                this.cloud.Size          = new System.Drawing.Size(484, 500);
                this.cloud.TabIndex      = 6;
                this.cloud.WeightedWords = null;
                this.cloud.Click        += this.CloudControlClick;
                this.cloud.Enabled       = false;

                // this.cloud.Click += new System.EventHandler();

                this.Controls.Add(cloud);
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e.Message);
            }
            #endregion
            buildingCloud = false;

            core = new Core();
            core.InitListen();

            Type tp = tableLayoutPanel1.GetType().BaseType;
            System.Reflection.PropertyInfo pi =
                tp.GetProperty("DoubleBuffered",
                               System.Reflection.BindingFlags.Instance
                               | System.Reflection.BindingFlags.NonPublic);
            pi.SetValue(tableLayoutPanel1, true, null);

            // Map
            mapInit   = false;
            Argentina = new PointLatLng(-40.4, -63.6);
            InitMap();

            cloudWorker = new BackgroundWorker();

            worker                     = new BackgroundWorker();
            worker.DoWork             += new DoWorkEventHandler(core.StartStream);
            worker.RunWorkerCompleted += workCompleted;
            worker.RunWorkerAsync();

            ifaceTimer                     = new System.Timers.Timer();
            ifaceTimer.Interval            = core.TS_quick.TotalMilliseconds;
            ifaceTimer.Elapsed            += new System.Timers.ElapsedEventHandler(OnIFaceTimer);
            ifaceTimer.SynchronizingObject = this;
            ifaceTimer.Start();

            this.comboBoxTime.SelectedIndex = 0;
        }
Beispiel #5
0
 public WordCloudGenerator()
 {
     this.cloudControl = new CloudControl();
 }
Beispiel #6
0
        public FormMainWindow()
        {
            InitializeComponent();

            #region CLOUD CONTROL
            try
            {
                cloud = new CloudControl();
                this.cloud.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                            | System.Windows.Forms.AnchorStyles.Left)
                            | System.Windows.Forms.AnchorStyles.Right)));
                this.cloud.BorderStyle = System.Windows.Forms.BorderStyle.None;
                this.cloud.Font = new System.Drawing.Font("Verdana", 8, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.cloud.LayoutType = Gma.CodeCloud.Controls.LayoutType.Spiral;
                this.cloud.Location = new System.Drawing.Point(16, 16);
                this.cloud.BackColor = Color.Beige;
                this.cloud.MaxFontSize = 24;
                this.cloud.MinFontSize = 8;
                this.cloud.Name = "cloudControl";
                this.cloud.Palette = new System.Drawing.Color[] {  System.Drawing.Color.LightGray};
                this.cloud.Size = new System.Drawing.Size(484, 500);
                this.cloud.TabIndex = 6;
                this.cloud.WeightedWords = null;
                this.cloud.Click += this.CloudControlClick;
                this.cloud.Enabled = false;

                // this.cloud.Click += new System.EventHandler();

                this.Controls.Add(cloud);
            }
            catch (Exception e)
            {
                Console.Out.WriteLine(e.Message);
            }
            #endregion
            buildingCloud = false;

            core = new Core();
            core.InitListen();

            Type tp = tableLayoutPanel1.GetType().BaseType;
            System.Reflection.PropertyInfo pi =
                tp.GetProperty("DoubleBuffered",
                System.Reflection.BindingFlags.Instance
                | System.Reflection.BindingFlags.NonPublic);
            pi.SetValue(tableLayoutPanel1, true, null);

            // Map
            mapInit = false;
            Argentina = new PointLatLng(-40.4, -63.6);
            InitMap();

            cloudWorker = new BackgroundWorker();

            worker = new BackgroundWorker();
            worker.DoWork += new DoWorkEventHandler(core.StartStream);
            worker.RunWorkerCompleted += workCompleted;
            worker.RunWorkerAsync();

            ifaceTimer = new System.Timers.Timer();
            ifaceTimer.Interval = core.TS_quick.TotalMilliseconds;
            ifaceTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnIFaceTimer);
            ifaceTimer.SynchronizingObject = this;
            ifaceTimer.Start();

            this.comboBoxTime.SelectedIndex = 0;
        }