Exemple #1
0
        public ProgressItem()
        {
            ProgressBar = new ProgressBar();
            Label       = new Label();
            ToolTip     = new ToolTip();

            DoubleBuffered = true;

            Label.UseMnemonic  = false;
            Label.AutoSize     = false;
            Label.Dock         = DockStyle.Top;
            Label.TextAlign    = ContentAlignment.MiddleCenter;
            Label.Padding      = new Padding(3, 0, 0, 3);
            ProgressBar.Style  = ProgressBarStyle.Continuous;
            ProgressBar.Dock   = DockStyle.Fill;
            ProgressBar.Margin = new Padding(0, 0, 0, 0);

            Controls.Add(Label);
            Controls.Add(ProgressBar);

            ProgressBar.BringToFront();

            Padding = new Padding(0, 0, 0, 0);
            Margin  = new Padding(0, 0, 0, 0);

            AutoResize();
        }
Exemple #2
0
        //disable CS0618, "This method is obsolete on Android". CookieSyncManager.CreateInstance is causing it, but we need it on older Android versions.
#pragma warning disable 0618
        public WebLayout(global::Android.Content.Context context) : base(context)
        {
            // required for pre-21 android
            CookieSyncManager.CreateInstance(context.ApplicationContext);

            CookieManager.Instance.RemoveAllCookie( );

            WebView = new WebView(context.ApplicationContext);
            //WebView = new WebView( context );
            WebView.Settings.SaveFormData = false;

            WebView.ClearFormData( );
            WebView.SetWebViewClient(new WebViewLayoutClient( )
            {
                Parent = this
            });
            WebView.Settings.JavaScriptEnabled = true;
            WebView.Settings.SetSupportZoom(true);
            WebView.Settings.BuiltInZoomControls  = true;
            WebView.Settings.LoadWithOverviewMode = true; //Load 100% zoomed out
            WebView.ScrollBarStyle         = ScrollbarStyles.OutsideOverlay;
            WebView.ScrollbarFadingEnabled = true;

            WebView.VerticalScrollBarEnabled   = true;
            WebView.HorizontalScrollBarEnabled = true;
            AddView(WebView);

            ProgressBar = new ProgressBar(context);
            ProgressBar.Indeterminate = true;
            ProgressBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0));
            ProgressBar.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
            ((RelativeLayout.LayoutParams)ProgressBar.LayoutParameters).AddRule(LayoutRules.CenterInParent);
            AddView(ProgressBar);
            ProgressBar.BringToFront();
        }
Exemple #3
0
        private void ShowProgressBar()
        {
            Rectangle rect = System.Windows.Forms.SystemInformation.VirtualScreen;//获取屏幕高度,宽度

            _progressBarExcelExport.Minimum = 0;
            _progressBarExcelExport.Maximum = 100;
            _panelBack.Top    = 0;
            _panelBack.Left   = 0;
            _panelBack.Width  = this.Width;
            _panelBack.Height = this.Height;
            _progressBarExcelExport.SetBounds((this.Width - this.Width / 2) / 2, this.Height / 2 - 50, this.Width / 2, 30);
            _progressBarExcelExport.BackColor = Color.Green;
            _panelBack.BringToFront();
            _lblCaption.BringToFront();
            _progressBarExcelExport.BringToFront();
            _lblCaption.Left = _progressBarExcelExport.Left + 15;
            _lblCaption.Top  = _progressBarExcelExport.Top - 17;

            _progressBarExcelExport.Show();

            //写入数值
            _panelBack.Show();
            panel.Hide();
            Application.DoEvents();
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Create your application here
			SetContentView(Resource.Layout.produtos);

			edPesquisa = FindViewById<TextView>(Resource.Id.edtpesquisa);
			lstProdutoView = FindViewById<ListView> (Resource.Id.ListaProduto);
			mContainer = FindViewById<LinearLayout>(Resource.Id.llContainer);
			mProgressBar = FindViewById<ProgressBar>(Resource.Id.progressBar);
			mCabecalhoProduto = FindViewById<TextView> (Resource.Id.txxCabecalhoProduto);

			mWorker = new BackgroundWorker();

			edPesquisa.Alpha = 0;

			mContainer.BringToFront ();
			mProgressBar.BringToFront ();

			mProgressBar.Visibility = ViewStates.Visible;

			mUrl = new Uri("http://192.168.0.103/rest1/getprodutos.php?nome=VINHO");

			mClient = new WebClient();
			mClient.DownloadDataAsync(mUrl);
			mClient.DownloadDataCompleted += mClient_DownloadDataCompleted;

			mCabecalhoProduto.Click += MCabecalhoProduto_Click;
			edPesquisa.TextChanged += edPesquisa_TextChange;

		
		}
Exemple #5
0
                void SyncUI( )
                {
                    // based on the player state, configure our UI
                    switch (PlayerState)
                    {
                    case MediaPlayerState.Preparing:
                    case MediaPlayerState.WantsAutoplay:
                    {
                        ProgressBar.Visibility = ViewStates.Visible;
                        ProgressBar.BringToFront( );

                        if (MediaControllerPrepared == true)
                        {
                            MediaController.Hide( );
                        }
                        break;
                    }

                    case MediaPlayerState.Stopped:
                    case MediaPlayerState.Playing:
                    {
                        // hide the progress bar
                        ProgressBar.Visibility = ViewStates.Gone;

                        if (MediaControllerPrepared == true)
                        {
                            MediaController.Show( );
                        }
                        break;
                    }
                    }
                }
 private void ShowProgressBar(int rowCount)
 {
     progressBar         = new ProgressBar();
     progressBar.Maximum = rowCount - 6;
     progressBar.Anchor  = (AnchorStyles.Bottom | AnchorStyles.Left);
     panel.Controls.Add(progressBar);
     progressBar.Location = new Point(postepLabel.Location.X, panel.Size.Height - 35);
     progressBar.Size     = new Size(panel.Size.Width - 15, 20);
     progressBar.BringToFront();
 }
