Beispiel #1
0
        public override bool RefreshUI()
        {
            ResetIndex();
            var serverList = this.GetFilteredList();

            flyPanel.Invoke((MethodInvoker) delegate
            {
                if (serverList == null || serverList.Count > 0)
                {
                    RemoveWelcomeItem();
                }
                else
                {
                    RemoveAllConrols();
                    if (preSelectedMarkFilterIndex <= 0)
                    {
                        LoadWelcomeItem();
                    }
                    return;
                }

                RemoveDeletedServerItems(ref serverList);
                AddNewServerItems(serverList);
            });
            return(true);
        }
Beispiel #2
0
        public override bool RefreshUI()
        {
            ResetIndex();
            var list = this.GetFilteredList();

            flyPanel.Invoke((MethodInvoker) delegate
            {
                if (list == null || list.Count > 0)
                {
                    RemoveWelcomeItem();
                }
                else
                {
                    RemoveAllConrols();
                    if (preSelectedMarkFilterIndex <= 0 &&
                        string.IsNullOrEmpty(tboxSearch.Text))
                    {
                        LoadWelcomeItem();
                    }
                    return;
                }

                RemoveDeletedServerItems(ref list);
                AddNewServerItems(list);
            });
            return(true);
        }
Beispiel #3
0
        public override bool RefreshUI()
        {
            ResetIndex();
            var list      = this.GetFilteredList();
            var pagedList = GenPagedServerList(list);

            flyPanel?.Invoke((MethodInvoker) delegate
            {
                if (pagedList.Count > 0)
                {
                    RemoveWelcomeItem();
                }
                else
                {
                    RemoveAllServersConrol();
                    if (string.IsNullOrEmpty(this.searchKeywords))
                    {
                        LoadWelcomeItem();
                    }
                    return;
                }

                RemoveDeletedServerItems(ref pagedList);
                AddNewServerItems(pagedList);
            });
            LazyStatusBarUpdater();
            return(true);
        }
Beispiel #4
0
 private void addtoPanel(queueDisplay _q)
 {
     if (_pn.InvokeRequired)
     {
         _pn.Invoke(new MethodInvoker(() => { _pn.Controls.Add(_q); }));
     }
     else
     {
         _pn.Controls.Add(_q);
     }
 }
Beispiel #5
0
        public void ApplyConfig()
        {
            if (control.InvokeRequired)
            {
                control.Invoke((Action)(() => ApplyConfig()));
                return;
            }

            textBoxHttpClientUrl.Text    = plugin.Config.Url;
            chkHttpClientEnabled.Checked = plugin.Config.Enabled;
            txtHttpClientHeaders.Text    = plugin.Config.Headers;
        }
        public void ApplyConfig()
        {
            if (control.InvokeRequired)
            {
                control.Invoke((Action)(() => ApplyConfig()));
                return;
            }

            textBoxPipeName.Text         = plugin.Config.PipeName;
            chkPipeServerEnabled.Checked = plugin.Config.Enabled;
            numCacheMs.Text = $"{plugin.Config.CacheMs}";
        }
Beispiel #7
0
 public void LoopThroughAllServerUI(Action <Views.UserControls.ServerUI> operation)
 {
     var list = flyPanel.Controls
                .OfType <Views.UserControls.ServerUI>()
                .Select(e =>
     {
         flyPanel?.Invoke((MethodInvoker) delegate
         {
             operation(e);
         });
         return(true);
     })
                .ToList();
 }
Beispiel #8
0
 void RunInUiThread(Action updater)
 {
     flyLuaUiPanel.Invoke((MethodInvoker) delegate
     {
         updater();
     });
 }
 public static DriveInfoProgress GetDriveInfoProgress(FlowLayoutPanel panel, string volume)
 {
     if (panel.InvokeRequired)
     {
         return((DriveInfoProgress)panel.Invoke(new GetDriveInfoProgressDelegate(GetDriveInfoProgress), panel, volume));
     }
     return(panel.Controls.Cast <DriveInfoProgress>().FirstOrDefault(item => item.Volume.Equals(volume)));
 }
 public static IEnumerable <DriveInfoProgress> GetDriveInfoProgress(FlowLayoutPanel panel, DriveInfoProgressStatus status)
 {
     if (panel.InvokeRequired)
     {
         return((IEnumerable <DriveInfoProgress>)panel.Invoke(new GetDriveInfoProgressControlsDelegate(GetDriveInfoProgress), panel, status));
     }
     return(panel.Controls.Cast <DriveInfoProgress>().Where(item => item.Status.Equals(status)));
 }
