Program()
        {
            var yesterday = DateTime.Today.AddDays (-1);
            var overdue = DateTime.Today.AddDays (-5);
            var today = DateTime.Today;
            var tomorrow = DateTime.Today.AddDays (1);
            var future = DateTime.Today.AddDays (5);

            tasks = new ObservableCollection<Task> ();
            tasks.Add (new Task () { Completed = true, DueDate = tomorrow, Name = "Task A", Priority = 2, CompletionDate = yesterday });
            tasks.Add (new Task () { Completed = false, DueDate = overdue, Name = "Task C", Priority = 1 });
            tasks.Add (new Task () { Completed = false, DueDate = today, Name = "Task B", Priority = 2 });
            tasks.Add (new Task () { Completed = false, DueDate = today, Name = "Task D", Priority = 1 });
            tasks.Add (new Task () { Completed = false, DueDate = future, Name = "Task E", Priority = 2 });
            tasks.Add (new Task () { Completed = true, DueDate = overdue, Name = "Task F", Priority = 2, CompletionDate = overdue });
            tasks.Add (new Task () { Completed = true, DueDate = today, Name = "Task G", Priority = 1, CompletionDate = today });
            tasks.Add (new Task () { Completed = false, DueDate = future, Name = "Task H", Priority = 2 });

            lcv = new ListCollectionView<Task> (tasks);
            using (lcv.DeferRefresh ()) {
                Console.WriteLine ("ListCollectionView<Task> initilaized.");
                //SetShowGroups();
                Console.WriteLine ("Show Groups set.");
                groupDesc = new PropertyGroupDescription (null, new TaskGroupConverter ());
                lcv.GroupDescriptions.Add (groupDesc);
                Console.WriteLine ("GroupDescription added.");
                lcv.CustomSort = new TaskComparer (new TaskCompletionDateComparer ());
                Console.WriteLine ("CustomSort set (TaskComparer).");
                SetFilter ();
                Console.WriteLine ("Filter set.");
            }
        }
Ejemplo n.º 2
0
 internal DeferNotifications(ListCollectionView view, IUpdateTracker updateTracker)
 {
     _view = view;
     _updateTracker = updateTracker;
     _updateTracker = updateTracker;
     _currentItem = _view.CurrentItem;
     _updateTracker.RunningUpdateCount++;
 }
Ejemplo n.º 3
0
        public MainPageViewModel(INavigationService navigationService, IEventAggregator eventAggregator,
                                 SettingsHelper settingsHelper, SettingsViewModel settingsViewModel,
                                 SettingsPaneViewModel settingsPaneViewModel, FilterListViewModel filterListViewModel,
                                 ListFilterViewModel listFilterViewModel, TorrentWindowViewModel torrentWindowViewModel,
                                 ErrorTracker errorTracker)
        {
            _errorTracker = errorTracker;
            _uriQueue = new List<string>();
            _torrentsQueue = new List<TorrentFileData>();

            _settingsHelper = settingsHelper;
            _eventAggregator = eventAggregator;
            _navigationService = navigationService;

            FilterList = filterListViewModel;
            ListFilter = listFilterViewModel;
            SettingsPane = settingsPaneViewModel;
            Settings = settingsViewModel;
            TorrentWindow = torrentWindowViewModel;

            backingTorrents = new ObservableCollection<TorrentViewModel>();
            Torrents = new ListCollectionView(backingTorrents);
            SelectedItems = new ObservableCollection<TorrentViewModel>();

            ChangeOrder(settingsHelper.GetSetting<bool>(SettingType.OrderByQueue));
            Torrents.Filter = ListFilter.GetFilter(Filter.All);

            ClearCommand = new DelegateCommand(() => ClearSelection());
            SelectAllCommand = new DelegateCommand(() => SelectAll());
            ForceStartCommand = new DelegateCommand(() => ChangeTorrentState(StateType.ForceStart));
            PauseCommand = new DelegateCommand(() => ChangeTorrentState(StateType.Stop));
            StartCommand = new DelegateCommand(() => ChangeTorrentState(StateType.Start));
            VerifyCommand = new DelegateCommand(() => ChangeTorrentState(StateType.Verify));
            ShowAddTorrentCommand = new DelegateCommand(() => TorrentWindow.Open(Purpose.Add, Server.DefaultDownloadLocation));
            ShowMoveTorrentsCommand = new DelegateCommand(() => TorrentWindow.Open(Purpose.Move, Server.DefaultDownloadLocation, SelectedItems));
            ShowConfirmDeleteCommand = new DelegateCommand(() => TorrentWindow.Open(Purpose.Delete, Server.DefaultDownloadLocation, SelectedItems));

            _eventAggregator.GetEvent<AddTorrent>().Subscribe(AddTorrents);
            _eventAggregator.GetEvent<DeleteTorrents>().Subscribe(Delete);
            _eventAggregator.GetEvent<MoveTorrents>().Subscribe(MoveTorrents);
            _eventAggregator.GetEvent<SearchChanged>().Subscribe(query => Torrents.Refresh());
            _eventAggregator.GetEvent<SearchCleared>().Subscribe(_ => Torrents.Refresh());
            _eventAggregator.GetEvent<PriorityChanged>().Subscribe(PriorityChanged);
            _eventAggregator.GetEvent<WantedChanged>().Subscribe(WantedChanged);
            _eventAggregator.GetEvent<FilterChanged>().Subscribe(FilterChanged);
            _eventAggregator.GetEvent<OrderByQueueSettingChanged>().Subscribe(orderByQueue => ChangeOrder(orderByQueue));
            _eventAggregator.GetEvent<FileActivated>().Subscribe(FileActivated);
            _eventAggregator.GetEvent<URIActivated>().Subscribe(URIActivated);
            _eventAggregator.GetEvent<ServerLoaded>().Subscribe(ProcessQueues);

            SelectedItems.CollectionChanged += (s, e) =>
            {
                SelectionChange();
            };
        }
Ejemplo n.º 4
0
 public AddServerViewModel()
 {
     saveAsNewCmd = new RelayCommand(SaveAsNewAction, CanSaveAsNew);
     overwriteCmd = new RelayCommand(OverwriteAction, CanOverwrite);
     removeCmd = new RelayCommand(RemoveAction, CanRemove);
     addConnection = new RelayCommand(AddConnectionAction, CanAddConnection);
     txtSearch = string.Empty;
     list = new ListCollectionView();
     list.Source = new List<Server>();
     list.Filter = p =>
     {
         if (!((Server)p).Name.Contains(txtSearch))
             return false;
         return true;
     };
     RetrieveList();
 }
Ejemplo n.º 5
0
 internal EnumerableCollectionView(IEnumerable source)
     : base(source)
 {
     this.snapshot = new ObservableCollection<object>();
     this.LoadSnapshotCore(source);
     if (this.snapshot.Count <= 0)
     {
         this.SetCurrent(null, -1, 0);
     }
     else
     {
         this.SetCurrent(this.snapshot[0], 0, 1);
     }
     this.pollForChanges = !(source is INotifyCollectionChanged);
     this.view = new ListCollectionView(this.snapshot);
     this.view.CollectionChanged += new NotifyCollectionChangedEventHandler(this.OnViewChanged);
     this.view.PropertyChanged += new PropertyChangedEventHandler(this.OnPropertyChanged);
     this.view.CurrentChanging += new CurrentChangingEventHandler(this.OnCurrentChanging);
     this.view.CurrentChanged += new EventHandler(this.OnCurrentChanged);
 }
 public void LinkViews(Page page, IEnumerable source, String Ressourcename)
 {
     ViewSource        = ((CollectionViewSource)(page.FindResource(Ressourcename)));
     ViewSource.Source = source;
     View = (ListCollectionView)ViewSource.View;
 }
Ejemplo n.º 7
0
 public ProcessViewModel()
 {
     Childs         = new ObservableCollection <ProcessViewModel>();
     CollectionView = new ListCollectionView(Childs);
 }