Exemple #7
0
 private static void MoveProgressBar(ProgressBar progress, LinkLabel refCtrl)
 {
     progress.BringToFront();
     progress.Location = progress.Parent.PointToClient(
         refCtrl.PointToScreen(new Point(
                                   refCtrl.Width - progress.Width - progress.Margin.Right,
                                   refCtrl.Height - progress.Height - progress.Margin.Bottom
                                   ))
         );
 }
Exemple #8
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);

            if (ProgressBar != null)
            {
                int height = MainActivity.Dip2Px(8);
                ProgressBar.BringToFront();
                ProgressBar.Layout(0, Toolbar.Height - height, r, Toolbar.Height + height);
            }
        }
Exemple #9
0
        private void addGoal()
        {
            if (org.DonationGoal.Target != 0)
            {
                goalProgress = new ProgressBar
                {
                    Maximum = (int)org.DonationGoal.Target
                };

                dbr_Info.Controls.Add(goalProgress);
                goalProgress.BringToFront();
            }
            updateGoal();
        }
Exemple #10
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            BackWorker                     = new BackgroundWorker();
            BackWorker.DoWork             += BackWorker_DoWork;
            BackWorker.RunWorkerCompleted += BackWorker_RunWorkerCompleted;

            Progress       = new ProgressBar();
            Progress.Style = ProgressBarStyle.Marquee;
            Progress.MarqueeAnimationSpeed = 10;
            this.Controls.Add(Progress);
            Progress.Visible = false;
            Progress.BringToFront();
        }
Exemple #11
0
        public Boss(Form form, PictureBox target)
        {
            tmDeath.Interval = 600;
            tmDeath.Tick    += new EventHandler(tmDeath_Tick);
            health           = MAX_HEALTH;
            speed            = 2;

            boss          = new PictureBox();
            boss.Image    = Properties.Resources.normalboss;
            boss.SizeMode = PictureBoxSizeMode.Zoom;
            boss.Size     = new System.Drawing.Size(100, 100);
            boss.Tag      = "boss";

            int midPosition = form.Width / 2;

            #region Boss's Respawn Place

            if (target.Left < form.Left + midPosition)
            {
                boss.Left = form.Left + form.Width;
                boss.Tag  = "rightboss";
            }
            else
            {
                boss.Left = form.Left;
                boss.Tag  = "leftboss";
            }

            boss.Top = form.Top + form.Height / 2;

            #endregion


            #region Setting Up HealthBar

            healthBar           = new ProgressBar();
            healthBar.Maximum   = MAX_HEALTH;
            healthBar.Minimum   = MIN_HEALTH;
            healthBar.Tag       = "bosshealthbar";
            healthBar.ForeColor = System.Drawing.Color.DarkBlue;


            #endregion

            form.Controls.Add(boss);
            form.Controls.Add(healthBar);
            healthBar.BringToFront();
        }
Exemple #12
0
        private async void DisplayListAsync(List <PC> Listed)
        {
            if (OBJects.Count > 0)
            {
                foreach (var elem in OBJects)
                {
                    this.Controls.Remove(elem);
                    elem.Dispose();
                }

                OBJects.Clear();
            }

            var Y = (int)(88 * ScaleControls.Scale);

            this.Refresh();
            ProgressBar.Value   = 0;
            ProgressBar.Visible = true;
            int oneElementPercentage = 100 / Listed.Count;
            int deltaY = (int)(230 * ScaleControls.Scale);

            foreach (var pc in Listed)
            {
                int _percentage = 0;
                await Task.Delay(15);

                while (_percentage != oneElementPercentage)
                {
                    _percentage++;
                    ProgressBar.Value++;
                }

                PCinfo OBJ = new PCinfo(pc)
                {
                    isAdmin = true
                };
                OBJects.Add(OBJ);
                OBJ.Location  = new Point(0, Y);
                Y            += deltaY;
                OBJ.BackColor = Theme == MetroThemeStyle.Dark ? Color.FromArgb(23, 23, 26) : Color.White;
                OBJ.Anchor    = AnchorStyles.Top;
                this.Controls.Add(OBJ);
                ProgressBar.BringToFront();
            }
            ProgressBar.Enabled = false;
            ProgressBar.Visible = false;
        }
Exemple #13
0
        protected override void OnLoad(EventArgs e)
        {
            //_externalFlag = false;
            if (_loadingInfo == null)
            {
                return;
            }

            _lbl = new Label
            {
                Font        = new Font("Microsoft Sans Serif", 8, FontStyle.Regular),
                BorderStyle = BorderStyle.None,
                BackColor   = Color.FromArgb(225, 225, 225),
                ForeColor   = Color.Black,
                TextAlign   = ContentAlignment.MiddleLeft,
                Width       = 300,
                Height      = 50
            };

            Controls.Add(_lbl);
            _lbl.Dock = DockStyle.Top;

            _loadingProgressBar          = new ProgressBar();
            _loadingProgressBar.Location = new Point(10, 60);
            _loadingProgressBar.Width    = Width - 30;
            _loadingProgressBar.Maximum  = ProgressMax;
            _loadingProgressBar.Minimum  = 0;
            _loadingProgressBar.Value    = 0;
            _loadingProgressBar.Style    = ProgressBarStyle.Marquee;
            _loadingProgressBar.MarqueeAnimationSpeed = 30;

            Controls.Add(_loadingProgressBar);
            _loadingProgressBar.BringToFront();

            Task.Factory.StartNew(() => { UpdateWaiting(); });

            base.OnLoad(e);
        }