Beispiel #11
0
 public override bool RefreshUI()
 {
     flyPanel.Invoke((MethodInvoker) delegate
     {
         RemoveAllConrols();
         LoadServerItems();
     });
     return(false);
 }
 private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
     {
         int vkCode = Marshal.ReadInt32(lParam);
         flow.Invoke(new MethodInvoker(() => {
             flow.Controls.Add(getLaber((Keys)vkCode + ""));
         }));
     }
     return(CallNextHookEx(_hookID, nCode, wParam, lParam));
 }
Beispiel #13
0
        private void DeleteClassHelper(string DeleteName)
        {
            for (int i = 0; i < 15; i++)
            {
                Thread.Sleep(100);
                this?.Invoke((NoArgDelegate)ResourcePanel.Hide);
            }
            //Delete all files in the class including the placeholder resource.
            foreach (ResourceData R in CurrentResources)
            {
                DeleteSempahore.WaitOne();
                DeleteEvent?.Invoke(R.Name, GetIsLinkFromR(R));
            }
            ClassesMediator?.Invoke((NoArgDelegate)ClassesMediator.Controls.Clear);

            //this?.Invoke((DrawingDelegate)ControlHelper.ResumeDrawing, ResourcePanel);
            //this?.Invoke((DrawingDelegate)ControlHelper.ResumeDrawing, ClassesPanel);
            ClassesMediator?.Invoke((EventArgsDelegate)ArrowPanel_Click, null, null);
            AllClasses.Remove(DeleteName);
            ClassesMediator?.Invoke((UpdateClassesDelegate)UpdateClasses, AllClasses);
            this?.Invoke((NoArgDelegate)EndLoading);
        }
Beispiel #14
0
        public void RemoveAllServersConrol(bool blocking = false)
        {
            var controlList = GetAllServersControl();

            flyPanel.Invoke((MethodInvoker) delegate
            {
                flyPanel.SuspendLayout();
                flyPanel.Controls.Clear();
                flyPanel.ResumeLayout();
            });

            if (blocking)
            {
                DisposeFlyPanelControlByList(controlList);
            }
            else
            {
                Task.Factory.StartNew(
                    () => DisposeFlyPanelControlByList(
                        controlList));
            }
        }
 public static void RemoveDriveInfoWrapper(FlowLayoutPanel panel, string volume)
 {
     if (panel.InvokeRequired)
     {
         panel.Invoke(new RemoveDriveInfoWrapperDelegate(RemoveDriveInfoWrapper), panel, volume);
     }
     else
     {
         var control = GetDriveInfoProgress(panel, volume);
         if (control != null)
         {
             panel.Controls.Remove(control);
         }
     }
 }
        private void CreateLabel(string text, FlowLayoutPanel panel, string toolTip, string format)
        {
            Label label = new Label();

            label.AutoSize  = false;
            label.Width     = panel.Width;
            label.Height    = 32;
            label.TextAlign = ContentAlignment.MiddleLeft;
            label.ForeColor = Color.Black;
            label.Text      = text;

            if (format == "BlackAlignLeft")
            {
                label.Font   = new Font("Arial", 8, FontStyle.Regular);
                label.Height = 22;
            }

            if (format == "MoneyRedGreen")
            {
                double number = Convert.ToDouble(Helper.RemovePoundSign(text));
                label.TextAlign = ContentAlignment.MiddleCenter;

                if (number < 0)
                {
                    label.ForeColor = Color.Red;
                }
                else
                {
                    label.ForeColor = Color.Green;
                }
            }

            if (format == "BlackAlignCenter")
            {
                label.TextAlign = ContentAlignment.MiddleCenter;
            }

            if (toolTip != "None")
            {
                new ToolTip().SetToolTip(label, toolTip);
                label.Cursor = Cursors.Help;
            }
            panel.Invoke((MethodInvoker) delegate()
            {
                panel.Controls.Add(label);
            });
        }
 public static void AddDriveInfoWrapper(MainForm owner, FlowLayoutPanel panel, DriveInfoData driveInfo)
 {
     if (panel.InvokeRequired)
     {
         panel.Invoke(new AddDriveInfoWrapperDelegate(AddDriveInfoWrapper), owner, panel, driveInfo);
     }
     else
     {
         var control = new DriveInfoProgress(owner, driveInfo);
         //control.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right)));
         control.Width = panel.Width - 10;
         control.Left  = 5;
         control.Top   = (panel.Controls.Count * control.Height) + 4;
         panel.Controls.Add(control);
         panel.PerformLayout();
     }
 }
        private void ReadImagesFromFile()
        {
            lock (images)
            {
                if (directory != "")
                {
                    images.Clear();
                    Image         thumbnail;
                    DirectoryInfo dir = new DirectoryInfo(directory);
                    foreach (FileInfo file in dir.GetFiles("*.bmp"))
                    {
                        thumbnail = Bitmap.FromFile(file.FullName).GetThumbnailImage(
                            Dimension, Dimension, null, IntPtr.Zero);
                        images.Add(new NamedImage(thumbnail, file.Name));
                    }
                }
            }

            // Update the display on the UI thread.
            pnlFlow.Invoke(new MethodInvoker(this.UpdateDisplay));
        }
        private void CreateHeaderLabel(string text, FlowLayoutPanel panel)
        {
            Label label = new Label();

            label.AutoSize  = false;
            label.Width     = panel.Width;
            label.Height    = 32;
            label.Font      = new Font("Franklin Gothic Medium Cond", 10, FontStyle.Regular);
            label.ForeColor = Color.SteelBlue;
            label.TextAlign = ContentAlignment.MiddleCenter;
            label.Text      = text;

            if (text == "13")
            {
                label.Text = "Total";
            }
            panel.Invoke((MethodInvoker) delegate()
            {
                panel.Controls.Add(label);
            });
        }