Ejemplo n.º 8
0
 private void init()
 {
     //ContactsList = new ListCollectionView(contactsList);
     SystemMessages = new ListCollectionView(systemMessages);
     Root           = new ListCollectionView(root);
 }
    {//----------------------------------------------------------
        public static void parameter_and_material_type(Document doc, ElementType type, ListView thong_tin_kich_thuoc, ObservableCollection <data_parameters> my_parameters,
                                                       ListView thong_tin_cong_tac_vat_lieu, ObservableCollection <data_materials> my_materials, ObservableCollection <data_material> my_material, string unit_length)
        {
            try
            {
                var TypeOftype             = type.GetType();
                CompoundStructure compound = null;
                if (TypeOftype.Name == "WallType")
                {
                    var wall = type as WallType;
                    compound = wall.GetCompoundStructure();
                }
                if (TypeOftype.Name == "FloorType")
                {
                    var wall = type as FloorType;
                    compound = wall.GetCompoundStructure();
                }
                if (TypeOftype.Name == "RoofType")
                {
                    var wall = type as RoofType;
                    compound = wall.GetCompoundStructure();
                }
                if (TypeOftype.Name == "CeilingType")
                {
                    var wall = type as CeilingType;
                    compound = wall.GetCompoundStructure();
                }

                IList <CompoundStructureLayer> getlayer = compound.GetLayers();
                foreach (var layer in getlayer)
                {
                    my_parameters.Add(new data_parameters()
                    {
                        ten_parameter     = layer.Function.ToString(),
                        gia_tri_parameter = Math.Round(layer.Width * Source.units_document.First(x => x.name == unit_length).value, 0).ToString(),
                        group_parameter   = "Dimensions",
                        layer             = layer,
                        compound          = compound
                    });
                }

                thong_tin_kich_thuoc.ItemsSource = my_parameters;

                ListCollectionView       view_kich_thuoc   = CollectionViewSource.GetDefaultView(thong_tin_kich_thuoc.ItemsSource) as ListCollectionView;
                PropertyGroupDescription groupDescription1 = new PropertyGroupDescription("group_parameter");
                view_kich_thuoc.GroupDescriptions.Add(groupDescription1);
                view_kich_thuoc.CustomSort = new sort_data_parameters();
                //---------------------------------------------------------------------------------------------------------------------
                foreach (var layer in getlayer)
                {
                    string ten = "<By Category>";
                    string ma  = "";
                    if (layer.MaterialId.IntegerValue != -1)
                    {
                        ten = doc.GetElement(layer.MaterialId).Name;
                        ma  = F_GetSchema.Check_Para_And_Get_Para(doc.GetElement(layer.MaterialId) as Material, Source.MCT[1], Source.MCT[0]);
                    }
                    my_materials.Add(new data_materials()
                    {
                        ten_cong_tac      = layer.Function.ToString(),
                        ten_vat_lieu_list = my_material,
                        ten_vat_lieu      = my_material.First(x => x.name == ten),
                        layer             = layer,
                        compound          = compound
                    });
                }
                thong_tin_cong_tac_vat_lieu.ItemsSource = my_materials;
                CollectionView view = (CollectionView)CollectionViewSource.GetDefaultView(thong_tin_cong_tac_vat_lieu.ItemsSource);
                view.SortDescriptions.Add(new SortDescription("ten_cong_tac", ListSortDirection.Ascending));
            }
            catch (Exception)
            {
                thong_tin_kich_thuoc.ItemsSource        = new ObservableCollection <data_parameters>();
                thong_tin_cong_tac_vat_lieu.ItemsSource = new ObservableCollection <data_materials>();
            }
        }
 public void CollectionHasChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     ListCollectionView ownerList = sender as ListCollectionView;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// The purpose of this method is to allow the CompletedTaskGroup to show
 /// completed tasks in reverse order (i.e., most recently completed tasks
 /// at the top of the list).
 /// </summary>
 static IEnumerable<Task> GetSortedTasks(IEnumerable<Task> tasks)
 {
     var cv = new ListCollectionView<Task> (tasks);
     cv.SortDescriptions.Add (new SortDescription ("CompletionDate", ListSortDirection.Descending));
     cv.IsObserving = true;
     return cv;
 }
Ejemplo n.º 12
0
        private static void SetRangoGraficosIndividuales(ListCollectionView lista, DateTime fecha, ref string[,] datos)
        {
            // Definimos la fila inicial
            int fila = 0;

            // Rellenamos el array.
            foreach (object obj in lista)
            {
                Grafico g = obj as Grafico;
                if (g == null)
                {
                    continue;
                }

                // Título y centro.
                datos[fila, 0] = string.Format("{0:dd} - {0:MMMM} - {0:yyyy}", fecha).ToUpper();
                datos[fila, 4] = App.Global.CentroActual.ToString().ToUpper();

                // Gráfico y valoracion
                datos[fila + 2, 0] = "Gráfico: " + (string)cnvNumGrafico.Convert(g.Numero, null, null, null) + "   Turno: " + g.Turno.ToString("0");
                datos[fila + 2, 4] = "Valoración: " + (string)cnvHora.Convert(g.Valoracion, null, VerValores.NoCeros, null);

                // Valoraciones
                datos[fila + 3, 0] = "Inicio";
                datos[fila + 3, 1] = "Línea";
                datos[fila + 3, 2] = "Descripción";
                datos[fila + 3, 3] = "Final";
                datos[fila + 3, 4] = "Tiempo";
                int filavaloracion = 0;
                foreach (ValoracionGrafico v in g.ListaValoraciones)
                {
                    datos[fila + 4 + filavaloracion, 0] = (string)cnvHora.Convert(v.Inicio, null, VerValores.NoCeros, null);
                    datos[fila + 4 + filavaloracion, 1] = v.Linea == 0 ? "" : v.Linea.ToString();
                    datos[fila + 4 + filavaloracion, 2] = v.Descripcion;
                    datos[fila + 4 + filavaloracion, 3] = (string)cnvHora.Convert(v.Final, null, VerValores.NoCeros, null);
                    datos[fila + 4 + filavaloracion, 4] = (string)cnvHora.Convert(v.Tiempo, null, VerValores.NoCeros, null);
                    filavaloracion++;
                }

                // Dietas y Horas
                string texto = "";
                if (g.Desayuno > 0)
                {
                    texto += String.Format("Desayuno: {0:0.00}  ", g.Desayuno);
                }
                if (g.Comida > 0)
                {
                    texto += String.Format("Comida: {0:0.00}  ", g.Comida);
                }
                if (g.Cena > 0)
                {
                    texto += String.Format("Cena: {0:0.00}  ", g.Cena);
                }
                if (g.PlusCena > 0)
                {
                    texto += String.Format("Plus Cena: {0:0.00}  ", g.PlusCena);
                }
                if (g.PlusLimpieza)
                {
                    texto += "Limp.  ";
                }
                if (g.PlusPaqueteria)
                {
                    texto += "Paqu.  ";
                }
                datos[fila + 4 + filavaloracion, 0] = texto;

                datos[fila + 4 + filavaloracion, 4] = String.Format("Trab: {0} Acum: {1} Noct: {2}",
                                                                    (string)cnvHora.Convert(g.Trabajadas, null, null, null),
                                                                    (string)cnvHora.Convert(g.Acumuladas, null, null, null),
                                                                    (string)cnvHora.Convert(g.Nocturnas, null, null, null));
                // Reajustamos la fila
                fila += 5 + g.ListaValoraciones.Count;
            }
        }
 public ProcessorWrapper(Processor processor, ListCollectionView lcv)
 {
     _processor = processor;
     _lcv       = lcv;
 }
Ejemplo n.º 14
0
        private void InitializeSearchTab()
        {
            MergedAssetList = new ObservableCollection <Asset>();

            if (!Constrained)
            {
                foreach (var asset in effectContainerFile.Emo.Assets)
                {
                    MergedAssetList.Add(asset);
                }

                foreach (var asset in effectContainerFile.Pbind.Assets)
                {
                    MergedAssetList.Add(asset);
                }

                foreach (var asset in effectContainerFile.Tbind.Assets)
                {
                    MergedAssetList.Add(asset);
                }

                foreach (var asset in effectContainerFile.LightEma.Assets)
                {
                    MergedAssetList.Add(asset);
                }

                foreach (var asset in effectContainerFile.Cbind.Assets)
                {
                    MergedAssetList.Add(asset);
                }
            }
            else
            {
                if (ConstrainedAssetType == AssetType.EMO)
                {
                    foreach (var asset in effectContainerFile.Emo.Assets)
                    {
                        MergedAssetList.Add(asset);
                    }
                }
                else if (ConstrainedAssetType == AssetType.PBIND)
                {
                    foreach (var asset in effectContainerFile.Pbind.Assets)
                    {
                        MergedAssetList.Add(asset);
                    }
                }
                else if (ConstrainedAssetType == AssetType.TBIND)
                {
                    foreach (var asset in effectContainerFile.Tbind.Assets)
                    {
                        MergedAssetList.Add(asset);
                    }
                }
                else if (ConstrainedAssetType == AssetType.LIGHT)
                {
                    foreach (var asset in effectContainerFile.LightEma.Assets)
                    {
                        MergedAssetList.Add(asset);
                    }
                }
                else if (ConstrainedAssetType == AssetType.CBIND)
                {
                    foreach (var asset in effectContainerFile.Cbind.Assets)
                    {
                        MergedAssetList.Add(asset);
                    }
                }
            }

            ViewMergedAsserList        = new ListCollectionView(MergedAssetList);
            ViewMergedAsserList.Filter = new Predicate <object>(AssetFilterCheck);
        }
Ejemplo n.º 15
0
        public static void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
        {
            ListView view = sender as ListView;

            if (view == null)
            {
                return;
            }

            ListViewSortItem listViewSortItem = _listViewDefinitions[view.Name];

            if (listViewSortItem == null)
            {
                return;
            }

            GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;

            if (headerClicked == null)
            {
                return;
            }

            ListCollectionView collectionView = CollectionViewSource.GetDefaultView(view.ItemsSource) as ListCollectionView;

            if (collectionView == null)
            {
                return;
            }

            ListSortDirection sortDirection = GetSortingDirection(headerClicked, listViewSortItem);

            string header = headerClicked.Tag as string;

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

            if (listViewSortItem.Comparer != null)
            {
                view.Cursor = System.Windows.Input.Cursors.Wait;
                listViewSortItem.Comparer.SortBy        = header;
                listViewSortItem.Comparer.SortDirection = sortDirection;
                listViewSortItem.Comparer.DirectionDig  = ((sortDirection.Equals(ListSortDirection.Ascending)) ? -1 : 1);

                try { collectionView.CustomSort = listViewSortItem.Comparer; }
                catch { }

                view.Items.Refresh();
                view.Cursor = System.Windows.Input.Cursors.Arrow;
            }
            else
            {
                view.Items.SortDescriptions.Clear();
                view.Items.SortDescriptions.Add(new SortDescription(headerClicked.Column.Header.ToString(), sortDirection));
                view.Items.Refresh();
            }

            listViewSortItem.LastColumnHeaderClicked = headerClicked;
            listViewSortItem.LastSortDirection       = sortDirection;

            if ((listViewSortItem.Adorner != null) && (listViewSortItem.LastColumnHeaderClicked != null))
            {
                AdornerLayer.GetAdornerLayer(listViewSortItem.LastColumnHeaderClicked).Remove(listViewSortItem.Adorner);
            }

            switch (sortDirection)
            {
            case ListSortDirection.Ascending:
                listViewSortItem.Adorner = new SortAdorner(headerClicked, ListSortDirection.Ascending);
                AdornerLayer.GetAdornerLayer(headerClicked).Add(listViewSortItem.Adorner);
                break;

            case ListSortDirection.Descending:
                listViewSortItem.Adorner = new SortAdorner(headerClicked, ListSortDirection.Descending);
                AdornerLayer.GetAdornerLayer(headerClicked).Add(listViewSortItem.Adorner);
                break;
            }
        }
Ejemplo n.º 16
0
                                                                  220, 221, 222, 223, 223, 248, 266, 272, 273, 274, 275, 276, 278 }; //Removed 225 CurrentLoadStartPoint so combobox works
        public GameStatsListCollectionViews(List <GameStat> gameStatsVertical)
        {
            HubCollectionView          = new ListCollectionView(gameStatsVertical);
            TribalstackCollectionView  = new ListCollectionView(gameStatsVertical);
            GlitterglazeCollectionView = new ListCollectionView(gameStatsVertical);
            MoodymazeCollectionView    = new ListCollectionView(gameStatsVertical);
            CashinoCollectionView      = new ListCollectionView(gameStatsVertical);
            GalaxyCollectionView       = new ListCollectionView(gameStatsVertical);
            MiscCollectionView         = new ListCollectionView(gameStatsVertical);

            HubCollectionView.Filter = x =>
            {
                GameStat gameStat = x as GameStat;
                if (hubGameStatsIndices.Contains(gameStat.Id))
                {
                    return(true);
                }
                return(false);
            };
            TribalstackCollectionView.Filter = x =>
            {
                GameStat gameStat = x as GameStat;
                if (jungleGameStatsIndices.Contains(gameStat.Id))
                {
                    return(true);
                }
                return(false);
            };
            GlitterglazeCollectionView.Filter = x =>
            {
                GameStat gameStat = x as GameStat;
                if (glacierGameStatsIndices.Contains(gameStat.Id))
                {
                    return(true);
                }
                return(false);
            };
            MoodymazeCollectionView.Filter = x =>
            {
                GameStat gameStat = x as GameStat;
                if (swampGameStatsIndices.Contains(gameStat.Id))
                {
                    return(true);
                }
                return(false);
            };
            CashinoCollectionView.Filter = x =>
            {
                GameStat gameStat = x as GameStat;
                if (casinoGameStatsIndices.Contains(gameStat.Id))
                {
                    return(true);
                }
                return(false);
            };
            GalaxyCollectionView.Filter = x =>
            {
                GameStat gameStat = x as GameStat;
                if (spaceGameStatsIndices.Contains(gameStat.Id))
                {
                    return(true);
                }
                return(false);
            };
            MiscCollectionView.Filter = x =>
            {
                GameStat gameStat = x as GameStat;
                if (miscGameStatsIndices.Contains(gameStat.Id))
                {
                    return(true);
                }
                return(false);
            };
        }