Exemple #14
0
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    if (container == null)
                    {
                        // Currently in a layout without a container, so no reason to create our view.
                        return(null);
                    }

                    MediaController = new MediaController(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                    RelativeLayout view = new RelativeLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                    view.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
                    view.SetBackgroundColor(Android.Graphics.Color.Black);
                    view.SetOnTouchListener(this);

                    VideoPlayer = new VideoView(Activity);
                    VideoPlayer.SetMediaController(MediaController);
                    VideoPlayer.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                    ((RelativeLayout.LayoutParams)VideoPlayer.LayoutParameters).AddRule(LayoutRules.CenterInParent);

                    ((view as RelativeLayout)).AddView(VideoPlayer);

                    VideoPlayer.SetOnPreparedListener(this);
                    VideoPlayer.SetOnErrorListener(this);

                    ProgressBar = new ProgressBar(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                    ProgressBar.Indeterminate = true;
                    ProgressBar.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(0));
                    ProgressBar.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                    ((RelativeLayout.LayoutParams)ProgressBar.LayoutParameters).AddRule(LayoutRules.CenterInParent);
                    view.AddView(ProgressBar);
                    ProgressBar.BringToFront();

                    ResultView = new UIResultView(view, new System.Drawing.RectangleF(0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels), delegate { TryPlayMedia( ); });

                    return(view);
                }
        public void BeginLoading(double timeOut = 0)
        {
            lock (syncObject)
            {
                if (!isLoading)
                {
                    this.Invoke(new Action(() =>
                    {
                        isLoading = true;
                        if (progressBar == null)
                        {
                            progressBar = new ProgressBar();
                            progressBar.MarqueeAnimationSpeed = 10;
                            progressBar.MinimumSize           = new Size(150, 23);
                            progressBar.Size = new Size(150, 23);
                            //int x = (int)(0.5 * (this.Width - progressBar.Width));
                            //int y = (int)(0.5 * (this.Height - progressBar.Height));
                            progressBar.Dock = DockStyle.Bottom;
                            //progressBar.Location = new Point(x, y);
                            //progressBar.Anchor = AnchorStyles.Top;
                            this.Controls.Add(progressBar);
                        }

                        if (timeOut != 0)
                        {
                            timer.Interval = timeOut;
                            timer.Start();
                        }
                        this.Cursor         = Cursors.WaitCursor;
                        progressBar.Enabled = true;
                        progressBar.Style   = ProgressBarStyle.Marquee;
                        progressBar.BringToFront();
                        this.BringToFront();
                    }));
                }
            }
        }
                public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
                {
                    if (container == null)
                    {
                        // Currently in a layout without a container, so no reason to create our view.
                        return null;
                    }

                    MediaController = new MediaController( Rock.Mobile.PlatformSpecific.Android.Core.Context );

                    RelativeLayout view = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    view.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    view.SetBackgroundColor( Android.Graphics.Color.Black );
                    view.SetOnTouchListener( this );

                    VideoPlayer = new VideoView( Activity );
                    VideoPlayer.SetMediaController( MediaController );
                    VideoPlayer.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent );
                    ( (RelativeLayout.LayoutParams)VideoPlayer.LayoutParameters ).AddRule( LayoutRules.CenterInParent );

                    ( ( view as RelativeLayout ) ).AddView( VideoPlayer );

                    VideoPlayer.SetOnPreparedListener( this );
                    VideoPlayer.SetOnErrorListener( this );

                    ProgressBar = new ProgressBar( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    ProgressBar.Indeterminate = true;
                    ProgressBar.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( 0 ) );
                    ProgressBar.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (RelativeLayout.LayoutParams)ProgressBar.LayoutParameters ).AddRule( LayoutRules.CenterInParent );
                    view.AddView( ProgressBar );
                    ProgressBar.BringToFront();

                    ResultView = new UIResultView( view, new System.Drawing.RectangleF( 0, 0, NavbarFragment.GetFullDisplayWidth( ), this.Resources.DisplayMetrics.HeightPixels ), delegate { TryPlayMedia( ); } );

                    return view;
                }
Exemple #17
0
        public static void proba(Form form)
        {
            ProgressBar proBar = new ProgressBar();

            //proBar.Location = new System.Drawing.Point(547, 407);
            proBar.Name     = "progressBar1";
            proBar.Size     = new System.Drawing.Size(315, 19);
            proBar.Location = new Point((form.Width - proBar.Width) / 2, form.Height / 2);
            //proBar.TabIndex = 9;
            form.Controls.Add(proBar);
            proBar.BringToFront();

            proBar.Minimum = 1;
            proBar.Maximum = 1000000;
            proBar.Step    = 1;
            proBar.Style   = ProgressBarStyle.Blocks;
            proBar.Visible = true;
            for (int i = 1; i < 1000000; i++)
            {
                proBar.Value = i;
            }
            proBar.Visible = false;
            form.Controls.Remove(proBar);
        }
Exemple #18
0
        public Video(Panel Cont, string data, bridge back_ref)
        {
            back = back_ref;


            props = data.Split('^');



            r1 = new Panel();

            img_scr = new WebBrowser();
            dwn_btn = new Button();
            name    = new Label();
            r2      = new Panel();
            lvl     = new ProgressBar();



            lvl.Height = 10;
            lvl.BringToFront();
            lvl.Value = 0;
            lvl.Dock  = DockStyle.Bottom;
            lvl.Hide();

            r1.BackColor = Color.FromArgb(50, 50, 50);


            r1.Left            = 20 + (x * 20) + (x++ *280);
            r1.Top             = 20 + (y * 20) + (y * 200);
            r1.Width           = 280;
            r1.Height          = 200;
            r2.Height          = 50;
            dwn_btn.Width      = 45;
            dwn_btn.Image      = n_tube.Properties.Resources.download_32px;
            dwn_btn.ImageAlign = ContentAlignment.MiddleCenter;
            dwn_btn.FlatStyle  = FlatStyle.Flat;
            dwn_btn.BackColor  = Color.Black;


            name.Text      = props[1];
            name.ForeColor = Color.White;
            name.Width     = 230;
            name.Padding   = new Padding(5);
            name.Dock      = DockStyle.Left;


            img_scr.Height            = 150;
            img_scr.ScrollBarsEnabled = false;
            img_scr.Dock = DockStyle.Top;
            r2.Dock      = DockStyle.Bottom;
            dwn_btn.Dock = DockStyle.Right;

            //img_scr.Url = new Uri(props[2]);

            img_scr.DocumentText = "<style> " +
                                   "body { " +
                                   "margin: 0; " +
                                   "padding: 0; " +
                                   "} " +
                                   "img {" +
                                   "width: 20px" +
                                   "height: 10px" +
                                   "}" +
                                   "</style> " +
                                   $"<img src='{props[2]}' />";

            Cont.Controls.Add(r1);
            r1.BringToFront();
            r1.Controls.Add(img_scr);
            r1.Controls.Add(r2);
            r2.Controls.Add(dwn_btn);
            r2.Controls.Add(name);
            r2.Controls.Add(lvl);

            if (x == 2)
            {
                x = 0;
                y++;
            }

            dwn_btn.Click += new EventHandler(dwn_btn_Click);
        }
