Exemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     VmMain                  = new VMMain();
     this.DataContext        = VmMain;
     VmMain.PropertyChanged += Filter_PropertyChanged;
 }
Exemplo n.º 2
0
        // Après chargement de la fenêtre
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // Affichage d'une fenêtre modale d'identification
            var dlg = new ModalWindow(new VMLogin());

            dlg.Title = "Identification";
            bool?res = dlg.ShowDialog();

            // Si l'utilisateur annule, on ferme l'application
            if (!res.Value)
            {
                Close();
            }

            if (res.Value)
            {
                var p = DALPersonne.RecupererPersonneConnecte(Properties.Settings.Default.CodeDernierUtilisateur);
                if (p.Count > 1)
                {
                    Properties.Settings.Default.Manager = true;
                    Properties.Settings.Default.Save();
                }
            }
            DataContext = new VMMain();
        }
Exemplo n.º 3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            VMMain VMMain = new VMMain();

            Application.Run(VMMain.UIMainForm);
        }
Exemplo n.º 4
0
 public Session(VMMain model)
 {
     Device = model.TheController.Device;
     if (model.SelectedZone != null)
     {
         SelectedZone = model.SelectedZone.TheZone.Name;
     }
 }
Exemplo n.º 5
0
 public MainPage()
 {
     InitializeComponent();
     BindingContext      = new VMMain();
     list.RefreshCommand = new Command(() =>
     {
         Refreshlist();
     });
 }
Exemplo n.º 6
0
        private async void ItemListView_OnItemTapped(object sender, ItemTappedEventArgs e)
        {
            VMMain        selectedItem = e.Item as VMMain;
            VMDescription description  = selectedItem.GenerateDescription();

            if (selectedItem != null)
            {
                await Navigation.PushAsync(new DescriptionContent(description));
            }

            ItemListView.SelectedItem = null;
        }
Exemplo n.º 7
0
        public static void SaveState(VMMain model, Action OnSaveStateFinished)
        {
            if (
                null == model ||
                null == model.Zones ||
                null == model.TheController ||
                string.IsNullOrEmpty(model.TheController.HostNameorAddress))
            {
                return;
            }

            WriteFile(new Session(model), model.TheController.HostNameorAddress, OnSaveStateFinished);
        }
Exemplo n.º 8
0
        public async Task OnTabItemButtonClickAsync(int comCod, TabType tabType)
        {
            Task updateDLOs = this.EjercicioRepo.UpdateDLOsDictionariesAsync(new int[] { comCod });

            this.ExIsExpanded = false;
            VMMain mainVM = App.Current.MainWindow.DataContext as VMMain;

            mainVM.SetNewTabCodigoComunidad(comCod, tabType);

            await updateDLOs;

            FillEjercicioItems();
        }
Exemplo n.º 9
0
 /// <summary>
 /// Invoked when this page is about to be displayed in a Frame.
 /// </summary>
 /// <param name="e">Event data that describes how this page was reached.  The Parameter
 /// property is typically used to configure the page.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if (e.Parameter != null)
     {
         DataContext             = MainVM = e.Parameter as VMMain;
         MainVM.PropertyChanged += (s, a) =>
         {
             if (a.PropertyName == "SelectionMode")
             {
                 UpdateSelectionMode();
             }
         };
         MainVM.RefreshSelectedZone(false);
     }
 }
Exemplo n.º 10
0
        public static void GetVMMain(Device device, Action <VMMain> OnGetVMMain)
        {
            Read <Session>(device.HostnameOrIp, s => {
                //-- If we don't have any data, just return a new VM
                if (null == s || null == s.Device)
                {
                    OnGetVMMain.NullableInvoke(new VMMain(new Controller(device)));
                    return;
                }

                var vm = new VMMain(new Controller(s.Device, true));
                vm.SetSelectedZone(s.SelectedZone);

                OnGetVMMain.NullableInvoke(vm);
            });
        }
Exemplo n.º 11
0
        // Après chargement de la fenêtre
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
#if DEBUG
            // Affichage d'une fenêtre modale de choix de chaine de connexion (seulement en mode debugg)
            var dlgCnx = new ModalWindow(new VMConnection());
            dlgCnx.Title = "Connection";
            bool?resCnx = dlgCnx.ShowDialog();

            // Quitte le main si la fenêtre est fermée
            if (!resCnx.Value)
            {
                Close();
                return;
            }
#endif

            try
            {
                DataContext = new VMMain();
            }
            catch (ArgumentException)
            {
                // La création de la VMMain renvoi une exception de type ArgumentException si la chaine de connexion n'est pas valide
                MessageBox.Show("Une chaine de connexion valide doit être renseignée dans pour \"JobOverviewConnectionStringDefault\" du fichier de configuration de l'application.", "Warning", MessageBoxButton.OKCancel, MessageBoxImage.Warning);
                Close();
                return;
            }

            //Affichage d'une fenêtre modale d'identification
            var dlgLog = new ModalWindow(new VMLogin());
            dlgLog.Title = "Identification";
            bool?resLog = dlgLog.ShowDialog();

            // Si l'utilisateur annule, on ferme l'application
            if (!resLog.Value)
            {
                Close();
            }
        }