Beispiel #20
0
        public TextBox add(string msg, MouseEventHandler mousedown, MouseEventHandler mousedoubleclick)
        {
            if (fp.InvokeRequired)
            {
                return((TextBox)fp.Invoke(new tb_invoker(() => add(msg, mousedown, mousedoubleclick))));
            }
            if (file != null)
            {
                file.WriteLine(DateTime.Now.ToString() + ": " + msg);
                file.Flush();
            }
            if (list.Count >= maxcount)
            {
                del((TextBox)list[0]);
            }
            TextBox tb = new TextBox();

            tb.ReadOnly    = true;
            tb.BackColor   = fp.BackColor;
            tb.BorderStyle = BorderStyle.None;
            tb.ForeColor   = Color.White;
            tb.Width       = width;
            tb.Text        = msg;
            if (mousedown != null)
            {
                tb.MouseDown += mousedown;
            }
            if (mousedoubleclick != null)
            {
                tb.MouseDoubleClick += mousedoubleclick;
            }
            fp.Controls.Add(tb);
            fp.ScrollControlIntoView(tb);
            list.Add(tb);
            return(tb);
        }
Beispiel #21
0
        //private void CreatePanel(FlowLayoutPanel panel, Image picture, int sku, string category, string description, double price, int sold)
        public void CreatePanel(FlowLayoutPanel panel, Image pic, string skuNo, string cat, string desc, string col, double price, int qty)
        {
            Panel itemPanel = new Panel();

            itemPanel.AutoSize    = false;
            itemPanel.Size        = new Size(340, 150);
            itemPanel.BorderStyle = BorderStyle.FixedSingle;
            itemPanel.BackColor   = Color.GhostWhite;
            itemPanel.Tag         = skuNo;


            PictureBox picture = new PictureBox();

            picture.Location = new Point(5, 5);
            picture.Size     = new Size(140, 140);
            picture.Image    = pic;
            picture.SizeMode = PictureBoxSizeMode.StretchImage;
            picture.SendToBack();
            itemPanel.Controls.Add(picture);

            Label sku = new Label();

            sku.Location = new Point(150, 5);
            sku.Size     = new Size(190, 25);
            sku.Text     = "SKU: " + skuNo;
            sku.Font     = new Font("Calibri", 12, FontStyle.Bold);
            itemPanel.Controls.Add(sku);

            Label description = new Label();

            description.Location = new Point(150, 25);
            description.Size     = new Size(190, 20);
            description.Text     = desc;
            description.Font     = new Font("Calibri", 11, FontStyle.Bold);
            itemPanel.Controls.Add(description);

            Label colour = new Label();

            colour.Location = new Point(150, 45);
            colour.Size     = new Size(190, 20);
            colour.Text     = col;
            colour.Font     = new Font("Calibri", 10, FontStyle.Regular);
            itemPanel.Controls.Add(colour);

            Label category = new Label();

            category.Location = new Point(150, 65);
            category.Size     = new Size(190, 20);
            category.Text     = cat;
            category.Font     = new Font("Calibri", 10, FontStyle.Regular);
            itemPanel.Controls.Add(category);

            Label sellPrice = new Label();

            sellPrice.Location = new Point(150, 100);
            sellPrice.Size     = new Size(190, 20);
            sellPrice.Text     = "£" + price.ToString();
            sellPrice.Font     = new Font("Calibri", 10, FontStyle.Regular);
            itemPanel.Controls.Add(sellPrice);

            Label sold = new Label();

            sold.Location = new Point(150, 125);
            sold.Size     = new Size(190, 20);
            sold.Text     = "Sold: " + qty.ToString();
            sold.Font     = new Font("Calibri", 10, FontStyle.Regular);
            itemPanel.Controls.Add(sold);
            itemPanel.MouseHover += ItemPanel_MouseHover;
            panel.Invoke((MethodInvoker) delegate()
            {
                panel.Controls.Add(itemPanel);
            });
        }