Exemple #19
0
        private void textBoxSeriliBarkod_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            string barokd = "";
            string depo   = "";
            string ddepo  = "";

            barokd = textBoxBarkod.Text.Trim().Replace("\r\n", "")
                     .Replace("\n\r", "").Replace("\n", "").Replace("\r", "");

            depo = textBoxSeriliBarkod.Text.Trim().Replace("\r\n", "")
                   .Replace("\n\r", "").Replace("\n", "").Replace("\r", "");

            ddepo = textDepo.Text.Trim().Replace("\r\n", "")
                    .Replace("\n\r", "").Replace("\n", "").Replace("\r", "");


            try
            {
                if (e.KeyChar == 13 || e.KeyChar == 17)
                {
                    if (depo == "")
                    {
                        Utility.Engine.Hata("Seri Barkodu Okutun");
                        textBoxSeriliBarkod.Focus();
                        return;
                    }
                    if (comboBoxEkleSil.SelectedItem == null)
                    {
                        Utility.Engine.Hata("Seri Islemi Secin <EKLE> <SIL>");
                        comboBoxEkleSil.Focus();
                        return;
                    }
                    if (barokd == "")
                    {
                        Utility.Engine.Hata("Palet Barkodu Okutun!");
                        textBoxBarkod.Focus();
                        return;
                    }

                    double dib = 0;
                    int    r   = 0;

                    depo = Utility.Engine.SqlTemizle(depo).ToUpper();

                    Utility.Engine.sql = string.Format("EXEC sevk.PaletTransfer N'{0}', N'{1}', N'{2}', N'{3}'",
                                                       Utility.Engine.SqlTemizle(barokd.ToUpper()),
                                                       Utility.Engine.SqlTemizle(depo).ToUpper(),
                                                       ddepo, Utility.Engine.KullaniciID);

                    DataTable dt = new DataTable();
                    Utility.Engine.dat.TableDoldur(Utility.Engine.sql, ref dt);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        try
                        {
                            if (dt.Rows.Count > 0)
                            {
                                if (dt.Rows[0][0].ToString().Trim().Equals("HATA"))
                                {
                                    MessageBox.Show(dt.Rows[0][1].ToString().Trim(), "Sununcu  Bir Hata Bildirdi");
                                    return;
                                }
                            }
                        }
                        catch { }

                        r = dt.Rows.Count;
                        progressBar1.Value   = 0;
                        progressBar1.Maximum = r;
                        progressBar1.Visible = true;
                        progressBar1.BringToFront();
                        Application.DoEvents();
                        listView1.Items.Clear();
                        try
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                ListViewItem item = new ListViewItem();
                                item.Text = dt.Rows[i][0].ToString();
                                item.SubItems.Add(dt.Rows[i][1].ToString());
                                item.SubItems.Add(dt.Rows[i][2].ToString());
                                item.SubItems.Add(dt.Rows[i][3].ToString());
                                item.SubItems.Add(dt.Rows[i][4].ToString());
                                item.SubItems.Add(dt.Rows[i][5].ToString());
                                listView1.Items.Add(item);
                                try { dib += Convert.ToDouble(dt.Rows[i][6].ToString()); }
                                catch {; }
                                progressBar1.Value = i;
                                Application.DoEvents();
                            }
                        }
                        catch (Exception exc)
                        {
                            MessageBox.Show("Genel Hata:" + exc.Message, "HATA!");
                        }

                        progressBar1.Visible = false;
                        progressBar1.Value   = 0;
                    }
                    //Utility.Engine.dat.ListDoldur(ref listView1, Utility.Engine.sql);



                    this.Text = r.ToString() + " Amb. - " + dib.ToString("##.###") + " Adet/Metre";

                    /*DataSet das = Utility.Engine.dat.DataSetDon(Utility.Engine.sql);
                     *
                     * if (das == null)
                     * {
                     *  MessageBox.Show("Sunucu Hata Bildirdi", Utility.Engine.dat.Fault);
                     *  return;
                     * }
                     *
                     * if (das.Tables.Count < 1)
                     * {
                     *  MessageBox.Show("Sunucu Hata Bildirdi", Utility.Engine.dat.Fault);
                     *  return;
                     * }
                     *
                     * if ( das.Tables[0].Rows.Count < 1)
                     * {
                     *  MessageBox.Show("Sunucu Hata Bildirdi", Utility.Engine.dat.Fault);
                     *  return;
                     * }
                     *
                     * try
                     * {
                     *  if (das.Tables[0].Rows.Count > 0)
                     *  {
                     *      if (das.Tables[0].Rows[0][0].ToString().Trim() == "-1")
                     *      {
                     *          MessageBox.Show(das.Tables[0].Rows[0][0].ToString().Trim(), "Sununcu  Bir Hata Bildirdi");
                     *          return;
                     *      }
                     *  }
                     * }
                     * catch { }
                     *
                     *
                     * Utility.Engine.dat.tabledenListDoldur1(das.Tables[0], listView1);
                     *
                     * try
                     * {
                     *  Text = das.Tables[1].Rows[0][1].ToString() + " Amb. " + das.Tables[1].Rows[0][0].ToString() + " Adet/Metre";
                     * }
                     * catch (Exception exc)
                     * {
                     *  MessageBox.Show("Genel Hata:" + exc.Message, "HATA!");
                     * }*/


                    //this.Text = dtx.Rows.Count.ToString();

                    textBoxSeriliBarkod.Text = "";
                    textBoxSeriliBarkod.Focus();
                    return;
                }
            }
            catch (Exception exc)
            {
                Utility.Engine.Hata("Genel Hata:" + exc.Message);
            }
        }