Ejemplo n.º 17
0
        void OnButtonPressed(object sender, Gtk.ButtonPressEventArgs args)
        {
            switch (args.Event.Button) {
                case 3: // third mouse button (right-click)
                    clickedTask = null;

                    Gtk.TreeView tv = sender as Gtk.TreeView;
                    if (tv == null)
                        return;

                    Gtk.TreeModel model = tv.Model;

                    Gtk.TreeIter iter;
                    Gtk.TreePath path;
                    Gtk.TreeViewColumn column = null;

                    if (!tv.GetPathAtPos ((int) args.Event.X,
                                    (int) args.Event.Y, out path, out column))
                        return;

                    if (!model.GetIter (out iter, path))
                        return;

                    clickedTask = model.GetValue (iter, 0) as Task;
                    if (clickedTask == null)
                        return;

                    Menu popupMenu = new Menu ();
                    ImageMenuItem item;

                    item = new ImageMenuItem (Catalog.GetString ("_Notes..."));
                    item.Image = new Gtk.Image (noteIcon);
                    item.Activated += OnShowTaskNotes;
                    popupMenu.Add (item);

                    popupMenu.Add (new SeparatorMenuItem ());

                    item = new ImageMenuItem (Catalog.GetString ("_Delete task"));
                    item.Image = new Gtk.Image(Gtk.Stock.Delete, IconSize.Menu);
                    item.Activated += OnDeleteTask;
                    popupMenu.Add (item);

                    item = new ImageMenuItem(Catalog.GetString ("_Edit task"));
                    item.Image = new Gtk.Image(Gtk.Stock.Edit, IconSize.Menu);
                    item.Activated += OnEditTask;
                    popupMenu.Add (item);

                    /*
                     * Depending on the currently selected task's category, we create a context popup
                     * here in order to enable changing categories. The list of available categories
                     * is pre-filtered as to not contain the current category and the AllCategory.
                     */
                    var cvCategories = new ListCollectionView<Category> (GtkApplication.Instance.Backend.Categories);
                    cvCategories.Filter = c => c != null && !c.Contains (clickedTask);
                    cvCategories.IsObserving = true;

                    // The categories submenu is only created in case we actually provide at least one category.
                    if (cvCategories.Count > 0) {
                        Menu categoryMenu = new Menu();
                        CategoryMenuItem categoryItem;

                        foreach (var cat in cvCategories) {
                            categoryItem = new CategoryMenuItem((Category)cat);
                            categoryItem.Activated += OnChangeCategory;
                            categoryMenu.Add(categoryItem);
                        }

                        // TODO Needs translation.
                        item = new ImageMenuItem(Catalog.GetString("_Change category"));
                        item.Image = new Gtk.Image(Gtk.Stock.Convert, IconSize.Menu);
                        item.Submenu = categoryMenu;
                        popupMenu.Add(item);
                    }

                    popupMenu.ShowAll();
                    popupMenu.Popup ();

                    // Debug.WriteLine ("Right clicked on task: " + task.Name);
                    break;
            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// ItemsSourceProperty property changed handler.
        /// </summary>
        /// <param name="d">DataGrid that changed its ItemsSource.</param>
        /// <param name="e">DependencyPropertyChangedEventArgs.</param>
        private static void OnItemsSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataGrid dataGrid = (DataGrid)d;
            if (!dataGrid.IsHandlerSuspended(e.Property))
            {
                Debug.Assert(dataGrid.DataConnection != null);

                if (dataGrid.LoadingOrUnloadingRow)
                {
                    dataGrid.SetValueNoCallback(ItemsSourceProperty, e.OldValue);
                    throw DataGridError.DataGrid.CannotChangeItemsWhenLoadingRows();
                }

                dataGrid.DataConnection.UnWireEvents(dataGrid.DataConnection.DataSource);
                dataGrid.DataConnection.ClearDataProperties();

                // Wrap an IList in a CollectionView if it's not already one
                IEnumerable newDataSource;
                IList tempList = e.NewValue as IList;
                if (tempList != null && !(e.NewValue is System.ComponentModel.ICollectionView))
                {
                    newDataSource = new ListCollectionView(tempList);
                }
                else
                {
                    newDataSource = (IEnumerable)e.NewValue;
                }
                dataGrid.DataConnection.DataSource = newDataSource;

                if (newDataSource != null)
                {
                    dataGrid.DataConnection.WireEvents(newDataSource);
                }

                // we always want to do this
                dataGrid.RefreshRowsAndColumns();
            }
        }
 public ThenOperationsVM(List<TriggerStateThenOperations> thenOperations)
 {
     _thenOperationsList = thenOperations;
     ObservableThenOperations = new ListCollectionView(_thenOperationsList);
 }
        public ControllerScaffolderViewModel(ControllerScaffolderModel model)
            : base(model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            Model = model;

            ControllerName  = model.ControllerName;
            IsAsyncSelected = model.IsAsyncSelected;
            SetValidationMessage(Model.ValidateControllerName(ControllerName), "ControllerName");

            IsViewGenerationSupported = Model.IsViewGenerationSupported;
            if (IsViewGenerationSupported)
            {
                IsViewGenerationSelected           = Model.IsViewGenerationSelected;
                IsLayoutPageSelected               = Model.IsLayoutPageSelected;
                IsReferenceScriptLibrariesSelected = Model.IsReferenceScriptLibrariesSelected;
                LayoutPageFile = model.LayoutPageFile;
            }

            DataContextTypesInternal = new ObservableCollection <ModelType>();
            ModelTypesInternal       = new ObservableCollection <ModelType>();

            // The CustomSort here will ensure that the <Add new> item stays at the top. Custom Sort
            // is mutually exclusive with the use of SortDescriptions.
            DataContextTypes            = new ListCollectionView(DataContextTypesInternal);
            DataContextTypes.CustomSort = new DataContextModelTypeComparer();

            ModelTypes = CollectionViewSource.GetDefaultView(ModelTypesInternal);
            ModelTypes.SortDescriptions.Add(new SortDescription("ShortTypeName", ListSortDirection.Ascending));

            IsModelClassSupported  = Model.IsModelClassSupported;
            IsDataContextSupported = Model.IsDataContextSupported;

            if (Model.IsModelClassSupported)
            {
                foreach (ModelType modelType in Model.ModelTypes)
                {
                    ModelTypesInternal.Add(modelType);
                }

                SetValidationMessage(Model.ValidateModelType(null), "ModelType");
            }

            if (Model.IsDataContextSupported)
            {
                foreach (ModelType modelType in Model.DataContextTypes)
                {
                    DataContextTypesInternal.Add(modelType);
                }

                if (model.DataContextType != null)
                {
                    // We have a saved datacontext selection
                    DataContextType     = Model.DataContextType;
                    DataContextTypeName = DataContextType.DisplayName;
                }

                SetValidationMessage(Model.ValidateDataContextType(DataContextType), "DataContextType");
            }

            AddNewDataContextCommand = new RelayCommand(AddNewDataContext);
            SelectLayoutCommand      = new RelayCommand(SelectLayout);

            AsyncInformationIcon = GetInformationIcon();
        }
Ejemplo n.º 21
0
        public static async Task CrearGraficosIndividualesEnPdf_7(Document doc, ListCollectionView lista, DateTime fecha)
        {
            await Task.Run(() => {
                int indice = 1;
                double num = 1;
                foreach (object obj in lista)
                {
                    double valor = num / lista.Count * 100;
                    App.Global.ValorBarraProgreso = valor;
                    num++;
                    Grafico g = obj as Grafico;
                    if (g == null)
                    {
                        continue;
                    }
                    if (indice > 1)
                    {
                        doc.Add(new AreaBreak(AreaBreakType.NEXT_PAGE));
                    }
                    // Creamos la tabla de título
                    //Table tablaTitulo = PdfTools.GetTablaTitulo($"{fecha:dd - MMMM - yyyy}".ToUpper(), App.Global.CentroActual.ToString().ToUpper());
                    string textoTitulo = $"{fecha:dd - MMMM - yyyy}\n{App.Global.CentroActual}".ToUpper();
                    iText.Layout.Style estiloTitulo = new iText.Layout.Style();
                    estiloTitulo.SetFontSize(12).SetBold();
                    estiloTitulo.SetMargins(0, 0, 6, 0);
                    estiloTitulo.SetPadding(0);
                    estiloTitulo.SetWidth(UnitValue.CreatePercentValue(100));
                    estiloTitulo.SetBorder(iText.Layout.Borders.Border.NO_BORDER);
                    Table tablaTitulo = InformesServicio.GetTablaEncabezadoSindicato(textoTitulo, estiloTitulo);
                    // TODO: Creamos la tabla de informacion
                    string textoGrafico    = "Gráfico: " + (string)cnvNumGrafico.Convert(g.Numero, null, null, null) + "   Turno: " + g.Turno.ToString("0");
                    string textoValoracion = "Valoración: " + (string)cnvHora.Convert(g.Valoracion, null, VerValores.NoCeros, null);
                    Table tablaInformacion = PdfTools.GetTablaTitulo(textoGrafico, textoValoracion);
                    tablaInformacion.SetWidth(UnitValue.CreatePercentValue(100));
                    tablaInformacion.SetFontSize(9).SetBold();
                    // Creamos la tabla de valoraciones
                    Table tablaValoraciones = GetGraficoIndividual(g);
                    // TODO: Creamos la tabla de valores
                    string textoValores = "";
                    if (g.Desayuno > 0)
                    {
                        textoValores += String.Format("Desayuno: {0:0.00}  ", g.Desayuno);
                    }
                    if (g.Comida > 0)
                    {
                        textoValores += String.Format("Comida: {0:0.00}  ", g.Comida);
                    }
                    if (g.Cena > 0)
                    {
                        textoValores += String.Format("Cena: {0:0.00}  ", g.Cena);
                    }
                    if (g.PlusCena > 0)
                    {
                        textoValores += String.Format("Plus Cena: {0:0.00}  ", g.PlusCena);
                    }
                    if (g.PlusLimpieza)
                    {
                        textoValores += "Limp.  ";
                    }
                    if (g.PlusPaqueteria)
                    {
                        textoValores += "Paqu.  ";
                    }
                    string textoHoras = $"Trab: {(string)cnvHora.Convert(g.Trabajadas, null, null, null)}  " +
                                        $"Acum: {(string)cnvHora.Convert(g.Acumuladas, null, null, null)}  " +
                                        $"Noct: {(string)cnvHora.Convert(g.Nocturnas, null, null, null)}";
                    Table tablaValores = PdfTools.GetTablaTitulo(textoValores, textoHoras);
                    tablaValores.SetWidth(UnitValue.CreatePercentValue(100));
                    tablaValores.SetFontSize(9).SetBold();

                    // Añadimos las tablas al documento
                    doc.Add(tablaTitulo);
                    doc.Add(tablaInformacion);
                    doc.Add(tablaValoraciones);
                    doc.Add(tablaValores);
                    indice++;
                }
            });
        }
        /// <summary>
        /// For when yous need to set up some values that can't be directly bound to UI elements.
        /// </summary>
        public override void BeforeShow()
        {
            _isLoading = true;

            Dataservices = DataContextObject.Services;
            var providerFactory = new DataproviderFactory(Dataservices);

            providerFactory.InitDataProvider();
            var stage = new ImportStageModel(providerFactory);

            var temp = stage.SourceFields.Select(fld => new MOriginalField
            {
                Name       = fld.Name,
                Values     = new ObservableCollection <string>(stage.GetColumnValues(fld.Name, true)),
                FieldOrder = fld.Order
            }).ToList();

            var original      = new ObservableCollection <MOriginalField>(temp);
            var factory       = ServiceLocator.Current.GetInstance <IDomainSessionFactoryProvider>().SessionFactory;
            int positionIndex = 0;

            using (var session = factory.OpenSession())
            {
                DataContextObject.TargetElements = session.Query <Element>()
                                                   .Where(elem => elem.Owner.Id == DataContextObject.SelectedDataType.Target.Id)
                                                   .ToList();
            }

            var targetFields = DataContextObject.TargetElements
                               .Where(ElementFilter)
                               .Select(elem => new MTargetField(elem, original)
            {
                Position   = positionIndex++,
                IsRequired = elem.IsRequired
            })
                               .ToList();


            //TargetFields = MakeView(targetFields);
            DataTypeRequiredFieldCount = MappedFieldsCount = targetFields.Count(f => f.IsRequired);

            TargetFields      = new ListCollectionView(targetFields);
            SourceFields      = MakeView(temp);
            TotalSourceFields = SourceFields.Count;
            //ReconcileTargets();
            ReconcileTargets2();



            foreach (var f in SourceFields.OfType <MOriginalField>())
            {
                f.MappingChanged += f_MappingChanged2;
            }

            FilterText      = string.Empty;
            ShowEnumeration = new ObservableCollection <string> {
                ALL, AUTOMAPPED, MAPPED, UNMAPPED
            };
            SelectedShow = ShowEnumeration[0];

            FieldSortOrder = new ObservableCollection <string> {
                ORDER, NAME
            };
            SelectedSortOrder = FieldSortOrder[0];

            TargetFieldModels.ToList().Clear();
            var newList = TargetFieldModels.Where(field => !SourceFields.OfType <MOriginalField>()
                                                  .ToList()
                                                  .Any(f => f.TargetField != null && f.TargetField.Name.EqualsIgnoreCase(field.Name)))
                          .ToList();

            _targetFields = new ListCollectionView(newList);

            var requiredFields = TargetFieldModels.Where(f => f.IsRequired).OrderBy(f => f.Name).ToList();

            RequiredTargetFields = new ListCollectionView(requiredFields)
            {
                CustomSort = new MTargetFieldComparer()
            };

            var optionalFields = TargetFieldModels.Where(f => !f.IsRequired).OrderBy(f => f.Name).ToList();

            OptionalTargetFields = new ListCollectionView(optionalFields)
            {
                CustomSort = new MTargetFieldComparer()
            };

            _isLoading = false;
        }
Ejemplo n.º 23
0
 public UpdateVisibleMangaCommand(ListCollectionView view, LibraryViewModel model) : base(model)
 {
     this.view = view;
     this.Name = "Обновить";
     this.Icon = "pack://application:,,,/Icons/Main/update_any.png";
 }
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        btnAdd.Clicked += HandleAddClicked;
        btnDel.Clicked += HandleDelClicked;
        btnClearNull.Clicked += HandleClearNullClicked;
        btnReplace.Clicked += HandleReplaceClicked;
        btnEdit.Clicked += HandleEditClicked;

        songs = new ObservableCollection<Song> ();
        songs.Add (new Song ("Dancing DJs vs. Roxette", "Fading Like a Flower"));
        songs.Add (new Song ("Xaiver", "Give me the night"));
        songs.Add (new Song ("Daft Punk", "Technologic"));

        rand = new Random ();
        //		for (int i = 0; i < 400; i++) {
        //			string[] data = new string[2];
        //			for (int j = 0; j < 2; j++) {
        //				for (int k = 0; k < 10; k++) {
        //					data [j] += (char)rand.Next (97, 123);
        //				}
        //			}
        //			songs.Add (new Song (data [0], data [1]));
        //		}

        songsView = new ListCollectionView<Song> (songs);
        songsView.Filter = Filter;
        LoadSortByOptions ();

        var desc = new SortDescription (comboboxProperty.ActiveText, sortDirection);
        songsView.SortDescriptions.Add (desc);

        comboboxProperty.Changed += HandleComboPropertyChanged;
        comboboxSortDirection.Changed += HandleComboSortDirChanged;

        entryFilter.Changed += HandleFilterTextChanged;

        // Create a column for the artist name
        var artistColumn = new TreeViewColumn ();
        artistColumn.Title = "Artist";

        // Create the text cell that will display the artist name
        var artistNameCell = new CellRendererText ();

        // Add the cell to the column
        artistColumn.PackStart (artistNameCell, true);

        // Create a column for the song title
        var songColumn = new TreeViewColumn ();
        songColumn.Title = "Title";

        // Do the same for the song title column
        var songTitleCell = new CellRendererText ();
        songColumn.PackStart (songTitleCell, true);

        artistColumn.SetCellDataFunc (artistNameCell, new TreeCellDataFunc ((col, cell, model, iter) => {
            var song = model.GetValue (iter, 0) as Song;
            if (song != null)
                (cell as CellRendererText).Text = song.Artist;
        }));

        songColumn.SetCellDataFunc (songTitleCell, new TreeCellDataFunc ((col, cell, model, iter) => {
            var song = model.GetValue (iter, 0) as Song;
            if (song != null)
                (cell as CellRendererText).Text = song.Title;
        }));

        treeView.Model = new TreeModelListAdapter<Song> (songsView);

        // Add the columns to the TreeView
        treeView.AppendColumn (artistColumn);
        treeView.AppendColumn (songColumn);

        // Tell the Cell Renderers which items in the model to display
        artistColumn.AddAttribute (artistNameCell, "text", 0);
        songColumn.AddAttribute (songTitleCell, "text", 1);
    }
