Beispiel #1
0
        internal void Select(TEntityAction entityAction)
        {
            // DATA IN:
            // action.CollectionAction.ModelCollection

            entityAction.ThrowNull();

            //Registrations.Clear ();
            ItemsSource.Clear();

            var gadgets = new Collection <TActionComponent> ();

            TActionConverter.Collection(TCategory.Registration, gadgets, entityAction);

            foreach (var model in gadgets)
            {
                ItemsSource.Add(model.Models.GadgetRegistrationModel);
            }

            //foreach (var gadget in action.CollectionAction.GadgetRegistrationCollection) {
            //  if (action.CollectionAction.ModelCollection.ContainsKey (gadget.Id)) {
            //    var modelAction = action.CollectionAction.ModelCollection [gadget.Id];
            //    modelAction.GadgetRegistrationModel.CopyFrom (gadget);

            //    action.ModelAction.CopyFrom (modelAction);

            //    var item = TComponentModelItem.Create (action);

            //    Registrations.Add (item);
            //    RegistrationItemsSource.Add (item);
            //  }
            //}

            SelectedIndex = ItemsSource.Any() ? 0 : -1;
        }
Beispiel #2
0
        /// <summary>
        /// 選択肢を設定する。
        /// </summary>
        /// <param name="range">選択肢の日付範囲</param>
        private void SetDateList(RDatePickerConfig range)
        {
            TraceUtility.Trace();

            // 現在の選択項目を退避。
            object selected = SelectedItem;

            // スピナー選択肢をクリアする。
            if (ItemsSource != null)
            {
                ItemsSource.Clear();
            }

            // 引数で指定された日付範囲どおりに選択肢を設定する。
            List <DateTime> list = new List <DateTime>();

            for (DateTime i = range.From; i <= range.To; i = i.AddDays(1))
            {
                list.Add(i.Date);
            }
            ItemsSource = list;

            // 選択肢の決定。
            if (range.InitialSelectDate != DateTime.MinValue)
            {
                SelectedItem = range.InitialSelectDate.Date;
            }
            else
            {
                SelectedItem = selected;
            }
        }
Beispiel #3
0
        async Task RefreshAsync()
        {
            CurrentPageNumber = 0;

            var realm = Realm.GetInstance();

            var currentThread = realm.All <SettingsRealmObject>().First().CurrentNode.CurrentThread;

            MaxPageNumber = await currentThread.UpdateAsync();

            ItemsSource.Clear();
            var comments = currentThread.Comments.OrderByDescending(o => o.CommentDateTime).ToList();

            System.Diagnostics.Debug.WriteLine("Comments count: " + comments.Count);
            realm.Write(() =>
            {
                for (var i = 0; i < comments.Count(); i++)
                {
                    var comment     = comments[i];
                    comment.IsFirst = false;
                    comment.IsLast  = false;
                    if (i == 0)
                    {
                        comment.IsFirst = true;
                    }
                    if (i == comments.Count() - 1)
                    {
                        comment.IsLast = true;
                    }
                    ItemsSource.Add(comment);
                }
            });
        }
        void loadImages(Func <int> complete)
        {
            Debug.WriteLine("_searchText " + _searchText);
            if (_searchText == null || _searchText == "")
            {
                ItemsSource.Clear();
                return;
            }

            GoogleImagesService
            .searchImages(_searchText)
            .Subscribe(images => {
                var itemsSource = new ObservableCollection <CellData>();
                foreach (var item in images.items)
                {
                    var cellData = new CellData {
                        image    = item.image.thumbnailLink,
                        title    = item.title,
                        subtitle = _searchText
                    };
                    itemsSource.Add(cellData);
                }
                ItemsSource = itemsSource;
            });

            //ItemsSource = new ObservableCollection<CellData>{
            //	new CellData { image = "https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/1024px-Google_%22G%22_Logo.svg.png", title = "image 11",subtitle = _searchText},
            //	new CellData { image = "https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/1024px-Google_%22G%22_Logo.svg.png", title = "image 2",subtitle = _searchText},
            //	new CellData { image = "https://upload.wikimedia.org/wikipedia/commons/thumb/5/53/Google_%22G%22_Logo.svg/1024px-Google_%22G%22_Logo.svg.png", title = "image 3",subtitle = _searchText},
            //};
            complete();
        }
        private void CleanCleanBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var worker = (BackgroundWorker)sender;

            IsCleaningCache = true;
            OutputText      = string.Empty;
            ErrorText       = string.Empty;
            worker.ReportProgress(0);

            //使用CMD清理Winsxc等
            //CacheCacheByCmd(worker);
            //删除文件
            var toCleanFolders = SelectedItems.Select(I => I.ModuleFolder).ToList();

            Application.Current.Dispatcher.Invoke(() => { ItemsSource.Clear(); });
            CleanCacheUsingFileUtil(worker, toCleanFolders);

            //删除文件夹下所有的空文件夹
            foreach (var folder in ToCleanUpManager.GetFolders())
            {
                try
                {
                    FolderUtil.DeleteEmptyFolder(folder, false);
                }
                catch (Exception exception)
                {
                    LogHelper.Error(exception.Message);
                }
            }
        }