Exemple #20
0
        /// <summary>
        /// 读取网站的图片,成功返回"",否则返回错误提示, 如果文件已经存在,改名为.temp,下载成功后删除已经存在的文件并改名,文件长度设为0时先读取文件长度
        /// </summary>
        internal string WebDownFile(string Url, string saveFullPath, ProgressBar progressBar, long length)
        {
            string strRet = "";

            progressBar.Visible = true;
            progressBar.BringToFront();
            progressBar.Value = 0;
            try
            {
                if (!Directory.Exists(Path.GetDirectoryName(saveFullPath)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(saveFullPath));
                }
                //删除原来的吗?
                string newSavePath = saveFullPath + ".temp";
                if (File.Exists(newSavePath))
                {
                    File.Delete(newSavePath);
                }

                bStopDown  = false;//一开始不能停止
                downLength = 0;

                //5.6及以前版本都 先获取下载文件长度,以显示进度条,这样造成速度更慢
                if (length > 0)
                {
                    fileLength = length;
                }
                else
                {
                    fileLength = 10000000;
                }

                Stream str = null;
                Stream fs  = null;
                try
                {
                    str = this.webclient.OpenRead(Url);

                    byte[] mbyte = new byte[1024];
                    int    readL = str.Read(mbyte, 0, 1024);
                    //判断并建立文件
                    fs = new FileStream(newSavePath, FileMode.OpenOrCreate, FileAccess.Write);
                    //读取流
                    while (readL != 0)
                    {
                        if (bStopDown)
                        {
                            break;
                        }

                        downLength += readL;                          //已经下载大小
                        fs.Write(mbyte, 0, readL);                    //写文件
                        readL             = str.Read(mbyte, 0, 1024); //读流
                        progressBar.Value = (int)(downLength * 100 / fileLength);
                        Application.DoEvents();
                    }
                    str.Close();
                    fs.Close();

                    //下载完成,替换文件
                    if (File.Exists(saveFullPath))
                    {
                        File.Delete(saveFullPath);
                    }
                    File.Move(newSavePath, saveFullPath);
                }
                catch (Exception ex)
                {
                    if (str != null)
                    {
                        str.Close();
                    }
                    if (fs != null)
                    {
                        fs.Close();
                    }
                    strRet = "下载过程中出错:" + ex.Message;
                }
                finally
                {
                    if (str != null)
                    {
                        str.Dispose();
                    }
                    if (fs != null)
                    {
                        fs.Dispose();
                    }
                }
                //如果人工停止了下载,要删除临时文件
                if (bStopDown)
                {
                    if (File.Exists(newSavePath))
                    {
                        File.Delete(newSavePath);
                    }
                    strRet = "下载已取消!";
                }
            }
            catch (Exception ea)
            {
                strRet = "下载失败:" + ea.Message;
            }
            progressBar.Visible = false;
            return(strRet);
        }
