Example #1
0
        private void MetroProgressBar_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            MetroProgressBar bar = sender as MetroProgressBar;

            //Console.WriteLine(bar.Value);
            if (bar.Value == 100)
            {
                Grid pp    = (Grid)bar.Parent;
                Grid panel = (Grid)pp.Parent;
                foreach (var ob in panel.Children)
                {
                    if (ob is MediaElement)
                    {
                        MediaElement el = (MediaElement)ob;
                        el.Name = "Playing";
                        el.Play();
                        pp.Visibility = Visibility.Hidden;
                        //break;
                    }
                    if (ob is Grid && ob != pp)
                    {
                        Grid ss = ob as Grid;
                        ss.Visibility = Visibility.Visible;
                    }
                }
            }
        }
Example #2
0
 public GUIAnimator(GFXContainer gfx, LevelSet lvl, TimingSource.Sources timingSrc, MetroProgressBar pgJumpRes)
 {
     this.Gfx       = gfx;
     this.Lvl       = lvl;
     this.pgJumpRes = pgJumpRes;
     IsActive       = true;
     SetTimingSource(timingSrc);
 }
Example #3
0
        private void progImgbar_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            MetroProgressBar bar = sender as MetroProgressBar;

            //Console.WriteLine(bar.Value);
            if (bar.Value == 100)
            {
                Grid pp = (Grid)bar.Parent;
                pp.Visibility = Visibility.Hidden;
            }
        }
Example #4
0
        void LoadProjectsToFlowLayoutPanel()
        {
            flp_Projects.Controls.Clear();

            foreach (Project p in ProjectController.getListProjects())
            {
                if (p.Status == 0)
                {
                    FlowLayoutPanel flp = new FlowLayoutPanel {
                        Width = flp_Projects.Width - 30, Height = 70
                    };

                    MetroLabel mlb = new MetroLabel
                    {
                        Text      = p.Name,
                        Width     = flp_Projects.Width - 30,
                        Height    = 25,
                        FontSize  = MetroFramework.MetroLabelSize.Tall,
                        BackColor = Color.Transparent
                    };

                    MetroProgressBar pgb = new MetroProgressBar
                    {
                        Value    = LoadValueProject(p),
                        Width    = flp_Projects.Width - 280,
                        Height   = 15,
                        Location = new Point(0, 15),
                        Style    = p.EndDate.Value < DateTime.Now ? MetroFramework.MetroColorStyle.Red : MetroFramework.MetroColorStyle.Green,
                    };

                    MetroLabel lb = new MetroLabel
                    {
                        Text  = pgb.Value.ToString() + "%",
                        Width = 50
                    };

                    MetroLink mtl = new MetroLink {
                        Text = "Chi tiết", Width = 150, Tag = p.ID
                    };
                    mtl.Click += Mtl_Click;

                    flp.Controls.Add(mlb);
                    flp.Controls.Add(pgb);
                    flp.Controls.Add(lb);
                    flp.Controls.Add(mtl);

                    flp_Projects.Controls.Add(flp);
                }
            }
        }
        private void ViewModel_Loading(object sender, LoadingEventArgs e)
        {
            if (e.Loading)
            {
                StackPanel panel = new StackPanel()
                {
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Orientation         = Orientation.Vertical
                };
                MetroProgressBar progressBar = new MetroProgressBar()
                {
                    IsIndeterminate = true,

                    Minimum    = 0,
                    Maximum    = 100,
                    Width      = 200,
                    Foreground = (Brush)FindResource("AccentColorBrush"),
                    Margin     = new Thickness(0, 10, 0, 0)
                };
                ProgressRing progressRing = new ProgressRing()
                {
                    IsActive = true,
                    Width    = 40,
                    Height   = 40
                };
                TextBlock message = new TextBlock()
                {
                    FontFamily = (FontFamily)FindResource("HeaderFontFamily"),
                    FontSize   = (double)FindResource("WindowTitleFontSize"),
                    Foreground = (Brush)FindResource("WhiteBrush"),
                    Text       = e.Message,
                    Margin     = new Thickness(0, 25, 0, 0)
                };
                panel.Children.Add(progressRing);
                panel.Children.Add(message);
                this.ShowOverlay(panel);
            }
            else
            {
                this.HideOverlay();
            }
        }