Ejemplo n.º 25
0
        public PmChannelViewModel(string name, IChatState chatState, IManageNotes notes, IGetProfiles profile)
            : base(chatState)
        {
            try
            {
                model = Container.Resolve <PmChannelModel>(name);
                Model = model;

                noteService = notes;
                notes.GetNotesAsync(name);

                profileService = profile;
                profile.GetProfileDataAsync(name);

                Model.PropertyChanged += OnModelPropertyChanged;

                Container.RegisterType <object, PmChannelView>(
                    StringExtensions.EscapeSpaces(Model.Id), new InjectionConstructor(this));
                Events.GetEvent <NewUpdateEvent>()
                .Subscribe(OnNewUpdateEvent, ThreadOption.PublisherThread, true, UpdateIsOurCharacter);

                cooldownTimer.Elapsed += (s, e) =>
                {
                    isInCoolDown          = false;
                    cooldownTimer.Enabled = false;
                    OnPropertyChanged("CanPost");
                };

                noteCooldownTimer.Elapsed += (s, e) =>
                {
                    isInNoteCoolDown               = false;
                    noteCooldownTimer.Enabled      = false;
                    noteCooldownUpdateTick.Enabled = false;
                    OnPropertyChanged("CanPost");
                    OnPropertyChanged("CanShowNoteTimeLeft");
                };

                if (AllKinks == null)
                {
                    AllKinks = new ListCollectionView(new ProfileKink[0]);
                }

                noteCooldownUpdateTick.Elapsed += (s, e) => OnPropertyChanged("NoteTimeLeft");

                checkTick.Elapsed += (s, e) =>
                {
                    if (!IsTyping)
                    {
                        checkTick.Enabled = false;
                    }

                    if (!string.IsNullOrEmpty(Message) && typingLengthCache == Message.Length)
                    {
                        IsTyping = false;
                        SendTypingNotification(TypingStatus.Paused);
                        checkTick.Enabled = false;
                    }

                    if (IsTyping)
                    {
                        typingLengthCache = Message?.Length ?? 0;
                    }
                };

                Model.Settings = SettingsService.GetChannelSettings(
                    ChatModel.CurrentCharacter.Name, Model.Title, Model.Id, Model.Type);

                ChannelSettings.Updated += (s, e) =>
                {
                    OnPropertyChanged("ChannelSettings");
                    if (!ChannelSettings.IsChangingSettings)
                    {
                        SettingsService.UpdateSettingsFile(
                            ChannelSettings, ChatModel.CurrentCharacter.Name, Model.Title, Model.Id);
                    }
                };

                messageManager = new FilteredCollection <IMessage, IViewableObject>(
                    Model.Messages, message => true);

                ChatModel.PropertyChanged += (sender, args) =>
                {
                    if (args.PropertyName == "CurrentCharacterData")
                    {
                        UpdateProfileProperties();
                    }
                };

                isCharacterStatusExpanded = false;

                if (!string.IsNullOrWhiteSpace(ChannelSettings.LastMessage))
                {
                    return;
                }

                Message = ChannelSettings.LastMessage;
                ChannelSettings.LastMessage = null;

                LoggingSection = "pm channel vm";
            }
            catch (Exception ex)
            {
                ex.Source = "PM Channel ViewModel, init";
                Exceptions.HandleException(ex);
            }
        }