Exemple #21
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2, (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2);
            Factory f = new Factory();

            //получаем из Фабрики самую свежую и точную инфу!
            precondTypesList = Factory.PrecondTypes.Keys.ToArray();
            matrixTypesList  = Factory.MatrixTypes.Keys.ToArray();
            solverTypesList  = Factory.SolverTypes.Keys.ToArray();

            formMatrix = new Label
            {
                Text     = "Формат матрицы",
                Size     = new Size(110, 15),
                Location = new System.Drawing.Point(35, 73)
            };
            this.Controls.Add(formMatrix);
            formMatrix.BringToFront();
            formMatrix.BackColor = Color.Transparent;

            solver = new ComboBox
            {
                Size     = new Size(210, 30),
                Location = new System.Drawing.Point(175, 40)
            };
            for (int i = 0; i < solverTypesList.Length; i++)
            {
                solver.Items.Add(solverTypesList[i]);
            }

            solver.SelectedIndex             = 0;
            solver.SelectionChangeCommitted += new System.EventHandler(comboboxSelectionChangeCommitted);
            solver.DropDownStyle             = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.Controls.Add(solver);
            solver.BringToFront();
            solver.BackColor = Color.White;

            solvMatrix = new Label
            {
                Text      = "Решатель",
                Size      = new Size(80, 15),
                Location  = new System.Drawing.Point(35, 43),
                BackColor = Color.Transparent
            };
            this.Controls.Add(solvMatrix);
            solvMatrix.BringToFront();

            precond = new ComboBox
            {
                Size     = new Size(210, 30),
                Location = new System.Drawing.Point(175, 100)
            };
            for (int i = 0; i < precondTypesList.Length; i++)
            {
                precond.Items.Add(precondTypesList[i]);
            }

            precond.SelectedIndex = 0;
            precond.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.Controls.Add(precond);
            precond.BringToFront();
            precond.BackColor = Color.White;


            precondMatrix = new Label
            {
                Text     = "Предобусловливание",
                Size     = new Size(120, 15),
                Location = new System.Drawing.Point(35, 103)
            };

            this.Controls.Add(precondMatrix);
            precondMatrix.BringToFront();
            precondMatrix.BackColor = Color.Transparent;

            accl = new Label
            {
                Text      = "Точность решения                    1E-",
                Size      = new Size(200, 15),
                Location  = new System.Drawing.Point(35, 142),
                BackColor = Color.Transparent
            };
            this.Controls.Add(accl);
            accl.BringToFront();

            acc = new NumericUpDown
            {
                Size     = new Size(40, 60),
                Location = new System.Drawing.Point(210, 139),
                Minimum  = 0,
                Maximum  = 16,
                Value    = 10
            };
            this.Controls.Add(acc);
            acc.BringToFront();


            maxiterl = new Label
            {
                Text      = "Максимальное число итераций",
                Size      = new Size(190, 15),
                Location  = new System.Drawing.Point(35, 173),
                BackColor = Color.Transparent
            };
            this.Controls.Add(maxiterl);
            maxiterl.BringToFront();

            maxit = new TextBox
            {
                Size     = new Size(40, 100),
                Location = new System.Drawing.Point(210, 170),
                Text     = "1000"
            };
            this.Controls.Add(maxit);
            maxit.BringToFront();
            maxit.TextChanged += new System.EventHandler(maxitTextChange);

            propertyMatrix = new CheckBox
            {
                Text      = "Симметричная матрица",
                Size      = new Size(200, 20),
                Location  = new Point(38, 198),
                BackColor = Color.Transparent
            };
            propertyMatrix.CheckedChanged += new System.EventHandler(propertyChange);
            this.Controls.Add(propertyMatrix);
            propertyMatrix.BringToFront();

            justDoIt = new Button
            {
                Text     = "Ручной ввод",
                Size     = new Size(100, 30),
                Location = new Point(285, 138)
            };
            justDoIt.Click += new System.EventHandler(justDoItClick);
            this.Controls.Add(justDoIt);
            justDoIt.BringToFront();

            loadFiles = new Button
            {
                Text     = "Файловый ввод",
                Size     = new Size(100, 30),
                Location = new Point(285, 173)
            };
            loadFiles.Click += new System.EventHandler(loadFilesClick);
            this.Controls.Add(loadFiles);
            loadFiles.BringToFront();

            graphics = new Button
            {
                Text     = "Графика",
                Size     = new Size(100, 30),
                Location = new Point(175, 290),
                Enabled  = false
            };
            graphics.Click += new System.EventHandler(graphicsClick);
            this.Controls.Add(graphics);
            graphics.BringToFront();

            next = new Button
            {
                Text     = "Решить",
                Size     = new Size(100, 30),
                Location = new Point(285, 290),
                Enabled  = false
            };
            next.Click += new System.EventHandler(nextClick);
            this.Controls.Add(next);


            fileResult = new Button
            {
                Text     = "Файл с результатом",
                Size     = new Size(130, 30),
                Location = new Point(35, 290),
                Enabled  = false
            };
            fileResult.Click += new System.EventHandler(fileResultClick);
            this.Controls.Add(fileResult);
            fileResult.BringToFront();

            format = new ComboBox
            {
                Size     = new Size(210, 30),
                Location = new System.Drawing.Point(175, 70),
            };

            format.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;

            for (int i = 0; i < matrixTypesList.Length; i++)
            {
                format.Items.Add(matrixTypesList[i]);
            }

            format.SelectedIndexChanged += new System.EventHandler(format_SelectedIndexChanged);
            this.Controls.Add(format);
            format.BringToFront();
            format.SelectedIndex = 0;

            log = new ComboBox
            {
                Size     = new Size(210, 30),
                Location = new System.Drawing.Point(175, 225)
            };
            log.Items.Add("Консоль");
            log.Items.Add("Файл log.txt");
            log.Items.Add("<Добавить файл>");
            log.SelectedIndexChanged += new System.EventHandler(log_SelectedIndexChanged);

            log.SelectedIndex = 1;
            log.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.Controls.Add(log);
            log.BringToFront();
            log.BackColor = Color.White;


            logLabel = new Label
            {
                Text     = "Логгер",
                Size     = new Size(120, 15),
                Location = new System.Drawing.Point(35, 225)
            };

            this.Controls.Add(logLabel);
            logLabel.BringToFront();
            logLabel.BackColor = Color.Transparent;

            bar = new ProgressBar
            {
                Size     = new Size(350, 20),
                Location = new System.Drawing.Point(35, 255)
            };
            this.Controls.Add(bar);
            bar.BringToFront();
        }
        public DisassemblerControl()
        {
            Width  = 100;
            Height = 100;
            Label alphaLabel = new Label()
            {
                Text     = "Disassembler is in pre-pre-alpha stage. Don't expect perfect results.",
                Location = new Point(3, 5),
                Height   = 20,
                Width    = 400,
            };

            Label offsetLabel = new Label()
            {
                Location = new Point(3, 30),
                Width    = 50,
                Text     = "Offset:",
            };

            offsetBox = new TextBox()
            {
                Width    = 100,
                Location = new Point(offsetLabel.Left + offsetLabel.Width + 5, offsetLabel.Top - 3),
            };
            Label sizeLabel = new Label()
            {
                Location = new Point(offsetBox.Right + 10, 30),
                Width    = 50,
                Text     = "Size:",
            };

            sizeBox = new TextBox()
            {
                Width    = 100,
                Location = new Point(sizeLabel.Right + 5, sizeLabel.Top - 3),
            };
            disassembleButton = new Button()
            {
                Text     = "Disassemble",
                Location = new Point(sizeBox.Right + 10, sizeBox.Top - 1),
            };
            analyseButton = new Button()
            {
                Text     = "Analyse",
                Location = new Point(disassembleButton.Right + 5, disassembleButton.Top),
            };
            progressBar = new ProgressBar()
            {
                Width   = 10,
                Height  = 15,
                Anchor  = AnchorStyles.Left | AnchorStyles.Right,
                Visible = false,
            };
            progressBar.Location = new Point(this.Width / 2 - progressBar.Width / 2, this.Height / 2 - progressBar.Height / 2);

            disassemblyView = new ListView()
            {
                Location      = new Point(0, sizeBox.Bottom + 7),
                Width         = this.Width,
                Height        = this.Height - (sizeBox.Bottom + 7),
                View          = View.Details,
                Anchor        = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom,
                FullRowSelect = true,
                UseCompatibleStateImageBehavior = false,
            };

            disassemblyView.Columns.AddRange(new ColumnHeader[] {
                new ColumnHeader()
                {
                    Text = "Offset", Width = 75,
                },
                new ColumnHeader()
                {
                    Text = "Bytes", Width = 100,
                },
                new ColumnHeader()
                {
                    Text = "Disassembly", Width = 200,
                },
                new ColumnHeader()
                {
                    Text = "Comment", Width = 100
                },
            });

            disassembleButton.Click += disassembleButton_Click;
            analyseButton.Click     += analyseButton_Click;
            this.Controls.AddRange(new Control[] {
                alphaLabel,
                offsetLabel,
                offsetBox,
                sizeLabel,
                sizeBox,
                disassembleButton,
                analyseButton,
                disassemblyView,
                progressBar,
            });
            progressBar.BringToFront();
        }