Beispiel #6
0
 public void Clear()
 {
     using (BeginChanging())
     {
         ItemsSource.Clear();
         Items.Clear();
     }
 }
        public async void Initialize()
        {
            ItemsSource.Clear();
            DatabasePath = DatabaseConfig.DbPath;
            var products = await _productService.Get();

            foreach (var p in products)
            {
                ItemsSource.Add(p);
            }
        }
Beispiel #8
0
        private async Task setContentAsync()
        {
            ItemsSource.Clear();
            this.InProgress = true;
            if (Near)
            {
                this.Location = await CurrentLocation.Get();
            }
            var stopItems = await calculateRoutes(Stop);

            ItemsSource.Add(createStopHeader(Stop, stopItems, !CurrentTime, Near, Location, ShowTransfers));
            this.InProgress = false;
        }
 private void MyReset()
 {
     TxtElecNum = String.Empty;
     ItemsSource.Clear();
     txtTotal = "0";
     try
     {
         foreach (String fileName in fileTmp)
         {
             System.IO.File.Delete(fileName);
         }
     }
     catch { }
 }
Beispiel #10
0
        private void MycmdExecute_Click()
        {
            try
            {
                ItemsSource.Clear();
                using (SqlExcuteCommand get = new SqlExcuteCommand()
                {
                    DBCnnStr = DBEndososCnnStr
                })
                {
                    //if (cbPartido_Item_Id > 1)
                    //    return;

                    String mpartido = isPartidos == true ? cbPartido[cbPartido_Item_Id].PartidoKey : String.Empty;   // cbPartido_Item.Split('-');

                    _MyLotsVoidTable = get.MyGetLotVoid(mpartido.ToString().Trim(), dpFchRecibo.ToString("MM/dd/yyyy"), isDuplicados, isFechaRecibo, isPartidos);
                    txtTotal         = string.Format("{0:N0}", _MyLotsVoidTable.Rows.Count);

                    foreach (DataRow r in _MyLotsVoidTable.Rows)
                    {
                        infoEndososRechazados myLotsVoid = new infoEndososRechazados();
                        myLotsVoid.Partido      = r["Partido"].ToString().Trim();
                        myLotsVoid.Lot          = r["Lot"].ToString().Trim();
                        myLotsVoid.Batch        = r["Batch"].ToString().Trim();
                        myLotsVoid.Formulario   = Convert.ToInt32(r["Formulario"].ToString().Trim());
                        myLotsVoid.Rechazo      = r["Rechazo"].ToString().Trim();
                        myLotsVoid.Causal       = r["Causal"].ToString().Trim();
                        myLotsVoid.NumElec      = r["NumElec"].ToString().Trim();
                        myLotsVoid.Status       = r["Status"].ToString().Trim();
                        myLotsVoid.Nombre       = r["Nombre"].ToString().Trim();
                        myLotsVoid.Paterno      = r["Paterno"].ToString().Trim();
                        myLotsVoid.Materno      = r["Materno"].ToString().Trim();
                        myLotsVoid.EndosoImage  = (Byte[])r["EndosoImage"];
                        myLotsVoid.Firma_Fecha  = r["Firma_Fecha"].ToString().Trim();
                        myLotsVoid.Fecha_Endoso = r["Fecha_Endoso"].ToString().Trim();
                        myLotsVoid.Fecha_Recibo = r["Fecha_Recibo"].ToString().Trim();
                        ItemsSource.Add(myLotsVoid);
                    }
                }
                MessageBox.Show("Done...\r\nTotal:" + string.Format("{0:N0}", _MyLotsVoidTable.Rows.Count), "Done", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            catch (Exception ex)
            {
                MethodBase site = ex.TargetSite;
                MessageBox.Show(ex.Message, site.Name, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #11
0
        private void MyRefresh()
        {
            using (SqlExcuteCommand get = new SqlExcuteCommand()
            {
                DBCnnStr = DBEndososCnnStr
            })
            {
                _MyPartidoTable = get.MyGetPartidos(WhatIsMode);
                cbPartido.Clear();
                ItemsSource.Clear();
                isPartidos = true;

                isPartidosEnabled = WhatIsMode == 1 ? false : true;


                cbPartido_Item = string.Empty;

                foreach (DataRow row in _MyPartidoTable.Rows)
                {
                    Partidos mypartido = new Partidos();
                    mypartido.Id         = (int)row["Id"];
                    mypartido.PartidoKey = row["Partido"].ToString();
                    mypartido.Desc       = row["Desc"].ToString();
                    mypartido.EndoReq    = (int)row["EndoReq"];
                    mypartido.Area       = row["Area"].ToString();
                    mypartido.Modo       = int.Parse(row["Modo"].ToString());

                    if (WhatIsMode == 1)
                    {
                        if (mypartido.Modo == 1)
                        {
                            cbPartido.Add(mypartido);
                        }
                    }
                    else
                    {
                        if (mypartido.Modo == 2)
                        {
                            cbPartido.Add(mypartido);
                        }
                    }
                }
                cbPartido.Sort();
                cbPartido_Item_Id = -1;
            }
        }
Beispiel #12
0
        public void ReLoad()
        {
            uint totalRecords;
            uint newPageSize;

            totalRecords = PageContract.GetTotalCount();
            if ((cmbPageSizes != null) && (cmbPageSizes.SelectedItem != null))
            {
                newPageSize = (uint)cmbPageSizes.SelectedItem;
            }
            else
            {
                newPageSize = 10;
            }

            if (totalRecords == 0)
            {
                ItemsSource.Clear();
                TotalPages = 1;
                Page       = 1;
            }
            else
            {
                TotalPages = (totalRecords / newPageSize) + (uint)((totalRecords % newPageSize == 0) ? 0 : 1);
            }

            uint newPage = 1;

            uint StartingIndex = (newPage - 1) * newPageSize;

            uint oldPage = Page;

            RaisePreviewPageChange(Page, newPage);

            Page = newPage;
            ItemsSource.Clear();

            ICollection <object> fetchData = PageContract.GetRecordsBy(StartingIndex, newPageSize, FilterTag);

            // ItemsSource.Clear();
            foreach (object row in fetchData)
            {
                ItemsSource.Add(row);
            }
            RaisePageChanged(oldPage, Page);
        }
        public virtual async Task UpdateCollectionAsync()
        {
            try
            {
                var newItems = await ModelService.GetAsync();

                ItemsSource.Clear();
                foreach (var model in newItems)
                {
                    AddModelToCollection(model);
                }
            }
            catch (Exception e)
            {
                // todo
                throw e;
            }
        }
Beispiel #14
0
    public void Lock (bool lockCurrent)
    {
      var current = Selection;  // preserve

      ItemsSource.Clear ();

      if (lockCurrent) {
        ItemsSource.Add (current);
      }

      // restore
      else {
        foreach (var item in m_SelectionAllCollection) {
          ItemsSource.Add (item);
        }
      }

      Select (current);
    }
Beispiel #15
0
        internal void Select(Collection <TActionComponent> gadgets)
        {
            gadgets.ThrowNull();

            ItemsSource.Clear();

            foreach (var component in gadgets)
            {
                if (component.IsCategory(TCategory.Test))
                {
                    ItemsSource.Add(component.Models.GadgetTestModel);
                }
            }

            if (ItemsSource.Any())
            {
                SelectedIndex = 0;
                Current.CopyFrom(ItemsSource [0]);
            }
        }
Beispiel #16
0
        internal void Select(TEntityAction entityAction)
        {
            entityAction.ThrowNull();

            ItemsSource.Clear();

            var gadgets = new Collection <TActionComponent> ();

            TActionConverter.Collection(TCategory.Material, gadgets, entityAction);

            foreach (var model in gadgets)
            {
                ItemsSource.Add(model.Models.GadgetMaterialModel);
            }

            if (ItemsSource.Any())
            {
                SelectedIndex = 0;
            }
        }
Beispiel #17
0
        /// <summary>
        /// 選択肢を設定する。
        /// </summary>
        /// <param name="range">選択肢の日付範囲</param>
        private void SetDateList(DateRange range)
        {
            // スピナー選択肢をクリアする。
            if (ItemsSource != null)
            {
                ItemsSource.Clear();
            }

            // 引数で指定された日付範囲どおりに選択肢を設定する。
            List <DateListPickerItem> list = new List <DateListPickerItem>();

            for (int i = (int)range.PastDays * -1; i <= range.FutureDays; i++)
            {
                list.Add(
                    new DateListPickerItem
                {
                    Date = range.StandardDate.AddDays(i).Date,
                });
            }
            ItemsSource = list;
        }
Beispiel #18
0
    public void Select (TEntityAction action)
    {
      ItemsSource.Clear ();
      m_SelectionAllCollection.Clear ();

      if (action.NotNull ()) {
        foreach (var item in action.SupportAction.SelectionCollection) {
          if (item.Enabled) {
            var selectionItem = TSelectionItem.Create (item.Name, item.Tag, item.GetImage (), item.Enabled);

            ItemsSource.Add (selectionItem);

            m_SelectionAllCollection.Add (selectionItem);
          }
        }
      }

      if (ItemsSource.Any ()) {
        SelectedIndex = 0;
      }
    }
Beispiel #19
0
        internal void RegistrationChanged(GadgetRegistration gadget)
        {
            if (gadget.NotNull())
            {
                ItemsSource.Clear();

                foreach (var item in GadgetResultDictionary)
                {
                    var gadgetResult = item.Value;

                    if (gadgetResult.IsRegistrationContent(gadget.Id))
                    {
                        ItemsSource.Add(gadgetResult);
                    }
                }

                if (ItemsSource.Any())
                {
                    ResultSelectedIndex = 0;
                }
            }
        }
Beispiel #20
0
        private void Navigate(PageChanges change)
        {
            uint totalRecords;
            uint newPageSize;

            if (PageContract == null)
            {
                return;
            }

            totalRecords = PageContract.GetTotalCount();
            newPageSize  = (uint)cmbPageSizes.SelectedItem;

            if (totalRecords == 0)
            {
                ItemsSource.Clear();
                TotalPages = 1;
                Page       = 1;
            }
            else
            {
                TotalPages = (totalRecords / newPageSize) + (uint)((totalRecords % newPageSize == 0) ? 0 : 1);
            }

            uint newPage = 1;

            switch (change)
            {
            case PageChanges.First:
                if (Page == 1)
                {
                    return;
                }
                break;

            case PageChanges.Previous:
                newPage = (Page - 1 > TotalPages) ? TotalPages : (Page - 1 < 1) ? 1 : Page - 1;
                break;

            case PageChanges.Current:
                newPage = (Page > TotalPages) ? TotalPages : (Page < 1) ? 1 : Page;
                break;

            case PageChanges.Next:
                newPage = (Page + 1 > TotalPages) ? TotalPages : Page + 1;
                //(Page + 1) < 1 ? 1 :
                break;

            case PageChanges.Last:
                if (Page == TotalPages)
                {
                    return;
                }
                newPage = TotalPages;
                break;

            default:
                break;
            }

            uint StartingIndex = (newPage - 1) * newPageSize;

            uint oldPage = Page;

            RaisePreviewPageChange(Page, newPage);

            Page = newPage;
            ItemsSource.Clear();

            ICollection <object> fetchData = PageContract.GetRecordsBy(StartingIndex, newPageSize, FilterTag);

            foreach (object row in fetchData)
            {
                ItemsSource.Add(row);
            }

            RaisePageChanged(oldPage, Page);
        }
Beispiel #21
0
        private void MycmdExecute_Click()
        {
            try
            {
                ItemsSource.Clear();
                using (SqlExcuteCommand get = new SqlExcuteCommand()
                {
                    DBCnnStr = DBEndososCnnStr
                })
                {
                    //if (cbPartido_Item_Id > 1)
                    //    return;

                    String mpartido = isPartidos == true ? cbPartido[cbPartido_Item_Id].PartidoKey : "";

                    _MyEstatusTable = get.MyGetInfoEstatus(mpartido, isPartidos);
                    int Endosos_Requeridos = 0;
                    int Endosos_Aceptados  = 0;
                    int Endosos_Rechazados = 0;
                    int Endosos_Procesados = 0;
                    int Endosos_Entregados = 0;
                    txtTotal = string.Format("{0:N0}", _MyEstatusTable.Rows.Count);


                    if (!isPartidos)
                    {
                        int         count         = 0;
                        String      mPartido      = String.Empty;
                        String      mTitulo       = String.Empty;
                        infoEstatus myinfoEstatus = new infoEstatus();
                        bool        misStart      = true;

                        foreach (DataRow d in _MyEstatusTable.Rows)
                        {
                            mTitulo = d["Titulo"].ToString();
                            if (mpartido != d["partido"].ToString().Trim())
                            {
                                if (!misStart)
                                {
                                    myinfoEstatus.Partido = mpartido;
                                    ItemsSource.Add(myinfoEstatus);
                                }
                                count++;
                                mpartido      = d["partido"].ToString().Trim();
                                myinfoEstatus = new infoEstatus();
                                misStart      = false;
                            }

                            switch (mTitulo)
                            {
                            case "Endosos_Requeridos":
                            {
                                int.TryParse(d["Total"].ToString().Trim(), out Endosos_Requeridos);
                                myinfoEstatus.Endosos_Requeridos = Endosos_Requeridos;
                            }
                            break;

                            case "Endosos_Aceptados":
                            {
                                int.TryParse(d["Total"].ToString().Trim(), out Endosos_Aceptados);
                                myinfoEstatus.Endosos_Aceptados = Endosos_Aceptados;
                            }
                            break;

                            case "Endosos_Rechazados":
                            {
                                int.TryParse(d["Total"].ToString().Trim(), out Endosos_Rechazados);
                                myinfoEstatus.Endosos_Rechazados = Endosos_Rechazados;
                            }
                            break;

                            case "Endosos_Procesados":
                            {
                                int.TryParse(d["Total"].ToString().Trim(), out Endosos_Procesados);
                                myinfoEstatus.Endosos_Procesados = Endosos_Procesados;
                            }
                            break;

                            case "Endosos_Entregados":
                            {
                                int.TryParse(d["Total"].ToString().Trim(), out Endosos_Entregados);
                                myinfoEstatus.Endosos_Entregados = Endosos_Entregados;
                            }
                            break;
                            }
                        }
                        myinfoEstatus.Partido = mpartido;
                        ItemsSource.Add(myinfoEstatus);
                        txtTotal = string.Format("{0:N0}", count);
                    }
                    else
                    {
                        foreach (DataRow d in _MyEstatusTable.Rows)
                        {
                            infoEstatus myinfoEstatus = new infoEstatus();
                            myinfoEstatus.Partido = d["Partido"].ToString();
                            int.TryParse(d["Endosos_Requeridos"].ToString().Trim(), out Endosos_Requeridos);
                            int.TryParse(d["Endosos_Aceptados"].ToString().Trim(), out Endosos_Aceptados);
                            int.TryParse(d["Endosos_Rechazados"].ToString().Trim(), out Endosos_Rechazados);
                            int.TryParse(d["Endosos_Procesados"].ToString().Trim(), out Endosos_Procesados);
                            int.TryParse(d["Endosos_Entregados"].ToString().Trim(), out Endosos_Entregados);
                            myinfoEstatus.Endosos_Requeridos = Endosos_Requeridos;
                            myinfoEstatus.Endosos_Aceptados  = Endosos_Aceptados;
                            myinfoEstatus.Endosos_Rechazados = Endosos_Rechazados;
                            myinfoEstatus.Endosos_Procesados = Endosos_Procesados;
                            myinfoEstatus.Endosos_Entregados = Endosos_Entregados;
                            ItemsSource.Add(myinfoEstatus);
                        }
                    }
                }
                MessageBox.Show("Done...", "Done", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            catch (Exception ex)
            {
                MethodBase site = ex.TargetSite;
                MessageBox.Show(ex.Message, site.Name, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #22
0
        private void MyRefresh()
        {
            using (SqlExcuteCommand get = new SqlExcuteCommand()
            {
                DBCnnStr = DBEndososCnnStr
            })
            {
                _MyLotsTable = get.MyGetLot(StatusReydi, "1,2,3,4", WhatIsMode);
                cbLots.Clear();

                ItemsSource.Clear();

                if (_MyLotsTable.Rows.Count == 0)
                {
                    MessageBox.Show("No hay lotes ", "No Hay", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                _infoLot = new ObservableCollection <Lots>();

                foreach (DataRow row in _MyLotsTable.Rows)
                {
                    _infoLot.Add(new Lots()
                    {
                        Partido     = row["Partido"].ToString(),
                        Lot         = row["Lot"].ToString(),
                        Amount      = row["Amount"].ToString(),
                        Usercode    = row["Usercode"].ToString(),
                        AuthDate    = row["AuthDate"].ToString(),
                        Status      = row["Status"].ToString(),
                        VerDate     = row["VerDate"].ToString(),
                        VerUser     = row["VerUser"].ToString(),
                        FinUser     = row["FinUser"].ToString(),
                        FinDate     = row["FinDate"].ToString(),
                        RevDate     = row["RevDate"].ToString(),
                        RevUser     = row["RevUser"].ToString(),
                        conditions  = row["conditions"].ToString(),
                        ImportDate  = row["ImportDate"].ToString(),
                        StatusReydi = row["StatusReydi"].ToString(),
                    });
                    Lots myLots = new Lots();

                    myLots.Lot  = row["Lot"].ToString();
                    myLots.Modo = int.Parse(row["Modo"].ToString());

                    if (WhatIsMode == 1)
                    {
                        if (myLots.Modo == 1)
                        {
                            cbLots.Add(myLots.Lot);
                        }
                    }
                    else
                    {
                        if (myLots.Modo == 2)
                        {
                            cbLots.Add(myLots.Lot);
                        }
                    }
                }



                cbLots_Item_Id = -1;
            }
        }
        private void MycmdExecute_Click()
        {
            try
            {
                ItemsSource.Clear();

                if (string.IsNullOrEmpty(TxtElecNum))
                {
                    return;
                }



                using (SqlExcuteCommand get = new SqlExcuteCommand
                {
                    DBCeeMasterCnnStr = DBMasterCeeCnnStr,
                    DBCnnStr = DBEndososCnnStr
                })
                {
                    txtTotal = "0";
                    DataTable T = new DataTable();
                    T        = get.MyGetDuplicadoPorNumeroElectoral(TxtElecNum, WhatIsModo);
                    txtTotal = string.Format("{0:N0}", T.Rows.Count);

                    if (T.Rows.Count <= 0)
                    {
                        MessageBox.Show("No Hay Datos", TxtElecNum, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                        return;
                    }

                    foreach (DataRow row in T.Rows)
                    {
                        LotsEndo datos = new LotsEndo();

                        //datos.GoodNumElec       = row["GoodNumElec"].ToString();
                        //datos.BadNumElec        = row["BadNumElec"].ToString();
                        //datos.GoodPartido       = row["GoodPartido"].ToString();
                        //datos.BadPartido        = row["BadPartido"].ToString();
                        //datos.GoodLot           = row["GoodLot"].ToString();
                        //datos.BadLot            = row["BadLot"].ToString();
                        //datos.GoodBatch         = row["GoodBatch"].ToString();
                        //datos.BadBatch          = row["BadBatch"].ToString();
                        //datos.GoodFormulario    = row["GoodFormulario"].ToString();
                        //datos.BadFormulario     = row["BadFormulario"].ToString();
                        //datos.GoodEndosoImage   = (byte[])row["GoodEndosoImage"];
                        //datos.BadEndosoImage    = (byte[])row["BadEndosoImage"];
                        //datos.GoodPathImage     = row["GoodPathImage"].ToString();
                        //datos.BadPathImage      = row["BadPathImage"].ToString();
                        //datos.GoodErrores       = row["GoodErrores"].ToString();
                        //datos.BadErrores        = row["BadErrores"].ToString();

                        datos.NumElec     = row["NumElec"].ToString();
                        datos.Partido     = row["Partido"].ToString();
                        datos.Lot         = row["Lot"].ToString();
                        datos.Batch       = row["Batch"].ToString();
                        datos.Formulario  = row["Formulario"].ToString();
                        datos.Image       = row["Image"].ToString();
                        datos.Errores     = row["Errores"].ToString();
                        datos.Status      = row["Status"].ToString();
                        datos.EndosoImage = get.MyGetImgInByte(datos.NumElec, datos.Partido, datos.Lot, datos.Batch, datos.Formulario, datos.Image, datos.Errores, datos.Status);
                        datos.Modo        = int.Parse(row["Modo"].ToString());

                        if (WhatIsModo == 1)
                        {
                            if (datos.Modo == 1)
                            {
                                ItemsSource.Add(datos);
                            }
                        }
                        else
                        {
                            if (datos.Modo == 2)
                            {
                                ItemsSource.Add(datos);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MethodBase site = ex.TargetSite;
                MessageBox.Show(ex.ToString(), site.Name, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #24
0
        public void Navigate(PageChanges change)
        {
            uint totalRecords;
            uint newPageSize;

            if (this.MyQuery == null || this.cmbPageSizes.ItemsSource == null)
            {
                return;
            }

            totalRecords = (uint)MyQuery.Count();
            newPageSize  = (uint)cmbPageSizes.SelectedItem;
            if (totalRecords == 0)
            {
                ItemsSource.Clear();
                TotalPages  = 1;
                Page        = 1;
                StartRecord = 0;
                EndRecord   = 0;
            }
            else
            {
                TotalPages = (totalRecords / newPageSize) + (uint)((totalRecords % newPageSize == 0) ? 0 : 1);
            }

            uint newPage = 1;

            switch (change)
            {
            case PageChanges.First:
                if (Page == 1)
                {
                    return;
                }
                break;

            case PageChanges.Previous:
                newPage = (Page - 1 > TotalPages) ? TotalPages : (Page - 1 < 1) ? 1 : Page - 1;
                break;

            case PageChanges.Current:
                newPage = (Page > TotalPages) ? TotalPages : (Page < 1) ? 1 : Page;
                break;

            case PageChanges.Next:
                newPage = (Page + 1 > TotalPages) ? TotalPages : Page + 1;
                //(Page + 1) < 1 ? 1 :
                break;

            case PageChanges.Last:
                if (Page == TotalPages)
                {
                    return;
                }
                newPage = TotalPages;
                break;

            default:
                break;
            }

            uint StartingIndex = (newPage - 1) * newPageSize;

            StartRecord = StartingIndex + 1;

            uint oldPage = Page;

            RaisePreviewPageChange(Page, newPage);

            Page         = newPage;
            TotalRecords = totalRecords;
            ItemsSource.Clear();

            IQueryable fetchData  = MyQuery.Skip(Convert.ToInt32(StartingIndex)).Take(Convert.ToInt32(newPageSize));
            var        enumerator = fetchData.GetEnumerator();

            while (enumerator.MoveNext())
            {
                ItemsSource.Add(enumerator.Current);
            }
            EndRecord = StartingIndex + Convert.ToUInt32(ItemsSource.Count);
            RaisePageChanged(oldPage, Page);
        }
Beispiel #25
0
        public MainViewModel()
        {
            //    RenderTechniquesManager = new DefaultRenderTechniquesManager();
            EffectsManager = new DefaultEffectsManager();
            // ----------------------------------------------
            // titles
            this.Title    = "GroupElement Test";
            this.SubTitle = "WPF & SharpDX";

            // ----------------------------------------------
            // camera setup
            this.Camera = new PerspectiveCamera {
                Position = new Point3D(10, 2, 10), LookDirection = new Vector3D(-10, -2, -10), UpDirection = new Vector3D(0, 1, 0)
            };

            var lineBuilder = new LineBuilder();

            lineBuilder.AddLine(new Vector3(0, 0, 0), new Vector3(10, 0, 0));
            lineBuilder.AddLine(new Vector3(0, 0, 0), new Vector3(0, 10, 0));
            lineBuilder.AddLine(new Vector3(0, 0, 0), new Vector3(0, 0, 10));
            AxisModel        = lineBuilder.ToLineGeometry3D();
            AxisModel.Colors = new Color4Collection(AxisModel.Positions.Count);
            AxisModel.Colors.Add(Colors.Red.ToColor4());
            AxisModel.Colors.Add(Colors.Red.ToColor4());
            AxisModel.Colors.Add(Colors.Green.ToColor4());
            AxisModel.Colors.Add(Colors.Green.ToColor4());
            AxisModel.Colors.Add(Colors.Blue.ToColor4());
            AxisModel.Colors.Add(Colors.Blue.ToColor4());

            AxisLabel = new BillboardText3D();
            AxisLabel.TextInfo.Add(new TextInfo()
            {
                Origin = new Vector3(11, 0, 0), Text = "X", Foreground = Colors.Red.ToColor4()
            });
            AxisLabel.TextInfo.Add(new TextInfo()
            {
                Origin = new Vector3(0, 11, 0), Text = "Y", Foreground = Colors.Green.ToColor4()
            });
            AxisLabel.TextInfo.Add(new TextInfo()
            {
                Origin = new Vector3(0, 0, 11), Text = "Z", Foreground = Colors.Blue.ToColor4()
            });

            var meshBuilder = new MeshBuilder(true);

            meshBuilder.AddSphere(new Vector3(0, 0, 0), 0.5);
            SphereModel = meshBuilder.ToMesh();
            meshBuilder = new MeshBuilder(true);
            meshBuilder.AddBox(Vector3.Zero, 0.5, 0.5, 0.5);
            BoxModel    = meshBuilder.ToMesh();
            meshBuilder = new MeshBuilder(true);
            meshBuilder.AddCone(Vector3.Zero, new Vector3(0, 2, 0), 1, true, 24);
            ConeModel = meshBuilder.ToMesh();

            AddGroupModelCommand               = new RelayCommand(AddGroupModel);
            RemoveGroupModelCommand            = new RelayCommand(RemoveGroupModel);
            AddTransparentGroupModelCommand    = new RelayCommand(AddTransparentMesh);
            RemoveTransparentGroupModelCommand = new RelayCommand(RemoveTransparentModel);
            ClearGroupModelCommand             = new RelayCommand((o) => { GroupModelSource.Clear(); });
            AnimateGroupModelCommand           = new RelayCommand(AnimateGroupModel);
            AddItemsModelCommand               = new RelayCommand(AddItemsModel);
            RemoveItemsModelCommand            = new RelayCommand(RemoveItemsModel);
            ClearItemsModelCommand             = new RelayCommand((o) => { ItemsSource.Clear(); });
            AnimateItemsModelCommand           = new RelayCommand(AnimateItemsModel);
        }