Ejemplo n.º 26
0
 /// <summary>
 /// Конструктор.
 /// </summary>
 public SummaryViewTabVm()
 {
     ModelsSumView  = new ListCollectionView(DeviceRepository.ModelSummaries);
     SubnetsSumView = new ListCollectionView(DeviceRepository.SubnetSummaries);
 }
Ejemplo n.º 27
0
 /// <summary>
 /// Executes the load.
 /// </summary>
 /// <param name="session">The session.</param>
 protected virtual void ExecLoad(ISession session)
 {
     CollectionItems = new ListCollectionView(session.Query <TEntity>().ToObservableCollection());
 }
Ejemplo n.º 28
0
        public bool generateReport(string period, Area area = null)
        {
            if (period != "TillDate")
            {
                if (HasErrors("report"))
                {
                    return(false);
                }
            }

            DateTime             ReportDate;
            ReportType           type;
            IEnumerable <Report> ReportedPeople = new List <Report>();

            setReportedPeople();

            if (area == null)
            {
                var collection = new ListCollectionView(new ObservableCollection <Report>(ReportedPeople));
                collection.GroupDescriptions.Add(new PropertyGroupDescription("Person.Group.Area"));
                Report = collection;
            }

            //Checks if the passed in Date conforms to the report to be generated
            bool IsInTime(DateTime Date)
            {
                bool allowed = false;

                switch (period)
                {
                case "Yearly":
                    type = ReportType.Yearly;
                    if (Date != null)
                    {
                        allowed = Date.Year == Year;
                    }
                    break;

                case "Monthly":
                    if (Date != null)
                    {
                        allowed = Date.Year == Year && Date.Month == Month;
                    }
                    type = ReportType.Monthly;
                    break;

                case "Halfly":
                    type = ReportType.Halfly;
                    if (Date != null)
                    {
                        if (Half == "1st")
                        {
                            allowed = Date.Year == Year && Date.Month > 0 && Date.Month <= 6;
                        }
                        else if (Half == "2nd")
                        {
                            allowed = Date.Year == Year && Date.Month > 6 && Date.Month <= 12;
                        }
                    }
                    break;

                case "Quarterly":
                    type = ReportType.Halfly;
                    if (Date != null)
                    {
                        if (Quarter == "1st")
                        {
                            allowed = Date.Year == Year && Date.Month > 0 && Date.Month <= 3;
                        }
                        else if (Quarter == "2nd")
                        {
                            allowed = Date.Year == Year && Date.Month > 3 && Date.Month <= 6;
                        }
                        else if (Quarter == "3rd")
                        {
                            allowed = Date.Year == Year && Date.Month > 6 && Date.Month <= 9;
                        }
                        else if (Quarter == "4th")
                        {
                            allowed = Date.Year == Year && Date.Month > 9 && Date.Month <= 12;
                        }
                    }
                    break;

                case "TillDate":
                    if (Date != null)
                    {
                        allowed = Date.Year >= 2015 && Date.Year <= DateTime.Now.Year;
                    }
                    break;

                default:
                    break;
                }
                return(allowed);
            }

            //Sets The Report to be displayed on the UI
            void setReportedPeople()
            {
                if (area != null)
                {
                    var rawReports = new LocalAppContext().Reports.ToList().Where(r => IsInTime(r.ReportDate) && r.Person.Group.Area.AreaId == area.AreaId && r.Person.Service == "Adults");

                    ReportedPeople = FlattenReports(rawReports, true);
                    PrintOut       = new ObservableCollection <Report>(ReportedPeople);
                }
                else
                {
                    var rawReports = db.Reports.ToList().Where(r => IsInTime(r.ReportDate) && r.Person.Group.Area.ZoneId == zone.ZoneId && r.Person.Service == "Adults");

                    ReportedPeople = FlattenReports(rawReports);
                }

                IEnumerable <Report> FlattenReports(IEnumerable <Report> Reports, bool isPrintOut = false)
                {
                    var reports = new List <Report>();

                    foreach (var report in Reports)
                    {
                        if (isPrintOut)
                        {
                            report.Remark = "";
                        }
                        //Check if a report of this person has already been added
                        var tempReport = reports.Where(r => r.PersonId == report.PersonId).FirstOrDefault();

                        if (tempReport == null)
                        {
                            reports.Add(report);
                        }
                        else
                        {
                            tempReport.Sundays += report.Sundays;
                            tempReport.Fridays += report.Fridays;
                            tempReport.Sundays += report.Sundays;
                            tempReport.Remark   = report.Remark;
                        }
                    }
                    return(reports.OrderBy(p => p, new CompareReportedPeople()));
                }
            }

            return(true);
        }