Exemple #23
0
        private void SetObjects()
        {
            int page = Page;

            var articolo = _documento.Articoli[page];

            string artPath = System.IO.Path.Combine(_documento.Path, articolo.Path);

            float ratio = 1;

            float ratioW = MSize.X / articolo.Width;
            float ratioH = MSize.Y / articolo.Height;

            if (ratioW < ratioH)
            {
                ratio = ratioW;
            }
            else
            {
                ratio = ratioH;
            }

            if (_articleView == null)
            {
                _articleView = new RelativeLayout(MContext);

                this.AddView(_articleView, new RelativeLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent));
                //_articleView.SetClipToPadding(false);
                _articleView.BringToFront();
            }

            Task.Factory
            .StartNew(() => {
                if (Looper.MyLooper() == null)
                {
                    Looper.Prepare();
                }

                _oggetti = Objects.CreateObjects(articolo.Oggetti, artPath, _docView, ratio);

                /*if(page % 10 == 0)
                 *      GC.Collect();*/

                Log.Info(TAG, "Creazione oggetti pag " + page);
            })
            .ContinueWith(task => {
                try
                {
                    var oggetti = _oggetti.Values.ToArray();

                    for (int i = 0; i < oggetti.Length; i++)
                    {
                        View view = oggetti[i];
                        _docView.RunOnUiThread(() =>
                        {
                            if (_articleView != null)
                            {
                                _articleView.AddView(view);
                                mBusyIndicator.BringToFront();
                            }
                        });
                    }

                    oggetti = null;

                    Log.Info(TAG, "Aggiunta oggetti pag " + page);

                    Loaded = true;

                    if (OnScreen)
                    {
                        _docView.RunOnUiThread(() =>
                        {
                            Autoplay();
                        });
                    }
                }
                catch (Exception ex)
                {
                    Utils.WriteLog(TAG + " -> SetObjects", ex.Message);
                }
            });
        }