Exemplo n.º 12
0
        public void FillEjercicioItems()
        {
            this.EjercicioItemsSource.Clear();
            SideToolEjercicioItem    min    = null;
            EjercicioDLOParaSideTool minDLO = null;

            foreach (EjercicioDLOParaSideTool DLO in this.EjercicioRepo.DLOs2)
            {
                SideToolEjercicioItem item = new SideToolEjercicioItem(this, DLO);
                if (EjercicioDLOParaSideTool.Min(min.EjercicioDLO, DLO) == DLO)
                {
                    minDLO = DLO;
                    min    = item;
                }
                this.EjercicioItemsSource.Add(item);
            }

            min.IsSelected = true;
            VMMain mainVM = App.Current.MainWindow.DataContext as VMMain;

            mainVM.SetNewTabEjercicio(minDLO);
        }
Exemplo n.º 13
0
        static Tray()
        {
            _MV = new VMMain();

            //Tray icon settings
            _trayIcon             = new NotifyIcon();
            _trayIcon.Icon        = Properties.Resources.trayIcon;
            _trayIcon.Text        = Subtitles.GetText("app_name");
            _trayIcon.MouseClick += _trayIcon_MouseClick;
            _trayIcon.Visible     = false;

            _trayIcon.ContextMenu = GetContextMenu();
            //Could use Popup as ContextMenu on _trayIcon element, but can't close it when cliked outside of popup
            //////Popup initialization
            ////var _popup = new Popup();
            ////_popup.Placement = PlacementMode.Mouse;
            ////_popup.StaysOpen = false;
            ////var menu = GetMenu();
            ////_popup.Child = menu;
            ////foreach (Control item in menu.Items) {
            ////    item.Click+=(sender,e) => _popup.IsOpen = false;
            ////}
            ////menu.MouseLeave += (sender, e) => _popup.IsOpen = false;
        }
Exemplo n.º 14
0
        public async Task OnEjercicioItemButtonClickAsync(EjercicioDLOParaSideTool DLO)
        {
            VMMain mainVM = App.Current.MainWindow.DataContext as VMMain;

            mainVM.SetNewTabEjercicio(DLO);
        }
Exemplo n.º 15
0
        private void RunnerImp(string ipOrHostname, string deviceName, Action <bool> OnFinished)
        {
            if (!IsStarted)
            {
                Startup();
            }

            IsNotRunning = false;

            var d = new Device(ipOrHostname, deviceName);
            var c = new Controller(d);


            Message = "Trying to connect to the device . . . ";
            //-- Ensure the IP is accurate
            c.TrySetDevice(d, result =>
            {
                if (!result.Success)
                {
                    Message = @"There was a problem connecting to the device. Please ensure the IP or Hostname is accurate, you're connected to the same network as the device and Network Standby on the device is set to On.";
                    UI.Invoke(OnFinished, false);
                    IsNotRunning = true;
                    return;
                }

                //-- Attempt To Load
                var start = new VMStart(new Device[] { d });
                var dvm   = start.Devices[0];

                Message = "Attempting to load device . . .";

                start.Refresh();

                IsIndeterminite = false;

                Message = "Loading . . . ";
                while (dvm.IsLoading)
                {
                    PercentageComplete = dvm.PercentageLoaded;
                    Message            = dvm.LoadingMessage;
                    Thread.Sleep(100);
                }

                Message         = "Device loaded. Refreshing zone.";
                IsIndeterminite = true;

                //- Attempt to Refresh Selected Zone
                var mainVM = new VMMain(c);
                mainVM.SelectedZone.Refresh(() =>
                {
                    Message = "Device refresh success. Saving results . . .";

                    var data = SaveSessions(deviceName);

                    Message = "Save results success. Sending results . . .";

                    SimpleMailer.SendMail("*****@*****.**", "Diagnostics", "Diagnostics for " + deviceName, data);

                    File.Delete(data); //-- If we successfully sent the e-mail, no reason to hold on to this file on the desktop.

                    Shutdown();

                    PercentageComplete = 1;
                    IsIndeterminite    = false;

                    Message = "Finished.";
                    UI.Invoke(OnFinished, true);
                    IsNotRunning = true;
                });
            });
        }
Exemplo n.º 16
0
 private void pbLogout_Click(object sender, EventArgs e)
 {
     VMMain.logout();
     lbUserName.Text = "";
 }
Exemplo n.º 17
0
 public DeleteCommand(VMMain vm)
 {
     this.Vm = vm;
 }
Exemplo n.º 18
0
 public MainWindow()
 {
     InitializeComponent();
     MainModel   = VMMain.Empty;
     DataContext = MainModel;
 }
Exemplo n.º 19
0
 public AddCommand(VMMain vm)
 {
     this.Vm = vm;
 }
Exemplo n.º 20
0
 public cmdLogin(VMMain vm)
 {
     lVm = vm;
 }
Exemplo n.º 21
0
 public CmdGoBack(VMMain vm)
 {
     gVm = vm;
 }
Exemplo n.º 22
0
 public LogOutCommand(VMMain vm)
 {
     this.Vm = vm;
 }
Exemplo n.º 23
0
 public cmdRegister(VMMain vm)
 {
     rVm = vm;
 }