Ejemplo n.º 29
0
        public QuestionListUserControl()
        {
            InitializeComponent();

            this.aquestionListCollectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(ProjectMgr.Instance.App.Items);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Binds data to the list.
        /// </summary>
        private void BindList()
        {
            string ClipboardCategory     = "Clipboard / Undo";
            string DeletionCategory      = "Deletion";
            string InsertionCategory     = "Insertion";
            string IntelliPromptCategory = "IntelliPrompt";
            string MacroCategory         = "Macro Recording";
            string MiscellaneousCategory = "Miscellaneous";
            string MovementCategory      = "Movement";
            string ScrollCategory        = "Scroll";
            string SearchCategory        = "Search";
            string SelectionCategory     = "Selection";

            EditActionData[] actionDataArray = new EditActionData[] {
                // Clipboard/undo
                new EditActionData()
                {
                    Category = ClipboardCategory, Action = new CopyAndAppendToClipboardAction()
                },
                new EditActionData()
                {
                    Category = ClipboardCategory, Action = new CopyToClipboardAction()
                },
                new EditActionData()
                {
                    Category = ClipboardCategory, Action = new CutAndAppendToClipboardAction()
                },
                new EditActionData()
                {
                    Category = ClipboardCategory, Action = new CutLineToClipboardAction()
                },
                new EditActionData()
                {
                    Category = ClipboardCategory, Action = new CutToClipboardAction()
                },
                new EditActionData()
                {
                    Category = ClipboardCategory, Action = new PasteFromClipboardAction()
                },
                new EditActionData()
                {
                    Category = ClipboardCategory, Action = new RedoAction()
                },
                new EditActionData()
                {
                    Category = ClipboardCategory, Action = new ActiproSoftware.Windows.Controls.SyntaxEditor.EditActions.UndoAction()
                },
                // Deletion
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new BackspaceAction()
                },
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new BackspaceToPreviousWordAction()
                },
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new DeleteAction()
                },
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new DeleteBlankLinesAction()
                },
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new DeleteHorizontalWhitespaceAction()
                },
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new DeleteLineAction()
                },
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new DeleteToLineEndAction()
                },
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new DeleteToLineStartAction()
                },
                new EditActionData()
                {
                    Category = DeletionCategory, Action = new DeleteToNextWordAction()
                },
                // Insertion
                new EditActionData()
                {
                    Category = InsertionCategory, Action = new InsertLineBreakAction()
                },
                new EditActionData()
                {
                    Category = InsertionCategory, Action = new OpenLineAboveAction()
                },
                new EditActionData()
                {
                    Category = InsertionCategory, Action = new OpenLineBelowAction()
                },
                new EditActionData()
                {
                    Category = InsertionCategory, Action = new TypingAction("*Typing*", false)
                },
                // IntelliPrompt
                new EditActionData()
                {
                    Category = IntelliPromptCategory, Action = new RequestIntelliPromptAutoCompleteAction()
                },
                new EditActionData()
                {
                    Category = IntelliPromptCategory, Action = new RequestIntelliPromptCompletionSessionAction()
                },
                new EditActionData()
                {
                    Category = IntelliPromptCategory, Action = new RequestIntelliPromptParameterInfoSessionAction()
                },
                new EditActionData()
                {
                    Category = IntelliPromptCategory, Action = new RequestIntelliPromptQuickInfoSessionAction()
                },
                // Macro
                new EditActionData()
                {
                    Category = MacroCategory, Action = new CancelMacroRecordingAction()
                },
                new EditActionData()
                {
                    Category = MacroCategory, Action = new PauseResumeMacroRecordingAction()
                },
                new EditActionData()
                {
                    Category = MacroCategory, Action = new RunMacroAction()
                },
                new EditActionData()
                {
                    Category = MacroCategory, Action = new ToggleMacroRecordingAction()
                },
                // Miscellaneous
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new CapitalizeAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new CommentLinesAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new ConvertSpacesToTabsAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new ConvertTabsToSpacesAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new DuplicateAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new FormatDocumentAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new FormatSelectionAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new IndentAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new InsertTabStopOrIndentAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new MakeLowercaseAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new MakeUppercaseAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new MoveSelectedLinesDownAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new MoveSelectedLinesUpAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new OutdentAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new RemoveTabStopOrOutdentAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new ResetZoomLevelAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new TabifySelectedLinesAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new ToggleCharacterCasingAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new ToggleOverwriteModeAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new TransposeCharactersAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new TransposeLinesAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new TransposeWordsAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new TrimAllTrailingWhitespaceAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new TrimTrailingWhitespaceAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new UncommentLinesAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new UntabifySelectedLinesAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new ZoomInAction()
                },
                new EditActionData()
                {
                    Category = MiscellaneousCategory, Action = new ZoomOutAction()
                },
                // Movement
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveDownAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveLeftAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MovePageDownAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MovePageUpAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveRightAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToDocumentEndAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToDocumentStartAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToLineEndAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToLineStartAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToLineStartAfterIndentationAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToMatchingBracketAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToNextLineStartAfterIndentationAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToNextWordAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToPreviousLineStartAfterIndentationAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToPreviousWordAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToVisibleBottomAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveToVisibleTopAction()
                },
                new EditActionData()
                {
                    Category = MovementCategory, Action = new MoveUpAction()
                },
                // Scroll
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollDownAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollLeftAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollLineToVisibleBottomAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollLineToVisibleMiddleAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollLineToVisibleTopAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollPageDownAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollPageUpAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollRightAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollToDocumentEndAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollToDocumentStartAction()
                },
                new EditActionData()
                {
                    Category = ScrollCategory, Action = new ScrollUpAction()
                },
                // Search
                new EditActionData()
                {
                    Category = SearchCategory, Action = new FindAction()
                },
                new EditActionData()
                {
                    Category = SearchCategory, Action = new FindNextAction()
                },
                new EditActionData()
                {
                    Category = SearchCategory, Action = new FindNextSelectedAction()
                },
                new EditActionData()
                {
                    Category = SearchCategory, Action = new FindPreviousAction()
                },
                new EditActionData()
                {
                    Category = SearchCategory, Action = new FindPreviousSelectedAction()
                },
                new EditActionData()
                {
                    Category = SearchCategory, Action = new IncrementalSearchAction()
                },
                new EditActionData()
                {
                    Category = SearchCategory, Action = new ReplaceAction()
                },
                new EditActionData()
                {
                    Category = SearchCategory, Action = new ReverseIncrementalSearchAction()
                },
                // Selection
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new CodeBlockSelectionContractAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new CodeBlockSelectionExpandAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new CollapseSelectionAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new CollapseSelectionLeftAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new CollapseSelectionRightAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectAllAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectBlockDownAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectBlockLeftAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectBlockRightAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectBlockToNextWordAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectBlockToPreviousWordAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectBlockUpAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectDownAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectLeftAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectPageDownAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectPageUpAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectRightAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToDocumentEndAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToDocumentStartAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToLineEndAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToLineStartAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToLineStartAfterIndentationAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToMatchingBracketAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToNextWordAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToPreviousWordAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToVisibleBottomAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectToVisibleTopAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectUpAction()
                },
                new EditActionData()
                {
                    Category = SelectionCategory, Action = new SelectWordAction()
                },
            };

            // Find the default binding for each action
            foreach (EditActionData actionData in actionDataArray)
            {
                //foreach (InputBinding binding in editor.InputBindings)
                //{
                //    KeyBinding keyBinding = binding as KeyBinding;
                //    if (keyBinding != null)
                //    {
                //        IEditAction command = binding.Command as IEditAction;
                //        if ((command != null) && (command.Key == actionData.Name))
                //        {
                //            actionData.Key = EditActionBase.GetKeyText(keyBinding.Modifiers, keyBinding.Key);
                //            break;
                //        }
                //    }
                //}
            }

            // Create a collection view source
            ListCollectionView source = new ListCollectionView(actionDataArray);

            source.GroupDescriptions.Add(new PropertyGroupDescription("Category"));

            // Set list items source
            editActionsListView.ItemsSource = source;
        }
Ejemplo n.º 31
0
        private void GetData()
        {
            Task.Factory.StartNew(() =>
            {
                Application.Current.Dispatcher.Invoke(
                    DispatcherPriority.Normal,
                    (Action) delegate
                {
                    RefreshProgressValue = 0;

                    Status = "Refresh started...";

                    PerformanceTests =
                        ManagerDbRepository.PerformanceTests;

                    PerformanceTestHeader =
                        PerformanceTestHeaderConstant + " ( " + PerformanceTests.Count + " )";

                    Loggings =
                        ManagerDbRepository.Loggings;

                    ErrorLoggings = new ObservableCollection <Logging>();

                    if (Loggings != null && Loggings.Any())
                    {
                        Task.Factory.StartNew(() =>
                        {
                            foreach (var log in
                                     Loggings.Where(logging => logging.Level.Equals("ERROR", StringComparison.InvariantCultureIgnoreCase) ||
                                                    logging.Level.Equals("FATAL", StringComparison.InvariantCultureIgnoreCase)))
                            {
                                ErrorLoggings.Add(log);
                            }
                        });
                    }

                    ErrorLoggingHeader = ErrorLoggingHeaderConstant + " ( " + ErrorLoggings.Count + " )";

                    ++RefreshProgressValue;

                    LoggingHeader = LoggingHeaderConstant + " ( " + Loggings.Count + " )";

                    Jobs =
                        ManagerDbRepository.Jobs;

                    JobHistoryDataGroupBySentToData = new ListCollectionView(Jobs);

                    if (JobHistoryDataGroupBySentToData.GroupDescriptions != null)
                    {
                        JobHistoryDataGroupBySentToData.GroupDescriptions.Add(new PropertyGroupDescription("SentToWorkerNodeUri"));
                    }

                    ++RefreshProgressValue;

                    JobHistoryHeader =
                        JobHistoryHeaderConstant + " ( " + Jobs.Count + " )";

                    JobHistoryGroupBySentToHeader =
                        JobHistoryGroupBySentToHeaderConstant + " ( " + Jobs.Count + " )";

                    JobHistoryDetailData =
                        ManagerDbRepository.JobDetails;

                    ++RefreshProgressValue;

                    JobHistoryDetailHeader =
                        JobHistoryDetailHeaderConstant + " ( " + JobHistoryDetailData.Count + " )";

                    JobDefinitionData =
                        ManagerDbRepository.JobQueueItems;

                    ++RefreshProgressValue;

                    JobDefinitionDataHeader =
                        JobDefinitionHeaderConstant + " ( " + JobDefinitionData.Count + " )";

                    WorkerNodesData =
                        ManagerDbRepository.WorkerNodes;

                    ++RefreshProgressValue;

                    WorkerNodeHeader =
                        WorkerNodeHeaderConstant + " ( " + WorkerNodesData.Count + " )";

                    Status = "Refresh finished.";
                });
            });
        }
