Exemple #1
0
        /// <summary>
        /// Runs the application.
        /// </summary>
        public void Run()
        {
            Styles.Add(new DefaultTheme());

            var loader    = new AvaloniaXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"));

            Styles.Add(baseLight);

            Styles.Add(new SampleTabStyle());
            DataTemplates = new DataTemplates
            {
                new FuncTreeDataTemplate <Node>(
                    x => new TextBlock {
                    Text = x.Name
                },
                    x => x.Children),
            };

            MainWindow.RootNamespace = "TestApplication";
            var wnd = MainWindow.Create();

            wnd.AttachDevTools();

            Run(wnd);
        }
Exemple #2
0
 public void BajaEmpleado(List <Empleado> empleados)
 {
     dataTemplates = new DataTemplates();
     try
     {
         if (VerificarSaftime())
         {
             dataEmpleadoSaftime = new DataEmpleadoSaftime();
             dataEmpleadoSaftime.Eliminar(empleados);
         }
         else
         {
             dataEmpleado = new DataEmpleado();
             dataEmpleado.Eliminar(empleados);
         }
     }
     catch (AppException appex)
     {
         throw appex;
     }
     catch (Exception ex)
     {
         throw new AppException("Error desconocido durante la baja.", "Fatal", ex);
     }
 }
Exemple #3
0
        private void InitializeComponent()
        {
            DataTemplates.Add(new ViewLocator <ReactiveObject>());
            Styles.Add(new DefaultTheme());

            Child = new Grid
            {
                RowDefinitions = new RowDefinitions("*,Auto"),
                Children       = new Controls.Controls
                {
                    new TabControl
                    {
                        Items = new[]
                        {
                            new TabItem
                            {
                                Header = "Logical Tree",
                                [!ContentControl.ContentProperty] = _viewModel.WhenAnyValue(x => x.LogicalTree),
                            },
                            new TabItem
                            {
                                Header = "Visual Tree",
                                [!ContentControl.ContentProperty] = _viewModel.WhenAnyValue(x => x.VisualTree),
                            }
                        },
                    },
                    new StackPanel
                    {
                        Orientation        = Orientation.Horizontal,
                        Gap                = 4,
                        [Grid.RowProperty] = 1,
                        Children           = new Controls.Controls
                        {
                            new TextBlock
                            {
                                Text = "Focused: "
                            },
                            new TextBlock
                            {
                                [!TextBlock.TextProperty] = _viewModel
                                                            .WhenAnyValue(x => x.FocusedControl)
                                                            .Select(x => x?.GetType().Name ?? "(null)")
                            },
                            new TextBlock
                            {
                                Text = "Pointer Over: "
                            },
                            new TextBlock
                            {
                                [!TextBlock.TextProperty] = _viewModel
                                                            .WhenAnyValue(x => x.PointerOverElement)
                                                            .Select(x => x?.GetType().Name ?? "(null)")
                            }
                        }
                    }
                }
            };
        }
        public MainWindow()
        {
            this.InitializeComponent();
#if DEBUG
            this.AttachDevTools();
#endif
            using var initScope = new TimedScope(LoggingScope.Global($"{nameof(MainWindow)}.InitializeServices"));

            Session = new Session();

            var menuProvider = new MenuProvider();
            Services.AddService <IMenuProvider>(menuProvider);

            Session.EditorViewModel = new EditorViewModel(menuProvider);
            Session.Services        = Services;

            Services.AddService <Window>(this);
            Services.AddService <Session>(Session);
            Services.AddService <IRootViewModelContainer>(Session);
            Services.AddService <ViewRegistry>(new ViewRegistry());
            Services.AddService <IDialogService>(new DialogService(Services));

            var viewDataTemplate = new ViewDataTemplate(Services);
            Services.AddService <IViewUpdater>(viewDataTemplate);
            DataTemplates.Add(viewDataTemplate);

            Services.AddService <IUndoService>(new UndoService());
            Services.AddService <IMemberViewProvider <IViewBuilder> >(new MemberViewProvider(Services));

            var commandDispatcher = new CommandDispatcher(Services);
            Services.AddService <ICommandDispatcher>(commandDispatcher);
            // after all synchronous code caused by user input has been executed
            // we begin the commands processing.
            InputManager.Instance.PostProcess.Subscribe(async(e) => await commandDispatcher.ProcessDispatchedCommands());

            var tabManager = new SimpleTabManager(Services);
            Services.AddService <ITabManager>(tabManager);
            Services.AddService <SimpleTabManager>(tabManager);

            var assetManager = new AssetManager(Services);
            Services.AddService <IAssetManager>(assetManager);
            Services.AddService <IAssetEditorRegistry>(assetManager);

            var pluginRegistry = new PluginRegistry(Services);
            pluginRegistry.RefreshAvailablePlugins();

            Services.AddService <PluginRegistry>(pluginRegistry);

            foreach (var initialPlugin in pluginRegistry.AvailablePlugins)
            {
                pluginRegistry.Register(initialPlugin);
            }

            // It will be rendered by the DataTemplate
            DataContext = Session.EditorViewModel;
        }
Exemple #5
0
    public App()
    {
        _container = new Container();
        _container.Options.ResolveUnregisteredConcreteTypes = true;
        _container.RegisterSingleton <MqttClientService>();

        var viewLocator = new ViewLocator(_container);

        DataTemplates.Add(viewLocator);
    }