Exemple #24
0
        private void InitializeComponent()
        {
            BackColor   = Color.White;
            Size        = new Size(383, 80);
            BorderStyle = BorderStyle.FixedSingle;
            labelTitle  = new Label()
            {
                Location    = new System.Drawing.Point(55, 4),
                Size        = new Size(257, 21),
                AutoSize    = true,
                MaximumSize = new Size(220, 21),
                Font        = new System.Drawing.Font("Segoe UI", 12, System.Drawing.FontStyle.Bold),
                Text        = program.Title
            };
            labelGenre = new Label()
            {
                Font        = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Regular),
                Location    = new Point(56, 28),
                Size        = new Size(240, 30),
                AutoSize    = true,
                MaximumSize = new Size(240, 70),
                Text        = TvProgramManager.GetGenresAsString(program.Genre)
            };

            labelStartTime = new Label()
            {
                Font     = new System.Drawing.Font("Segoe UI", 14, System.Drawing.FontStyle.Bold),
                Location = new Point(-2, 3),
                Text     = program.StartTime.ToString("HH:mm")
            };
            labelTimeLength = new Label()
            {
                Font     = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Bold),
                Location = new Point(3, 26),
                Text     = (program.EndTime - program.StartTime).TotalMinutes.ToString("0") + " perc"
            };
            labelStatus = new Label()
            {
                Location = new Point(280, 60),
                Font     = new System.Drawing.Font("Segoe UI", 8, System.Drawing.FontStyle.Bold),
                Visible  = false
            };
            pictureKorhatar = new PictureBox()
            {
                Image    = getAgeLimitPic(),
                Location = new Point(337, 10),
                Size     = new Size(32, 32)
            };
            buttonFoglalas = new Button()
            {
                Text      = "Foglalás",
                Location  = new Point(303, 52),
                BackColor = Control.DefaultBackColor,
                Visible   = false
            };
            elapsedTimeProgress = new ProgressBar()
            {
                Visible   = false,
                Location  = new Point(0, 0),
                Size      = new Size(383, 5),
                BackColor = Color.MediumVioletRed,
            };
            CheckProgramElapsedTime();

            //FOGLALÁS BEGINS
            using (TvContext context = new TvContext())
            {
                //Olyan műsorok lekérése, amelyek ugyanabban az időpontban vannak műsoron, mint ebbe a Controlba kapott műsor.
                //Olyan műsor ami foglalva van, hamarabb, vagy ugyanakkor kezdődik mint a kiválasztott és később van vége, mint ahogy a kiválasztott elkezdődne.
                var shows = from vizsgalt in context.Programs
                            where
                            vizsgalt.Reserved != null &&
                            (
                    (vizsgalt.StartTime <= program.StartTime && vizsgalt.EndTime > program.StartTime)
                    ||
                    (vizsgalt.StartTime >= program.StartTime && vizsgalt.EndTime <= program.EndTime)
                    ||
                    (vizsgalt.StartTime >= program.StartTime && vizsgalt.StartTime < program.EndTime)
                    ||
                    (vizsgalt.EndTime >= program.StartTime && vizsgalt.EndTime <= program.EndTime)
                            )
                            select vizsgalt;
                //Látható legyen a foglalás gomb. Minden más többi esetben csak eltüntetve lesz.
                if (room != null)
                {
                    if (program.StartTime >= DateTime.Now || program.StartTime <= DateTime.Now && program.EndTime >= DateTime.Now)
                    {
                        buttonFoglalas.Visible = true;
                    }
                }
                //Ha van olyan műsor amivel átfedésben van
                if (shows.Count() > 0)
                {
                    //Ha ütközik másik programmal, megnézzük, hogy önmaga is a foglalt műsorok között van.
                    bool isSelf = (from p in shows
                                   where p.ProgramId == program.ProgramId
                                   select p)
                                  .Count() > 0;

                    buttonFoglalas.Visible = false;

                    //Ha önmaga az éppen ütköző foglalt műsorok között van, akkor tudatjuk a felhasználóval, ez van az adott időpotban lefoglalva.
                    if (isSelf)
                    {
                        labelStatus.Text = "Lefoglalt";
                        System.Windows.Forms.ToolTip ttt = new System.Windows.Forms.ToolTip();
                        ttt.SetToolTip(labelStatus, "Ez a műsor már le van foglalva, így nézhető lesz.\nLefoglaló szoba: " + program.ReservedRoomId);
                    }
                    else
                    {
                        //Ebben az esetben a műsor nem foglalható le, mert ekkor másik lefoglalt műsor fut. Hogy a felhasználó tudja, hogy mi,
                        //jobb kattintásra context menüben megjelenik a műsor, rákattintva ahhoz a tv csatornához ugrik a program.
                        var reservedShows = from p in shows
                                            where p.ProgramId != program.ProgramId
                                            select p;

                        ContextMenuStrip cm = new ContextMenuStrip()
                        {
                            RenderMode = ToolStripRenderMode.System
                        };
                        //Alap foglalt műsor szöveg és egy divider.
                        ToolStripMenuItem menuItem = new ToolStripMenuItem()
                        {
                            Text = "Foglalt műsor", Enabled = false
                        };
                        cm.Items.Add(menuItem);
                        cm.Items.Add(new ToolStripSeparator());

                        //Ütköző műsor berakása a listába.
                        foreach (var show in reservedShows)
                        {
                            ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem()
                            {
                                Text = String.Format(
                                    "{0} {1}:{2}-{3}:{4} ({5})",
                                    show.Title,                           //0
                                    show.StartTime.Hour,                  //1
                                    show.StartTime.Minute.ToString("00"), //2
                                    show.EndTime.Hour,                    //3
                                    show.EndTime.Minute.ToString("00"),   //4
                                    show.TvChannel                        //5
                                    )
                            };
                            //Kattintásra elsütjük a SelectedProgramChanged eseményt, ami megváltoztatja a megjelenített csatornát
                            toolStripMenuItem.Click += (i, o) => { SelectedProgramChaned?.Invoke(this, new ProgramChangeEventArgs()
                                {
                                    Program = show
                                }); };
                            //És hozzá is adjuk a menühöz az elemet.
                            cm.Items.Add(toolStripMenuItem);
                        }
                        labelStatus.ContextMenuStrip = cm;
                        //Kis tooltip, hogy érthető legyen miért van kint a felirat.
                        System.Windows.Forms.ToolTip ttt = new System.Windows.Forms.ToolTip();
                        ttt.SetToolTip(labelStatus, "Ebben az időpontban egy másik lefoglalt műsorral van átfedésben.\nJobb kattintással többet megtudhat.");

                        labelStatus.Text = "Nem foglalható";
                    }
                    labelStatus.ForeColor = Color.Gray;
                    labelStatus.Visible   = true;
                }
                else
                {
                    //Ha pedig nincs foglalt program ennek az időpontjában, akkor a gombhoz hozzárendeljük a foglalást megvalósító metódust.
                    buttonFoglalas.Click += (o, i) => { TvProgramManager.ReserveTvProgram(program, room); };
                }
                //Itt pedig felülírjuk a dolgokat annyival, hogyha az adott műsor saját szoba foglalása.
                if (context.Rooms.Find(program.ReservedRoomId) != null)
                {
                    if (room != null && context.Rooms.Find(program.ReservedRoomId).RoomId == room.RoomId)
                    {
                        labelStatus.ForeColor = Color.Green;
                        labelStatus.Text      = "Saját foglalás";
                        labelStatus.Visible   = true;
                    }
                    buttonFoglalas.Visible = false;
                }
            }


            //FOGLALÁS ENDS

            Controls.Add(labelTitle);
            Controls.Add(labelGenre);
            Controls.Add(labelTimeLength);
            Controls.Add(labelStatus);
            Controls.Add(pictureKorhatar);
            Controls.Add(labelStartTime);
            Controls.Add(buttonFoglalas);
            Controls.Add(elapsedTimeProgress);
            elapsedTimeProgress.BringToFront();

            Timer timer = new Timer()
            {
                Interval = 5000
            };

            timer.Tick += (obj, args) => { CheckProgramElapsedTime(); };
            timer.Start();


            System.Windows.Forms.ToolTip tt = new System.Windows.Forms.ToolTip();
            tt.SetToolTip(pictureKorhatar, TvProgramManager.GetAgeLimitMessage(program.AgeLimit));
            tt.SetToolTip(labelStartTime, $"Kezdés: {program.StartTime.TimeOfDay} - Vége: {program.EndTime.TimeOfDay}");
            tt.SetToolTip(labelTimeLength, $"Vége: {program.EndTime.TimeOfDay}");
        }