Ejemplo n.º 32
0
 public void Reload()
 {
     Vuelos = new ListCollectionView(repository.FetchAll());
     Vuelos.Refresh();
 }
        private void MetroWindow_Loaded(object sender, RoutedEventArgs e)
        {
            DataContext = this;

            // Faire la collection pour le tab
            TabItem tabItemGenerals = new TabItem {
                Header = "GENERALS", Name = "Generals"
            };
            ScrollViewer svGenerals = new ScrollViewer {
                Name = "svGenerals", HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, 0), VerticalScrollBarVisibility = ScrollBarVisibility.Auto
            };

            tabItemGenerals.Content = svGenerals;
            Grid gridGenerals = new Grid {
                Name = "gridButtonsGenerals"
            };

            svGenerals.Content = gridGenerals;

            TabItem tabItemHeureH = new TabItem {
                Header = "HEURE H", Name = "HeureH"
            };
            ScrollViewer svHeureH = new ScrollViewer {
                Name = "svHeureH", HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, 0), VerticalScrollBarVisibility = ScrollBarVisibility.Auto
            };

            tabItemHeureH.Content = svHeureH;
            Grid gridHeureH = new Grid {
                Name = "gridButtonsHeureH"
            };

            svHeureH.Content = gridHeureH;

            TabItems = new List <TabItem>();
            TabItems.Add(tabItemGenerals);
            TabItems.Add(tabItemHeureH);

            TabItemsCollectionView = new ListCollectionView(TabItems);

            // Load mods
            _currentGameName = "HeureH";
            ModFactory.Init(this, new List <string> {
                "Generals", "HeureH"
            }, new List <string> {
                _pathToMapsGenerals, _pathToMapsZeroHour
            }, _pathToExe, _uiScheduler,
                            new List <Grid> {
                gridGenerals, gridHeureH
            },
                            new List <double> {
                Convert.ToInt32(_currentGameName.Equals("Generals")), Convert.ToInt32(_currentGameName.Equals("HeureH"))
            },
                            new List <ComboBox> {
                comboBoxMapsGenerals, comboBoxMapsHeureH
            },
                            new List <CheckBox> {
                checkBoxGentoolGenerals, checkBoxGentoolHeureH
            },
                            new List <CheckBox> {
                checkBoxForceZoomGenerals, checkBoxForceZoomHeureH
            });

            // Evenements sur changement de tab
            tabControl.SelectionChanged += tabControl_SelectionChanged;

            // Sélectionner le bon jeu
            tabControl.SelectedIndex = 1;

            // Réappliquer les sélection après update
            if ((bool)Properties.Settings.Default["JustUpdated"])
            {
                ModFactory.AllGamesRefreshForceZoom();
                ModFactory.AllGamesRefreshFullscreenMode();
                ModFactory.AllGamesRefreshGentool();
                Properties.Settings.Default["JustUpdated"] = false;
                Properties.Settings.Default.Save();
            }

            // Démarrer l'affichage
            ModFactory.Refresh(_currentGameName);

            // Démarrer le détecteur de lancement
            MonitorGameRunning();
        }
Ejemplo n.º 34
0
        public MainWindow()
        {
            InitializeComponent();
            Things = new ListCollectionView(m_things);
#if DEBUG
            PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical;
#endif
            m_recent_files.Add("One", false);
            m_recent_files.Add("Two", false);
            m_recent_files.Add("Three");
            m_recent_files.RecentFileSelected += s => Debug.WriteLine(s);

            ShowColourPicker = Command.Create(this, () =>
            {
                new ColourPickerUI().Show();
            });
            ShowChart = Command.Create(this, () =>
            {
                new ChartUI().Show();
            });
            ShowDiagram = Command.Create(this, () =>
            {
                new DiagramUI().Show();
            });
            ShowDirectionPicker = Command.Create(this, () =>
            {
                var win = new Window
                {
                    Owner = this,
                    WindowStartupLocation = WindowStartupLocation.CenterOwner,
                };
                win.Content = new DirectionPicker();
                win.ShowDialog();
            });
            ShowDockContainer = Command.Create(this, () =>
            {
                new DockContainerUI().Show();
            });
            ShowJoystick = Command.Create(this, () =>
            {
                new JoystickUI().Show();
            });
            ShowMsgBox = Command.Create(this, () =>
            {
                var msg =
                    "Informative isn't it\nThis is a really really really long message to test the automatic resizing of the dialog window to a desirable aspect ratio. " +
                    "It's intended to be used for displaying error messages that can sometimes be really long. Once I had a message that was so long, it made the message " +
                    "box extend off the screen and you couldn't click the OK button. That was a real pain so that's why I've added this auto aspect ratio fixing thing. " +
                    "Hopefully it'll do the job in all cases and I'll never have to worry about it again...\n Hopefully...";
                var dlg = new MsgBox(this, msg, "Massage Box", MsgBox.EButtons.YesNoCancel, MsgBox.EIcon.Exclamation)
                {
                    ShowAlwaysCheckbox = true
                };
                dlg.ShowDialog();
            });
            ShowListUI = Command.Create(this, () =>
            {
                var dlg = new ListUI(this)
                {
                    Title         = "Listing to the Left",
                    Prompt        = "Select anything you like",
                    SelectionMode = SelectionMode.Multiple,
                    AllowCancel   = false,
                };
                dlg.Items.AddRange(new[] { "One", "Two", "Three", "Phooore, was that you?" });
                if (dlg.ShowDialog() == true)
                {
                    MsgBox.Show(this, $"{string.Join(",", dlg.SelectedItems.Cast<string>())}! Good Choice!", "Result", MsgBox.EButtons.OK);
                }
            });
            ShowLogUI = Command.Create(this, () =>
            {
                var log_ui = new LogControl {
                    LogEntryPattern = new Regex(@"^(?<Tag>.*?)\|(?<Level>.*?)\|(?<Timestamp>.*?)\|(?<Message>.*)", RegexOptions.Singleline | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled)
                };
                var dlg = new Window {
                    Title = "Log UI", Content = log_ui, ResizeMode = ResizeMode.CanResizeWithGrip
                };
                dlg.Show();
            });
            ShowPatternEditor = Command.Create(this, () =>
            {
                new PatternEditorUI().Show();
            });
            ShowProgressUI = Command.Create(this, () =>
            {
                var dlg = new ProgressUI(this, "Test Progress", "Testicles", System.Drawing.SystemIcons.Exclamation.ToBitmapSource(), CancellationToken.None, (u, _, p) =>
                {
                    for (int i = 0, iend = 100; !u.CancelPending && i != iend; ++i)
                    {
                        p(new ProgressUI.UserState
                        {
                            Description      = $"Testicle: {i / 10}",
                            FractionComplete = 1.0 * i / iend,
                            ProgressBarText  = $"I'm up to {i}/{iend}",
                        });
                        Thread.Sleep(100);
                    }
                })
                {
                    AllowCancel = true
                };

                // Modal
                using (dlg)
                {
                    var res = dlg.ShowDialog(500);
                    if (res == true)
                    {
                        MessageBox.Show("Completed");
                    }
                    if (res == false)
                    {
                        MessageBox.Show("Cancelled");
                    }
                }

                // Non-modal
                //dlg.Show();
            });
            ShowPromptUI = Command.Create(this, () =>
            {
                var dlg = new PromptUI(this)
                {
                    Title     = "Prompting isn't it...",
                    Prompt    = "I'll have what she's having. Really long message\r\nwith new lines in and \r\n other stuff\r\n\r\nEnter a positive number",
                    Value     = "Really long value as well, that hopefully wraps around",
                    Units     = "kgs",
                    Validate  = x => double.TryParse(x, out var v) && v >= 0 ? ValidationResult.ValidResult : new ValidationResult(false, "Enter a positive number"),
                    Image     = (BitmapImage)FindResource("pencil"),
                    MultiLine = true,
                };
                if (dlg.ShowDialog() == true)
                {
                    double.Parse(dlg.Value);
                }
            });
Ejemplo n.º 35
0
 public Views()
 {
     this.InitializeComponent();
     solarSystem = this.Resources["solarSystem"] as SolarSystem;
     view        = CollectionViewSource.GetDefaultView(solarSystem.SolarSystemObjects) as ListCollectionView;
 }
Ejemplo n.º 36
0
        // ====================================================================================================
        #region MÉTODOS PRIVADOS (ITEXT 7)
        // ====================================================================================================

        private static Table GetTablaGraficos(ListCollectionView listaGraficos, DateTime fecha)
        {
            // Fuente a utilizar en la tabla.
            PdfFont arial = PdfFontFactory.CreateFont("c:/windows/fonts/calibri.ttf", true);

            // Estilo de la tabla.
            iText.Layout.Style estiloTabla = new iText.Layout.Style();
            estiloTabla.SetTextAlignment(TextAlignment.CENTER)
            .SetVerticalAlignment(VerticalAlignment.MIDDLE)
            .SetMargins(0, 0, 0, 0)
            .SetPaddings(0, 0, 0, 0)
            .SetWidth(UnitValue.CreatePercentValue(100))
            .SetFont(arial)
            .SetFontSize(8);
            // Estilo titulos
            iText.Layout.Style estiloTitulos = new iText.Layout.Style();
            estiloTitulos.SetBold()
            .SetBorder(iText.Layout.Borders.Border.NO_BORDER)
            .SetFontSize(14);
            // Estilo de las celdas de encabezado.
            iText.Layout.Style estiloEncabezados = new iText.Layout.Style();
            estiloEncabezados.SetBackgroundColor(new DeviceRgb(112, 173, 71))
            .SetBold()
            .SetFontSize(8);
            // Estilo de las celdas de izq.
            iText.Layout.Style estiloIzq = new iText.Layout.Style();
            estiloIzq.SetBorderLeft(new SolidBorder(1));
            // Estilo de las celdas de med.
            iText.Layout.Style estiloMed = new iText.Layout.Style();
            estiloMed.SetBorderTop(new SolidBorder(1))
            .SetBorderBottom(new SolidBorder(1));
            // Estilo de las celdas de der.
            iText.Layout.Style estiloDer = new iText.Layout.Style();
            estiloDer.SetBorderRight(new SolidBorder(1));
            // Creamos la tabla
            float[] ancho = new float[] { 3, 3, 3, 3, 3, 3, 3, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3 };
            Table   tabla = new Table(UnitValue.CreatePercentArray(ancho));

            // Asignamos el estilo a la tabla.
            tabla.AddStyle(estiloTabla);

            string textoEncabezado = $"GRÁFICOS\n{fecha:dd - MMMM - yyyy} ({App.Global.CentroActual})".ToUpper();
            Table  tablaEncabezado = InformesServicio.GetTablaEncabezadoSindicato(textoEncabezado);

            tabla.AddHeaderCell(new Cell(1, 17).Add(tablaEncabezado).AddStyle(estiloTitulos));

            // Añadimos las celdas de encabezado.
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Número")).AddStyle(estiloEncabezados).AddStyle(estiloIzq).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Turno")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Inicio")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Final")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Ini. Partido")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Fin. Partido")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Valoracion")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Trabajadas")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Dif.")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Acumuladas")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Nocturnas")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Desayuno")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Comida")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Cena")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Plus Cena")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Limpieza")).AddStyle(estiloEncabezados).AddStyle(estiloMed));
            tabla.AddHeaderCell(new Cell().Add(new Paragraph("Paquetería")).AddStyle(estiloEncabezados).AddStyle(estiloDer).AddStyle(estiloMed));
            // Añadimos las celdas con los calendarios.
            int indice = 1;

            foreach (Object obj in listaGraficos)
            {
                Grafico g = obj as Grafico;
                if (g == null)
                {
                    continue;
                }
                // Estilo Fondo Alternativo
                iText.Layout.Style estiloFondo = new iText.Layout.Style().SetBackgroundColor(ColorConstants.WHITE);
                if (indice % 2 == 0)
                {
                    estiloFondo.SetBackgroundColor(new DeviceRgb(226, 239, 218));
                }
                indice++;
                // Estilo Valoracion Diferente
                iText.Layout.Style estiloValDif = new iText.Layout.Style();
                if (g.DiferenciaValoracion.Ticks != 0)
                {
                    estiloValDif.SetFontColor(new DeviceRgb(255, 20, 147));
                }
                // Escribimos el grafico.
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvNumGrafico.Convert(g.Numero, null, null, null)}"))
                              .AddStyle(estiloIzq).AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{g.Turno.ToString("0")}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.Inicio, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.Final, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.InicioPartido, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.FinalPartido, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.Valoracion, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo).AddStyle(estiloValDif));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.Trabajadas, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo).AddStyle(estiloValDif));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.DiferenciaValoracion, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo).AddStyle(estiloValDif));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.Acumuladas, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvHora.Convert(g.Nocturnas, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvDecimal.Convert(g.Desayuno, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvDecimal.Convert(g.Comida, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvDecimal.Convert(g.Cena, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(string)cnvDecimal.Convert(g.PlusCena, null, VerValores.NoCeros, null)}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(g.PlusLimpieza ? "X" : "")}"))
                              .AddStyle(estiloFondo));
                tabla.AddCell(new Cell().Add(new Paragraph($"{(g.PlusPaqueteria ? "X" : "")}"))
                              .AddStyle(estiloDer).AddStyle(estiloFondo));
            }
            // Ponemos los bordes de la tabla.
            tabla.SetBorderBottom(new SolidBorder(1));
            // Devolvemos la tabla.
            return(tabla);
        }
 public LinkViewsourcePage(Page page, String Ressourcename)
 {
     ViewSource = ((CollectionViewSource)(page.FindResource(Ressourcename)));
     View       = (ListCollectionView)ViewSource.View;
 }
