Ejemplo n.º 1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            AppDomain.CurrentDomain.AssemblyResolve += LoadEmbedAssembly;
            DeleteFiles();

            Instence = this;
            EventsManager.DatasDownloaded += OnDatasDownloaded;
            SaveInServer.Intitialize();
            LoadDatas();

            string[] args = Environment.GetCommandLineArgs();
            if (args.Length <= 1)
            {//Normal mode
                StartNormalMode();
            }
            else
            {
                switch (args[1])
                {
                case NOTIFAPPARG:
                    Mode = AppMode.NotificationMode;
                    NotificationsManager.Start_HomeworkNotification();
                    if (Agenda_Virtuel.Properties.Settings.Default.RunPluginNotification)
                    {
                        Plugin.PluginManager.Open();
                    }
                    break;

                default:
                    StartNormalMode();
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        private void LoadDatas(Save save = null)
        {
            Styles.Initialize();

            if (save == null)
            {
                Save.LoadFile();
            }
            else
            {
                Save.LoadSave(save);
            }

            Brush background;

            if (Global.userData.settings.colors.BackgroundColor != null)
            {
                background = Global.userData.settings.colors.BackgroundColor;
            }
            else
            {
                background = Styles.DefaultWinBackgroundColor;
            }

            SaveInServer.DisableQuery();
            SettingsManager.SetWindowsBackground(background, false);
        }
Ejemplo n.º 3
0
        private void StartNormalMode()
        {
            MyFunctions.UpdateManager.CheckUpdate();

            Mode = AppMode.Normal;
            ShowMainWindow();
            Plugin.PluginManager.Open();
            SaveInServer.Download();
            SaveInServer.SartUpdateTimer();
        }
Ejemplo n.º 4
0
        private void SaveSchoolGradesOptions()
        {
            save = true;

            if (!saveSchoolOptions)
            {
                saveSchoolOptions = true;
                OnClosing        += () =>
                {
                    bool showComments    = Global.userData.schoolGrades.ShowComments;
                    bool highlightResult = Global.userData.schoolGrades.HighlighResult;
                    SaveInServer.UpdateSchoolOptions(showComments, highlightResult);
                };
            }
        }
Ejemplo n.º 5
0
        private void BT_AccountLogin_Click(object sender, RoutedEventArgs e)
        {
            AccountConnectionWindow acw = new AccountConnectionWindow();

            acw.ShowDialog();

            if (acw.Success)
            {
                Properties.Settings.Default.UserID = acw.UserID;
                Properties.Settings.Default.Save();

                SaveInServer.Download();
                SaveInServer.Connection();

                ShowIfSaveOnline();
            }
        }
Ejemplo n.º 6
0
        private void CB_PluginEnabled_Click(object sender, RoutedEventArgs e)
        {
            Global.userData.settings.PluginSettings.enabled = this.CB_PluginEnabled.IsChecked == true;
            Save.SaveData();

            SaveInServer.UpdatePluginIsEnabled(this.CB_PluginEnabled.IsChecked == true);

            if (this.CB_PluginEnabled.IsChecked == true)
            {
                PluginManager.StartAll();
                ShowPluginsSettings();
            }
            else
            {
                System.Diagnostics.Process.Start(System.Windows.Application.ResourceAssembly.Location);
                System.Windows.Application.Current.Shutdown();
            }
        }
        private async System.Threading.Tasks.Task TryToConnectAsync()
        {
            if (SaveInServer.IsEnabled())
            {
                if (string.IsNullOrEmpty(PluginStoreManager.UserName))
                {
                    FormUrlEncodedContent elements = new FormUrlEncodedContent(new[]
                    {
                        new KeyValuePair <string, string>("mode", "getusername"),
                        new KeyValuePair <string, string>("userid", SaveInServer.UserID.ToString())
                    });

                    XElement json = await Functions.SendPostRequest(elements, PluginStoreManager.PHPpluginstoreURL);

                    PluginStoreManager.UserName = json.Element("Name")?.Value;

                    connected = true;
                    PluginStoreManager.UserID = SaveInServer.UserID;
                    ShowConnectedUserMenu();
                }
            }
        }