Example #6
0
        private void reDownloadButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (statusListview.SelectedItems[0].SubItems[2].Text == "100")
                {
                    MetroProgressBar progress = new MetroProgressBar();
                    string           fileName = statusListview.SelectedItems[0].SubItems[0].Text;
                    statusListview.SelectedItems[0].SubItems[3].Text = "Download";
                    progress       = statusListview.Controls.OfType <MetroProgressBar>().FirstOrDefault(q => q.Name == fileName);
                    progress.Value = 0;

                    controller.reDownload(fileName);
                }
            }

            catch
            {
                MessageBox.Show("다시 다운할 파일을 클릭 후 진행해 주세요.", "알림");
            }
        }
Example #7
0
        public void Learn(ref List <List <double> > data, int numIterations, ref MetroProgressBar pb)
        {
            Random randomizer        = new Random();
            double mapRadius         = Nodes.Count;
            double timeConstant      = numIterations / Math.Log(mapRadius);
            double startLearningRate = 0.6;

            int    currentIteration    = 1;
            double learningRate        = startLearningRate;
            int    currentInputVector  = -1;
            double neighbourhoodRadius = mapRadius;
            double error = 1.0;

            while (currentIteration < numIterations && error >= 0.0001)
            {
                currentInputVector = (1 + currentInputVector) % data.Count;
                Neuron bmu = FindBMU(data[currentInputVector]);
                error = calcError(bmu.weigth, data[currentInputVector]);

                for (int i = 0; i < Nodes.Count; ++i)
                {
                    for (int j = 0; j < Nodes[i].Count; ++j)
                    {
                        double distanceToNode = Math.Sqrt(Math.Pow(bmu.x - Nodes[i][j].x, 2)
                                                          + Math.Pow(bmu.y - Nodes[i][j].y, 2));

                        if (distanceToNode < neighbourhoodRadius)
                        {
                            Nodes[i][j].SetNewWeightVector(data[currentInputVector], learningRate);
                        }
                    }
                }
                currentIteration   += 1;
                learningRate        = startLearningRate * Math.Exp(-currentIteration / numIterations);
                neighbourhoodRadius = mapRadius * Math.Exp(-(double)currentIteration / timeConstant);
                pb.Increment(1);
            }
        }
Example #8
0
        /// <summary>
        /// using this Method to Point at Controls in the Main form so we can Invoke those Controls and updates there values
        /// </summary>
        /// <param name="MetroProgressBarCONTROL"> ProgressPar of Main Form</param>
        /// <param name="MetroLabelCONTROL">Lable of User Target Count at Mentoring tap</param>
        /// <returns>Main Thread that Run all of this Operation</returns>
        public Thread SetController(MetroProgressBar MetroProgressBarCONTROL, MetroLabel MetroLabelCONTROL)
        {
            // Set the Constrain Slots for Progess to be ready.
            progressPar         = MetroProgressBarCONTROL;
            progressPar.Minimum = 0;
            switch (CampaignType)
            {
            case Campaign.Small:
                progressPar.Maximum = (int)CampaignSlots.Small;
                break;

            case Campaign.Mid:
                progressPar.Maximum = (int)CampaignSlots.Mid;
                break;

            case Campaign.Large:
                progressPar.Maximum = (int)CampaignSlots.Large;
                break;
            }

            targetUserCount = MetroLabelCONTROL;
            return(operationalThread);
        }
Example #9
0
        public void ValueAdd(IModel model, ModelEventArgs e)
        {
            // [0] 파일이름
            // [1] 표기 용량
            // [2] 실제 용량
            // [3] 업/ 다운 구분

            string[] info     = e.newval.Split(',');
            string   fileName = info[0];
            string   len      = info[1];
            string   status   = info[3];

            ListViewItem     item     = new ListViewItem();
            MetroProgressBar progress = new MetroProgressBar();

            statusListview.BeginUpdate();

            item.SubItems[0].Text = fileName;
            item.SubItems.Add(len);
            item.SubItems.Add("");
            item.SubItems.Add(status);

            statusListview.Items.Add(item);

            Rectangle r = item.SubItems[2].Bounds;

            progress.SetBounds(r.X + 30, r.Y, r.Width - 30, r.Height);
            progress.Maximum = 100;
            progress.Minimum = 0;
            progress.Value   = 0;
            progress.Parent  = statusListview;
            progress.Visible = true;
            progress.Name    = fileName;

            statusListview.EndUpdate();
        }