Exemple #6
0
 public App()
 {
     RegisterServices();
     InitializeSubsystems((int)Environment.OSVersion.Platform);            
     Styles = new DefaultTheme();
     Styles.Add(new SampleTabStyle());
     DataTemplates = new DataTemplates
     {
         new FuncTreeDataTemplate<Node>(
             x => new TextBlock {Text = x.Name},
             x => x.Children),
     };
 }
Exemple #7
0
        public int AgregarHuella(Empleado emp, Reloj reloj)
        {
            /*Recibo todos los legajos seleccionados en el dgv junto con el reloj.
             * Por cada legajo obtengo una list con todas las huellas que tenga en el equipo.
             * Por cada legajo, consulto el empid. --> El legajo existe SI O SI en la BD ya que anteriormente descargué y guardé los datos del equipo.
             * Por cada huella guardo el empid, template, fingerindex, largo de la huella.
             * */
            dataTemplates = new DataTemplates();
            int total = 0;

            try
            {
                reloj.LeerTodasLasHuellas();
                List <Huella> huellas = new List <Huella>();
                huellas = reloj.ObtenerHuella(emp);
                total   = huellas.Count;
                foreach (Huella h in huellas)
                {
                    if (IsSaftime())
                    {
                        dataEmpleadoSaftime = new DataEmpleadoSaftime();
                        h.Empleado          = dataEmpleadoSaftime.GetDataByLegajo(h.Empleado);
                    }
                    else
                    {
                        dataEmpleado = new DataEmpleado();
                        h.Empleado   = dataEmpleado.GetDataByLegajo(h.Empleado);
                    }

                    if (!dataTemplates.Existe(h))
                    {
                        dataTemplates.InsertarHuella(h);
                    }
                    else
                    {
                        dataTemplates.ActualizarHuella(h);
                    }
                }
            }
            catch (AppException appex)
            {
                throw appex;
            }
            catch (Exception ex)
            {
                throw new AppException("Error no controlado durante la actualización de huellas", "Fatal", ex);
            }
            return(total);
        }
Exemple #8
0
 public App()
 {
     RegisterServices();
     InitializeSubsystems((int)Environment.OSVersion.Platform);
     Styles = new DefaultTheme();
     Styles.Add(new SampleTabStyle());
     DataTemplates = new DataTemplates
     {
         new FuncTreeDataTemplate <Node>(
             x => new TextBlock {
             Text = x.Name
         },
             x => x.Children),
     };
 }
Exemple #9
0
        public App()
        {
            RegisterServices();
            InitializeSubsystems((int)Environment.OSVersion.Platform);
            Styles.Add(new DefaultTheme());

            var loader    = new PerspexXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Perspex.Themes.Default.Accents.BaseLight.xaml?assembly=Perspex.Themes.Default"));

            Styles.Add(baseLight);

            Styles.Add(new SampleTabStyle());
            DataTemplates = new DataTemplates
            {
                new FuncTreeDataTemplate <Node>(
                    x => new TextBlock {
                    Text = x.Name
                },
                    x => x.Children),
            };
        }
Exemple #10
0
        public void Run()
        {
            Styles.Add(new DefaultTheme());

            var loader = new AvaloniaXamlLoader();
            var baseLight = (IStyle)loader.Load(
                new Uri("resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"));
            Styles.Add(baseLight);

            Styles.Add(new SampleTabStyle());
            DataTemplates = new DataTemplates
            {
                new FuncTreeDataTemplate<Node>(
                    x => new TextBlock {Text = x.Name},
                    x => x.Children),
            };

            MainWindow.RootNamespace = "TestApplication";
            var wnd = MainWindow.Create(); 
            wnd.AttachDevTools();

            Run(wnd);
        }
Exemple #11
0
        public SimpleLoginDemoApplication()
        {
            var avaloniaBaseUri = new Uri("avares://Avalonia.Themes.Default");

            Styles.Add(new StyleInclude(avaloniaBaseUri)
            {
                Source = new Uri("DefaultTheme.xaml", UriKind.Relative)
            });
            Styles.Add(new StyleInclude(avaloniaBaseUri)
            {
                Source = new Uri("Accents/BaseDark.xaml", UriKind.Relative)
            });

            var baseUri = new Uri("avares://SimpleLoginDemo.Presentation");

            Styles.Add(new StyleInclude(baseUri)
            {
                Source = new Uri("Resources/Styles.xaml", UriKind.Relative)
            });
            DataTemplates.Add(new DataTemplateInclude(baseUri)
            {
                Source = new Uri("Resources/Templates.xaml", UriKind.Relative)
            });
        }
 public App(IWindowService windowService, IContainer container)
 {
     _windowService = windowService;
     DataTemplates.Add(new ViewLocator(container));
 }
Exemple #13
0
 public DataTemplateChoice()
 {
     Templates = new DataTemplates();
 }
Exemple #14
0
 public static DataTemplates CreateDataTemplates(global::System.Guid ID)
 {
     DataTemplates dataTemplates = new DataTemplates();
     dataTemplates.ID = ID;
     return dataTemplates;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphDataTemplateSelector"/> class.
 /// </summary>
 public GraphDataTemplateSelector()
 {
     this.mDataTemplates = new DataTemplates();
 }
Exemple #16
0
 public void AddToDataTemplates(DataTemplates dataTemplates)
 {
     base.AddObject("DataTemplates", dataTemplates);
 }
Exemple #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphDataTemplateSelector"/> class.
 /// </summary>
 public GraphDataTemplateSelector()
 {
     this.mDataTemplates = new DataTemplates();
 }