Пример #1
0
        private void UpdateWordleWithProgress()
        {
            IProgressIndicator progress = new ProgressBarWrapper(progressBar1);

            UpdateWordle(progress);
            Invoke(new Action(() => progressBar1.Hide()));
        }
Пример #2
0
        public MainWindow(IGlobalInfo globalInfo, IReadOnlyCollection <SiteInstance> websiteInstances)
        {
            InitializeComponent();

            _globalInfo = globalInfo;

            _primaryInstanceProgressBar = new ProgressBarWrapper(ProgressBar_Common, Dispatcher);

            FillListbox(websiteInstances);
        }
Пример #3
0
        public WordCloudForm(string text)
        {
            InitializeComponent();

            IProgressIndicator progress = new ProgressBarWrapper(progressBar1);

            IEnumerable <string> terms = new StringExtractor(text, progress);

            cloudControl.WeightedWords = terms.CountOccurences().SortByOccurences();

            progressBar1.Hide();
        }
Пример #4
0
        /// <summary>
        /// Deals with any ProgressChanged event trigger assuming the <c>ProgressChangedEventArgs</c>'s <c>UserState</c> is a <c>IWidgetWrapper</c>.
        /// </summary>
        private void BackgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            switch (e.UserState)
            {
            // The assignment to these local variables is needed.
            case ProgressBarWrapper c1:
                ProgressBarWrapper pbw = (ProgressBarWrapper)e.UserState;
                switch (pbw.ProgressBar)
                {
                case ProgressiveWidgetsEnum.ProgressBar.WholeProgressBar:
                    wholeProgressBar.Value = pbw.Value;
                    break;

                case ProgressiveWidgetsEnum.ProgressBar.DownloadProgressBar:
                    fileProgressBar.Value = pbw.Value;
                    break;

                default:
                    throw new NotImplementedException();
                }
                break;

            case LabelWrapper c2:
                LabelWrapper lw = (LabelWrapper)e.UserState;
                switch (lw.Label)
                {
                case ProgressiveWidgetsEnum.Label.InformativeLogger:
                    loggerDisplay.Text = lw.Value;
                    break;

                case ProgressiveWidgetsEnum.Label.DownloadLogger:
                    downloaderDisplay.Text = lw.Value;
                    break;

                case ProgressiveWidgetsEnum.Label.FileCountLogger:
                    filecount.Left = loggerDisplay.Location.X + loggerDisplay.Size.Width;
                    filecount.Text = lw.Value;
                    break;

                case ProgressiveWidgetsEnum.Label.DownloadSpeedLogger:
                    speed.Text = lw.Value;
                    break;

                default:
                    throw new NotImplementedException();
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }
Пример #5
0
        private void CreateBarProgress()
        {
            if (!_task.IsFinished && _node.Nodes.Count == 0)
            {
                int width = Math.Min(100, _treeView.Width - 50);
                var ctrl  = new ProgressBarWrapper {
                    Width = width
                };
                _progress = ctrl.ProgressBar;

                var subNode = new TreeNodeAdv {
                    Text = "", CustomControl = ctrl, IsSelectable = false
                };

                _node.Nodes.Clear();
                _node.Nodes.Add(subNode);
                _node.Expanded = true;
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     Progress    = Downloader.CurrentDownloadProgress;
     DataContext = Progress;
 }
Пример #7
0
        //Constructor for searches unbounded by part types
        public Part(String partType)
        {
            InitializeComponent();
            Orientation = 0;
            CanScale = false;
            CanRotate = false;

            _sitesList = new List<Sites>{new Sites(), new Sites()};

            //if (sw1 != null)
            //{
                _type = partType;
                if (_type == "prom")
                {
                    imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_prom2);
                    //Background = Brushes.Orange;
                }
                else if (_type == "rbs")
                {
                    imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_rbs2);
                    //Background = Brushes.DodgerBlue;
                }
                else if (_type == "cds")
                {
                    imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_cds2);
                    _sitesList.ElementAt(0).copySitesInfoFrom(new Sites("aatg"));
                    //Background = Brushes.Green;
                }
                else //type == "term"
                {
                    imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_term2);
                    //Background = Brushes.Red;
                }
            //}
            //else
            //{
            //    imgType.Source = SurfaceWindow1.BitmapToImageSource(Resource1.sbol_prom);
            //    this.Background = Brushes.Orange;
            //}

            _myRegDS = new RegDataSheet();

            _progressBarWrapper = new ProgressBarWrapper(new Action(showProgressBar), new Action(hideProgressBar));
            _myRegDS.BasicInfo.Sequence = "atgcatgctagcatccattacgatccgtcag";
        }
        //Populates showPanels with L1 StackPanels that hold 1-4 L0 StackPanels that hold 1 Part and 2 Sites
        //Grouping into set0s organizes data for L0 PCR products and destination vectors
        //Grouping into set1s organizes data for L1 PCR products (LacZ?) and destination vectors
        public PrimerDesigner1(List<List<Part>> partListFromPD2)
        {
            InitializeComponent();
            Part.pd1 = this;
            SurfaceWindow1.pd1 = this;
            _partList = partListFromPD2;
            _progressBarWrapper = new ProgressBarWrapper(new Action(showProgressBar), new Action(hideProgressBar));


            /* NOTE: Removing duplicate fusion site visuals is MAD HACK right now, and I know that it's totally wrong and lazy fix. Will have to put in 
             * counters and conditionals to figure out when the last part of the last subpart list is to add in that last fusion site. Also need to somehow
             * preserve the fusion site sequence string so it'll display the correct sequence with double fusion site SEQUENCE still there.
             * SHOOT ME IN THE HEAD @T.Feng (will come back to this after dinner)*/


            int partCounter = 0;
            int sublistCounter = 0;

            foreach (List<Part> sublist in _partList)
            {
                StackPanel set1 = new StackPanel();
                set1.Orientation = System.Windows.Controls.Orientation.Horizontal;
                foreach (Part p in sublist)
                {
                    StackPanel set0 = new StackPanel();
                    set0.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    set0.Background = new SolidColorBrush(Colors.Transparent);
                    Sites s1 = p.SitesList.ElementAt(0).clone();
                    s1.IsManipulationEnabled = false;
                    set0.Children.Add(s1);
                    set0.Children.Add(p);
                    set1.Children.Add(set0);

                    //if iteration is on last part of entire _partList, add second fusion site to end
                    if ((partCounter == sublist.Count - 1) && (sublistCounter == _partList.Count - 1))
                    {
                        Sites s2 = p.SitesList.ElementAt(1).clone();
                        s2.IsManipulationEnabled = false;
                        set0.Children.Add(s2);
                    }

                    //Generate primers for the Part PCR product and L0 DV and add to list
                    if (_partPrimerList == null) _partPrimerList = new List<List<String>>();
                    _partPrimerList.Add(generatePrimers(-1, set0));
                    if (_l0PrimerList == null) _l0PrimerList = new List<List<String>>();
                    _l0PrimerList.Add(generatePrimers(0, set0));

                    partCounter++;
                }
                showPanel.Children.Add(set1);

                //If more than one Part in sublist, generate primers for the L1 DV and add to list
                if (sublist.Count > 1)
                {
                    if (_l1PrimerList == null) _l1PrimerList = new List<List<String>>();
                    _l1PrimerList.Add(generatePrimers(1, set1));
                    l1DV.IsEnabled = true;
                    l1DV.Visibility = Visibility.Visible;
                }

                partCounter = 0;
                sublistCounter++;

            //If more than one sublist/L1 module in _partList, generate primers for the L2 DV and add to list
            }if (_partList.Count > 1)
            {
                if (_l2PrimerList == null) _l2PrimerList = new List<List<String>>();
                _l2PrimerList.Add(generatePrimers(2, showPanel));
                l2DV.IsEnabled = true;
                l2DV.Visibility = Visibility.Visible;
            }

            //On initialization, auto-select first Part
            StackPanel show = (StackPanel)VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(showPanel, 0),0);
            show.Background = new SolidColorBrush(Colors.WhiteSmoke);
            pcr.IsChecked = true;
        }
        public PrimerDesigner1(UIElement[][] partSiteSetsFromPD2)
        {
            InitializeComponent();
            Part.pd1 = this;
            SurfaceWindow1.pd1 = this;
            _partSiteSets = partSiteSetsFromPD2;
            _progressBarWrapper = new ProgressBarWrapper(new Action(showProgressBar), new Action(hideProgressBar));

            //Populate showPanel with elements grouped into StackPanels
            //Grouping helps determine which Parts and Sites data to display when one member is selected
            StackPanel firstPanel = new StackPanel();
            firstPanel.Children.Add(_partSiteSets[0][0]);
            showPanel.Children.Add(firstPanel);
            firstPanel.Visibility = Visibility.Collapsed;

            for (int i = 1; i < _partSiteSets.Count() - 1; i++)
            {
                StackPanel set = new StackPanel();
                foreach (UIElement element in _partSiteSets[i])
                {
                    set.Children.Add(element);
                }
                showPanel.Children.Add(set);
            }

            StackPanel lastPanel = new StackPanel();
            lastPanel.Children.Add(_partSiteSets[_partSiteSets.Count() - 1][0]);
            showPanel.Children.Add(lastPanel);
            lastPanel.Visibility = Visibility.Collapsed;

            foreach (StackPanel sp in showPanel.Children)
            {
                foreach (UIElement elem in sp.Children) elem.IsManipulationEnabled = false;
                sp.Orientation = System.Windows.Controls.Orientation.Horizontal;
                sp.Background = new SolidColorBrush(Colors.Transparent);
                sp.Margin = new Thickness(3);
            }


            //Currently, show first part
            showSetData(0, _l0PrimerList);
        }