Example #10
0
 private void InitializeComponent()
 {
     this.Icon   = Resources.Starflier;
     this.label1 = new System.Windows.Forms.Label();
     this.settingsBackgroundWorker      = new System.ComponentModel.BackgroundWorker();
     this.startDownloadBackgroundWorker = new System.ComponentModel.BackgroundWorker();
     this.metroProgressSpinner1         = new MetroFramework.Controls.MetroProgressSpinner();
     this.ProgressBar = new MetroFramework.Controls.MetroProgressBar();
     this.SuspendLayout();
     //
     // label1
     //
     this.label1.Anchor    = System.Windows.Forms.AnchorStyles.None;
     this.label1.ForeColor = System.Drawing.SystemColors.Control;
     this.label1.Location  = new System.Drawing.Point(47, 17);
     this.label1.Name      = "label1";
     this.label1.Size      = new System.Drawing.Size(275, 28);
     this.label1.TabIndex  = 1;
     this.label1.Text      = "Updating launcher, please wait.";
     this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     //
     // settingsBackgroundWorker
     //
     this.settingsBackgroundWorker.WorkerReportsProgress = true;
     this.settingsBackgroundWorker.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
     this.settingsBackgroundWorker.ProgressChanged    += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
     this.settingsBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
     //
     // startDownloadBackgroundWorker
     //
     this.startDownloadBackgroundWorker.WorkerReportsProgress = true;
     this.startDownloadBackgroundWorker.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.startDownloadBackgroundWorker_DoWork);
     this.startDownloadBackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.startDownloadBackgroundWorker_RunWorkerCompleted);
     //
     // metroProgressSpinner1
     //
     this.metroProgressSpinner1.Anchor        = System.Windows.Forms.AnchorStyles.None;
     this.metroProgressSpinner1.Location      = new System.Drawing.Point(23, 11);
     this.metroProgressSpinner1.Maximum       = 100;
     this.metroProgressSpinner1.Name          = "metroProgressSpinner1";
     this.metroProgressSpinner1.Size          = new System.Drawing.Size(35, 33);
     this.metroProgressSpinner1.Style         = MetroFramework.MetroColorStyle.Blue;
     this.metroProgressSpinner1.TabIndex      = 2;
     this.metroProgressSpinner1.Theme         = MetroFramework.MetroThemeStyle.Dark;
     this.metroProgressSpinner1.UseSelectable = true;
     //
     // ProgressBar
     //
     this.ProgressBar.Anchor   = System.Windows.Forms.AnchorStyles.None;
     this.ProgressBar.Location = new System.Drawing.Point(27, 48);
     this.ProgressBar.Name     = "ProgressBar";
     this.ProgressBar.Size     = new System.Drawing.Size(295, 23);
     this.ProgressBar.Style    = MetroFramework.MetroColorStyle.Blue;
     this.ProgressBar.TabIndex = 3;
     this.ProgressBar.Theme    = MetroFramework.MetroThemeStyle.Dark;
     //
     // Patch
     //
     this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
     this.ClientSize          = new System.Drawing.Size(345, 79);
     this.ControlBox          = false;
     this.Controls.Add(this.ProgressBar);
     this.Controls.Add(this.metroProgressSpinner1);
     this.Controls.Add(this.label1);
     this.Name            = "Patch";
     this.Resizable       = false;
     this.Theme           = MetroThemeStyle.Dark;
     this.TopMost         = true;
     this.TransparencyKey = Color.PaleTurquoise;
     this.Shown          += new EventHandler(this.Form1_Shown);
     this.ResumeLayout(false);
 }