Beispiel #22
0
 public static void Disable(this FlowLayoutPanel panel)
 {
     panel.Invoke(new MethodInvoker(() => { panel.Enabled = false; }));
 }
Beispiel #23
0
        static public void CreateLabel(string text, FlowLayoutPanel panel, string toolTip, string format)
        {
            Label label = new Label
            {
                AutoSize  = false,
                Width     = panel.Width,
                Height    = 32,
                TextAlign = ContentAlignment.MiddleLeft,
                ForeColor = Color.Black,
                Text      = text
            };

            if (format == "BlackAlignLeft")
            {
                label.Font   = new Font("Arial", 8, FontStyle.Regular);
                label.Height = 22;
            }

            if (format == "BlackAlignLeftItalic")
            {
                label.Font   = new Font("Arial", 8, FontStyle.Italic);
                label.Height = 22;
                if (ChangeBackgoundColour == false)
                {
                    label.BackColor       = Color.LightGray;
                    ChangeBackgoundColour = true;
                }
                else
                {
                    label.BackColor       = Color.DarkGray;
                    ChangeBackgoundColour = false;
                }
            }

            if (format == "BlackAlignLeft12")
            {
                label.Font   = new Font("Arial", 12, FontStyle.Regular);
                label.Height = 32;
            }

            if (format == "MoneyRedGreen")
            {
                double number = Convert.ToDouble(Helper.RemovePoundSign(text));
                label.TextAlign = ContentAlignment.MiddleLeft;

                if (number < 0)
                {
                    label.ForeColor = Color.Red;
                }
                else
                {
                    label.ForeColor = Color.Green;
                }
            }

            if (format == "BlackAlignCenter")
            {
                label.TextAlign = ContentAlignment.MiddleCenter;
            }

            if (format == "Header")
            {
                label.Font      = new Font("Franklin Gothic Medium Cond", 10, FontStyle.Regular);
                label.ForeColor = Color.SteelBlue;
                label.TextAlign = ContentAlignment.MiddleCenter;

                if (text == "13")
                {
                    label.Text = "Total";
                }
            }

            if (toolTip != "None")
            {
                new ToolTip().SetToolTip(label, toolTip);
                label.Cursor = Cursors.Help;
            }


            panel.Invoke((MethodInvoker) delegate()
            {
                panel.Controls.Add(label);
            });
        }
Beispiel #24
0
        public void UpdateMyLayout(FlowLayoutPanel llayout)
        {
            UpdateLayout ulayout = new UpdateLayout(this.OnUpdateLayout);

            layout.Invoke(ulayout, new Object[] { llayout });
        }