Ejemplo n.º 38
0
        public static async Task CrearGraficosIndividualesEnPdf(Workbook libro, ListCollectionView lista, DateTime fecha)
        {
            await Task.Run(() => {
                // Definimos la hoja.
                Worksheet Hoja = libro.Worksheets[1];
                // Definimos el número de valoraciones totales a pegar.
                int valoraciones = 0;
                // Formateamos cada gráfico en la hoja.
                int fila   = 1;
                double num = 1;

                foreach (object obj in lista)
                {
                    double valor = num / lista.Count * 100;
                    App.Global.ValorBarraProgreso = valor;
                    num++;
                    Grafico g = obj as Grafico;
                    if (g == null)
                    {
                        continue;
                    }
                    // Sumamos las valoraciones al global.
                    valoraciones += g.ListaValoraciones.Count;
                    // Altura de las filas.
                    Hoja.Range[fila.ToString() + ":" + fila.ToString()].RowHeight             = 35;
                    Hoja.Range[(fila + 1).ToString() + ":" + (fila + 3).ToString()].RowHeight = 25;
                    Hoja.Range[(fila + 4 + g.ListaValoraciones.Count).ToString() + ":" + (fila + 4 + g.ListaValoraciones.Count).ToString()].RowHeight = 35;
                    // Estilos de texto
                    Hoja.Range[fila.ToString() + ":" + fila.ToString()].Font.Size             = 22;
                    Hoja.Range[(fila + 2).ToString() + ":" + (fila + 2).ToString()].Font.Size = 16;
                    Hoja.Range[(fila + 3).ToString() + ":" + (fila + 3).ToString()].Font.Size = 14;
                    Hoja.Range[fila.ToString() + ":" + (fila + 3).ToString()].Font.Bold       = true;
                    Hoja.Range[(fila + 4 + g.ListaValoraciones.Count).ToString() + ":" + (fila + 4 + g.ListaValoraciones.Count).ToString()].Font.Size = 16;
                    Hoja.Range[(fila + 4 + g.ListaValoraciones.Count).ToString() + ":" + (fila + 4 + g.ListaValoraciones.Count).ToString()].Font.Bold = true;
                    // Alineaciones
                    Hoja.Cells[fila, 1].HorizontalAlignment     = XlHAlign.xlHAlignLeft;
                    Hoja.Cells[fila, 5].HorizontalAlignment     = XlHAlign.xlHAlignRight;
                    Hoja.Cells[fila + 2, 1].HorizontalAlignment = XlHAlign.xlHAlignLeft;
                    Hoja.Cells[fila + 2, 5].HorizontalAlignment = XlHAlign.xlHAlignRight;
                    Hoja.Cells[fila + 4 + g.ListaValoraciones.Count, 1].HorizontalAlignment = XlHAlign.xlHAlignLeft;
                    Hoja.Cells[fila + 4 + g.ListaValoraciones.Count, 5].HorizontalAlignment = XlHAlign.xlHAlignRight;
                    // Colores
                    Hoja.Range[Hoja.Cells[fila + 3, 1], Hoja.Cells[fila + 3, 5]].Interior.Color = System.Drawing.Color.FromArgb(255, 112, 173, 71);
                    // Bordes.
                    Hoja.Range[Hoja.Cells[fila + 3, 1], Hoja.Cells[fila + 3 + g.ListaValoraciones.Count, 5]].Borders.LineStyle = XlLineStyle.xlContinuous;
                    Hoja.Range[Hoja.Cells[fila + 3, 1], Hoja.Cells[fila + 3 + g.ListaValoraciones.Count, 5]].Borders.Color     = XlRgbColor.rgbBlack;
                    Hoja.Range[Hoja.Cells[fila + 3, 1], Hoja.Cells[fila + 3 + g.ListaValoraciones.Count, 5]].Borders.Weight    = XlBorderWeight.xlThin;
                    Hoja.Range[Hoja.Cells[fila + 3, 1], Hoja.Cells[fila + 3, 5]].BorderAround(XlLineStyle.xlContinuous, XlBorderWeight.xlMedium,
                                                                                              XlColorIndex.xlColorIndexNone, XlRgbColor.rgbBlack);
                    Hoja.Range[Hoja.Cells[fila + 3, 1], Hoja.Cells[fila + 3 + g.ListaValoraciones.Count, 5]].BorderAround(XlLineStyle.xlContinuous, XlBorderWeight.xlMedium,
                                                                                                                          XlColorIndex.xlColorIndexNone, XlRgbColor.rgbBlack);

                    // Colores de las líneas pares de las valoraciones
                    for (int i = 0; i < g.ListaValoraciones.Count; i++)
                    {
                        if (i % 2 != 0)
                        {
                            Hoja.Range[Hoja.Cells[fila + i + 4, 1], Hoja.Cells[fila + i + 4, 5]].Interior.Color = System.Drawing.Color.FromArgb(255, 226, 239, 218);
                        }
                    }

                    // Saltos de página
                    Hoja.HPageBreaks.Add(Hoja.Cells[fila + 5 + g.ListaValoraciones.Count, 1]);

                    // Líneas totales y parciales
                    fila = fila + 5 + g.ListaValoraciones.Count;
                }

                // Definimos el array con los datos...
                string[,] datos = new string[(5 * lista.Count + valoraciones), 5];
                // Extraemos los datos de la lista de gráficos
                SetRangoGraficosIndividuales(lista, fecha, ref datos);
                // Pegamos los datos.
                Hoja.Range["A1", Hoja.Cells[(5 * lista.Count + valoraciones), 5]].Value = datos;
                // Establecemos el área de impresión.
                Hoja.PageSetup.PrintArea = Hoja.Range["A1", Hoja.Cells[(5 * (lista.Count - 1) + valoraciones), 5]].Address;
            });
        }
Ejemplo n.º 39
0
 private void DCChange(object sender, DependencyPropertyChangedEventArgs e)
 {
     MyCollectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(rootElement.DataContext);
 }
Ejemplo n.º 40
0
        // ====================================================================================================
        #region MÉTODOS PÚBLICOS (ITEXT 7)
        // ====================================================================================================

        public static async Task CrearGraficosEnPdf_7(Document doc, ListCollectionView lista, DateTime fecha)
        {
            await Task.Run(() => {
                doc.Add(GetTablaGraficos(lista, fecha));
            });
        }