Example #11
0
        public void Build()
        {
            if (built)
            {
                return;
            }
            if (item == null)
            {
                built = true;
                return;
            }

            Grid DisplayGrid = new Grid();

            DisplayGrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            DisplayGrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            DisplayGrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            DisplayGrid.RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });
            DisplayGrid.RowDefinitions.Add(new RowDefinition());

            DisplayGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });
            DisplayGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = GridLength.Auto
            });
            DisplayGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(400)
            });
            DisplayGrid.ColumnDefinitions.Add(new ColumnDefinition());

            var margin = new Thickness(2.5);

            border = new Border
            {
                Margin          = margin,
                BorderThickness = new Thickness(1)
            };
            border.SetResourceReference(Border.BorderBrushProperty, "BlackBrush");

            border.Child = DisplayGrid;

            Tile stopButton = new Tile
            {
                Width   = 50,
                Height  = 50,
                Margin  = margin,
                Content = new PackIconModern {
                    Width = 40, Height = 40, Kind = PackIconModernKind.Close
                },
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            stopButton.Click += async(s, e) =>
            {
                var remove = await item.Cancel();

                if (remove)
                {
                    GlobalConsts.Downloads.Remove(this);
                }
            };

            //Col 0:
            Grid.SetRow(stopButton, 0);
            Grid.SetRowSpan(stopButton, 6);
            Grid.SetColumn(stopButton, 0);


            Image image = new Image
            {
                Width  = 200,
                Height = 112.5,
                Margin = margin,
                Source = new BitmapImage(new Uri(item.ImageUrl)),
            };

            //Col 1:
            Grid.SetRow(image, 0);
            Grid.SetRowSpan(image, 6);
            Grid.SetColumn(image, 1);

            TextBlock
                title = new TextBlock
            {
                TextWrapping = TextWrapping.Wrap,
                Margin       = margin,
                FontSize     = 14,
                Text         = item.Title
            },
                currentTitle = new TextBlock
            {
                TextWrapping = TextWrapping.Wrap,
                Margin       = margin,
                FontSize     = 14
            },
                totalDownloaded = new TextBlock
            {
                TextWrapping = TextWrapping.Wrap,
                Margin       = margin,
                FontSize     = 14
            },
                currentStatus = new TextBlock
            {
                TextWrapping = TextWrapping.Wrap,
                Margin       = margin,
                FontSize     = 14
            },
                downloadSpeed = new TextBlock
            {
                TextWrapping = TextWrapping.Wrap,
                Margin       = margin,
                FontSize     = 14
            },
                downloadPrecent = new TextBlock
            {
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            //Col 2:
            Grid.SetRow(title, 0);
            Grid.SetColumn(title, 2);
            Grid.SetRow(currentTitle, 1);
            Grid.SetColumn(currentTitle, 2);
            Grid.SetRow(totalDownloaded, 2);
            Grid.SetColumn(totalDownloaded, 2);
            Grid.SetRow(currentStatus, 3);
            Grid.SetColumn(currentStatus, 2);
            Grid.SetRow(downloadSpeed, 4);
            Grid.SetColumn(downloadSpeed, 2);

            Binding
                currentTitleBinding = new Binding
            {
                Source = item,
                Path   = new PropertyPath("CurrentTitle"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.OneWay
            },
                totalDownloadedBinding = new Binding
            {
                Source = item,
                Path   = new PropertyPath("TotalDownloaded"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.OneWay
            },
                currentStatusBinding = new Binding
            {
                Source = item,
                Path   = new PropertyPath("CurrentStatus"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.OneWay
            },
                downloadSpeedBinding = new Binding
            {
                Source = item,
                Path   = new PropertyPath("CurrentDownloadSpeed"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.OneWay
            },
                progressBinding = new Binding
            {
                Source = item,
                Path   = new PropertyPath("CurrentProgressPrecent"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.OneWay
            },
                downloadPrecentBinding = new Binding
            {
                Source = item,
                Path   = new PropertyPath("CurrentProgressPrecent"),
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.OneWay
            };

            Grid progressBarGrid = new Grid {
                Margin = margin
            };

            MetroProgressBar
                progressBar = new MetroProgressBar
            {
                Width             = 550,
                Height            = 30,
                VerticalAlignment = VerticalAlignment.Center
            };

            progressBarGrid.Children.Add(progressBar);
            progressBarGrid.Children.Add(downloadPrecent);

            //Col 3:
            Grid.SetRow(progressBarGrid, 0);
            Grid.SetRowSpan(progressBarGrid, 6);
            Grid.SetColumn(progressBarGrid, 3);

            currentTitle.SetBinding(TextBlock.TextProperty, currentTitleBinding);
            totalDownloaded.SetBinding(TextBlock.TextProperty, totalDownloadedBinding);
            currentStatus.SetBinding(TextBlock.TextProperty, currentStatusBinding);
            downloadSpeed.SetBinding(TextBlock.TextProperty, downloadSpeedBinding);
            progressBar.SetBinding(ProgressBar.ValueProperty, progressBinding);
            downloadPrecent.SetBinding(TextBlock.TextProperty, downloadPrecentBinding);

            //add everything to grid
            DisplayGrid.Children.Add(stopButton);
            DisplayGrid.Children.Add(image);
            DisplayGrid.Children.Add(title);
            DisplayGrid.Children.Add(currentTitle);
            DisplayGrid.Children.Add(totalDownloaded);
            DisplayGrid.Children.Add(currentStatus);
            DisplayGrid.Children.Add(downloadSpeed);
            DisplayGrid.Children.Add(progressBarGrid);

            built = true;
        }
        public List <string> GetWONBR(DateTime fecha1, DateTime fecha2, string id_cliente, DateTime fecha_r, string c_cliente, MetroProgressBar view_r)
        {
            try
            {
                int           contador = 0;
                string        consulta = "";
                List <string> vs       = new List <string>();

                if (id_cliente == String.Empty)
                {
                    consulta = "";
                }
                else
                {
                    consulta = "AND SOHeader.CustID = '" + id_cliente + "'";
                }

                var resurtimineto = dbd.Reporte1(fecha1.ToString("yyyy-MM-dd"), fecha2.ToString("yyyy-MM-dd"), consulta, "");
                if (resurtimineto != null)
                {
                    contador       = resurtimineto.Count;
                    view_r.Minimum = 0;
                    view_r.Maximum = contador;
                    foreach (var item in resurtimineto)
                    {
                        view_r.Value = view_r.Value + 1;
                        vs.Add(item.po);
                    }
                }

                var WONBR = vs.Distinct().ToList();
                return(WONBR);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(null);
            }
        }
        public bool GetReporte(DateTime fecha1, DateTime fecha2, string id_cliente, MetroProgressBar view_r, CheckedListBox Wonbr, Cursor cursor)
        {
            string consulta   = "";
            string consulta2  = "";
            string fecha      = "DEL " + fecha1.ToString("dd/MMMM/yyyy") + " AL " + fecha2.ToString("dd/MMMM/yyyy");
            string cliente    = "";
            int    contador   = 0;
            int    diasF      = 0;
            int    diasA      = 0;
            int    diasMargen = 0;
            int    dias       = 0;

            dsResurtimineto        res = new dsResurtimineto();
            crSurtimientoEntregado cr  = new crSurtimientoEntregado();

            res.dsGeneral.AdddsGeneralRow(fecha, cliente);
            try
            {
                cursor = Cursors.WaitCursor;
                //ARMAMOS LA CONUSLTA PARA LOS CLIENTES
                if (id_cliente == String.Empty)
                {
                    consulta = "";
                }
                else
                {
                    consulta = "and CustID = '" + id_cliente + "'";
                }
                //ARMAMOS LA CONUSLTA PARA LAS ORDENES DE TRABAJO
                if (Wonbr.CheckedItems.Count > 0)
                {
                    consulta2 = "and (";
                    foreach (string item in Wonbr.CheckedItems)
                    {
                        consulta2 = consulta2 + "WONbr = '" + item + "' OR ";
                    }
                    consulta2 = consulta2.TrimEnd(' ');
                    consulta2 = consulta2.TrimEnd('R');
                    consulta2 = consulta2.TrimEnd('O');
                    consulta2 = consulta2 + ")";
                }

                using (PLMContext db = new PLMContext())
                {
                    var resurtimineto = dbd.RSVW_REPSURTIMIENTOCANTSURTIDAs(fecha1.ToString("yyyy-MM-dd"), fecha2.ToString("yyyy-MM-dd"), consulta, consulta2);
                    //OBTENEMOS LOS DIAS DE ANTICIPACION Y LOS DIAS DE MARGEN
                    try
                    {
                        diasA      = (from x in db.DiasAnticipacion select new { x.DiasA }).FirstOrDefault().DiasA;
                        diasMargen = (from x in db.DiasAnticipacion select new { x.DiasdeMargen }).FirstOrDefault().DiasdeMargen;
                    }
                    catch (Exception e)
                    {
                        diasA = 0;
                    }

                    if (resurtimineto == null)
                    {
                        return(false);
                    }

                    contador       = resurtimineto.Count;
                    view_r.Minimum = 0;
                    view_r.Maximum = contador;

                    foreach (var item in resurtimineto)
                    {
                        view_r.Value = view_r.Value + 1;
                        //OBTENEMOS LOS DIAS FERIADOS
                        diasF = (from x in db.DiasFeriados where x.DiasF >= fecha1 && x.DiasF <= fecha2 && x.Proveedor == item.Proveedor select new { x.id }).Count();

                        DateTime fecha_embarque     = Convert.ToDateTime(item.FechaEmbarque);
                        DateTime fecha_recepcion    = new DateTime();
                        decimal  cantidad_recepcion = 0;
                        if (item.FechaRecepcion != "")
                        {
                            fecha_recepcion = Convert.ToDateTime(item.FechaRecepcion);
                        }
                        if (item.CantidadRecepcion != "")
                        {
                            cantidad_recepcion = Convert.ToDecimal(item.CantidadRecepcion);
                        }

                        res.dsReporte2.AdddsReporte2Row(item.InvtID, "", item.WONbr, item.OrdenVenta, item.Po,
                                                        fecha_embarque.ToString("dd/MMMM/yyyy"),
                                                        fecha_recepcion.ToString("dd/MMMM/yyyy"),
                                                        cantidad_recepcion, item.Proveedor);
                    }
                }

                cr.SetDataSource(res);
                vistaReporte2 view = new vistaReporte2();
                view.crv.ReportSource = cr;
                view.ShowDialog();
                view.BringToFront();

                cursor = Cursors.Default;
                return(true);
            }catch (Exception e)
            {
                return(false);
            }
        }
 public MetroProgressBarWidget(MetroProgressBar barControl, MetroLabel titleControl, MetroLabel statusControl)
 {
     _barControl    = barControl;
     _titleControl  = titleControl;
     _statusControl = statusControl;
 }
Example #15
0
 public MetroProgressBarActionList(IComponent component) : base(component)
 {
     _metroProgressBar = (MetroProgressBar)component;
 }
Example #16
0
        /// <summary>
        /// A simple extension method for animating progress smoothly.
        /// </summary>
        /// <param name="progressBar"></param>
        /// <param name="percentage"></param>
        /// <param name="delay"></param>
        public static void SetPercent(this MetroProgressBar progressBar, double percentage, TimeSpan delay)
        {
            DoubleAnimation animation = new DoubleAnimation(percentage, delay);

            progressBar.BeginAnimation(MetroProgressBar.ValueProperty, animation);
        }
        public bool GetReporte(DateTime fecha1, DateTime fecha2, string id_cliente, DateTime fecha_r, MetroProgressBar view_r, string c_cliente, CheckedListBox Wonbr, Cursor cursor)
        {
            try
            {
                cursor = Cursors.WaitCursor;
                dsResurtimineto res       = new dsResurtimineto();
                crResurtimineto cr        = new crResurtimineto();
                string          consulta  = "";
                string          consulta2 = "";
                string          fecha     = "DEL " + fecha1.ToString("dd/MMMM/yyyy") + " AL " + fecha2.ToString("dd/MMMM/yyyy");
                string          cliente   = c_cliente.ToUpper();

                int contador   = 0;
                int diasF      = 0;
                int diasA      = 0;
                int diasMargen = 0;
                int dias       = 0;

                List <ot>     ordenes_trabajo = new List <ot>();
                List <string> vs = new List <string>();

                res.dsGeneral.AdddsGeneralRow(fecha, cliente);

                if (id_cliente == String.Empty)
                {
                    consulta = "";
                }
                else
                {
                    consulta = "AND SOHeader.CustID = '" + id_cliente + "'";
                }

                if (Wonbr.CheckedItems.Count > 0)
                {
                    consulta2 = "and (";
                    foreach (string item in Wonbr.CheckedItems)
                    {
                        consulta2 = consulta2 + "A.WONbr = '" + item + "' OR ";
                    }
                    consulta2 = consulta2.TrimEnd(' ');
                    consulta2 = consulta2.TrimEnd('R');
                    consulta2 = consulta2.TrimEnd('O');
                    consulta2 = consulta2 + ")";
                }

                using (PLMContext db = new PLMContext())
                {
                    var resurtimineto = dbd.Reporte1(fecha1.ToString("yyyy-MM-dd"), fecha2.ToString("yyyy-MM-dd"), consulta, consulta2);
                    try
                    {
                        diasA      = (from x in db.DiasAnticipacion select new { x.DiasA }).FirstOrDefault().DiasA;
                        diasMargen = (from x in db.DiasAnticipacion select new { x.DiasdeMargen }).FirstOrDefault().DiasdeMargen;
                    }
                    catch (Exception e)
                    {
                        diasA = 0;
                    }

                    if (resurtimineto != null)
                    {
                        contador       = resurtimineto.Count;
                        view_r.Minimum = 0;
                        view_r.Maximum = contador;

                        foreach (var item in resurtimineto)
                        {
                            view_r.Value = view_r.Value + 1;
                            try
                            {
                                ot orden = new ot();
                                diasF = (from x in db.DiasFeriados where x.DiasF >= fecha1 && x.DiasF <= fecha2 && x.Proveedor == item.proveedor select new { x.id }).Count();

                                DateTime fecha_ent      = fecha_r.AddDays(Convert.ToInt64(item.tiempo_entrega));
                                DateTime fecha_proy     = Convert.ToDateTime(item.fecha_embarque);
                                DateTime fecha_embarque = Convert.ToDateTime(item.fecha_embarque);

                                dias       = (diasA + diasMargen) * -1;
                                fecha_proy = fecha_proy.AddDays(dias);

                                fecha_ent = fecha_ent.AddDays(diasF);

                                TimeSpan timeSpan = fecha_proy - fecha_ent;

                                orden.OT      = item.ot;
                                orden.PO      = item.po;
                                orden.CantFab = item.cant_fabr;
                                vs.Add(item.po);
                                ordenes_trabajo.Add(orden);

                                res.dsReporte.AdddsReporteRow(item.clave, item.descripcion, Convert.ToDecimal(item.cant_ord), item.ot, item.tipo_material, Convert.ToDecimal(item.existencia)
                                                              , item.unidad_compra, item.orden_venta, item.po, Convert.ToDecimal(item.adicional), Convert.ToDecimal(item.cantidad_ordenes_venta), item.cod_proveedor, item.desc_proveedor, item.proveedor,
                                                              item.tiempo_entrega, fecha_proy.ToString("dd/MM/yyyy"), item.cliente_id, fecha_r.ToString("dd/MM/yyyy"), fecha_ent.ToString("dd/MM/yyyy"), timeSpan.Days, fecha_embarque.ToString("dd/MM/yyyy"));
                            }
                            catch (Exception e)
                            {
                            }
                        }

                        var     aux2 = vs.Distinct().ToList();
                        string  c    = "";
                        decimal suma = 0;

                        foreach (var item in aux2)
                        {
                            c    = "";
                            suma = 0;
                            var concat = (from x in ordenes_trabajo where x.PO == item select new { x.OT, x.CantFab }).Distinct().ToList();
                            foreach (var item2 in concat)
                            {
                                c    = c + " , " + item2.OT;
                                suma = suma + Convert.ToDecimal(item2.CantFab);
                            }

                            c = c.Substring(2);
                            res.dsOT.AdddsOTRow(item, c, suma);
                        }

                        cursor = Cursors.Default;
                        //cr.Load(Path.GetFullPath("crResurtimineto.rpt"));
                        cr.SetDataSource(res);
                        vistaReporte2 view = new vistaReporte2();
                        view.crv.ReportSource = cr;
                        view.ShowDialog();
                        view.BringToFront();

                        return(true);
                    }
                }
                return(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(false);
            }
        }