Example #1
0
        public MainPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            this.navigationHelper            = new NavigationHelper(this);
            this.navigationHelper.LoadState += navigationHelper_LoadState;
            this.navigationHelper.SaveState += navigationHelper_SaveState;

            IEnumerable <Ticket> data = AppDataManager.RetrieveTickets();

            tickets =
                data == null
                ? new ObservableCollection <Ticket>()
                : new ObservableCollection <Ticket>(data);

            IEnumerable <Request> data1 = AppDataManager.RetrieveRequests();

            requests =
                data1 == null
                ? new ObservableCollection <Request>()
                : new ObservableCollection <Request>(data1);

            sugg = new ObservableCollection <City>();
            fromBox.DataContext     = this;
            toBox.DataContext       = this;
            trainReqBox.DataContext = trainRequest;
        }
Example #2
0
        static void Main(string[] args)
        {
            Version = ReleaseInformations.GetVersion();

            Console.Title = $"Ryujinx Console {Version} (Headless SDL2)";

            AppDataManager.Initialize(null);

            _virtualFileSystem    = VirtualFileSystem.CreateInstance();
            _libHacHorizonManager = new LibHacHorizonManager();

            _libHacHorizonManager.InitializeFsServer(_virtualFileSystem);
            _libHacHorizonManager.InitializeArpServer();
            _libHacHorizonManager.InitializeBcatServer();
            _libHacHorizonManager.InitializeSystemClients();

            _contentManager         = new ContentManager(_virtualFileSystem);
            _accountManager         = new AccountManager(_libHacHorizonManager.RyujinxClient);
            _userChannelPersistence = new UserChannelPersistence();

            _inputManager = new InputManager(new SDL2KeyboardDriver(), new SDL2GamepadDriver());

            GraphicsConfig.EnableShaderCache = true;

            Parser.Default.ParseArguments <Options>(args)
            .WithParsed(options => Load(options))
            .WithNotParsed(errors => errors.Output());

            _inputManager.Dispose();
        }
Example #3
0
    public void RequestLatestEmails()
    {
        //request data with protocol
        List <EmailDataManager.EmailDataDesc> data = AppDataManager.RequestData(AppDataManager.Protocol.EMAIL_GET_LATEST, new string[0]).Cast <EmailDataManager.EmailDataDesc>().ToList();

        EmailDataManager.AcquiredLatestEmail(data);
    }
Example #4
0
    IEnumerator TestProtocol()
    {
        yield return(new WaitForSeconds(5));

        //Test Protocol.TEXT_GET_FROM_INDEX
        //var test = (NewsExec)SituationModule.Instance.getSituationContent(temp);
        //TextMsgObj tempObj = (TextMsgObj)
        var test = DbBehaviourModule.Instance.FetchSituation(1, 2);

        //AppDataManager.SetData(AppDataManager.Protocol.TEAM_WRITE_TO_HISTORY, new List<AppDataManager.DataDesc>() { new TeamDataManager.TeamDataDesc(1, "Doctor","2", "This is amazing") });

        var temp = AppDataManager.RequestData(AppDataManager.Protocol.TEAM_ACT_GET_LATEST, new string[1] {
            "5"
        });
        //Debug.Log(((TeamDataManager.TeamDataDesc)temp[0]).message);
        //Debug.Log(((TeamDataManager.TeamDataDesc)temp[1]).message);

        //GameObject.Find("Canvas").gameObject.transform.GetChild(0).GetComponent<TMPro.TextMeshProUGUI>().text = ((TeamDataManager.TeamDataDesc)temp[0]).message;
        //Debug.Log(temp.Count);

        //Test Protocol.TEXT_GET_LATEST_BY_SITUATION

        //TextDataManager.TextDataDesc TestData = new TextDataManager.TextDataDesc(10, "TempSpeaker", "TempContent", false, 99);
        //TextDataManager.TextDataDesc TestData1 = new TextDataManager.TextDataDesc(11, "TempSpeaker1", "TempContent2", false, 99);

        //AppDataManager.SetData(AppDataManager.Protocol.TEXT_WRITE_TO_HISTORY, new TextDataManager.TextDataDesc[]{TestData,TestData1} );
    }
Example #5
0
        private void MefinoGUI_FormClosed(object sender, FormClosedEventArgs e)
        {
            TemporaryFile.CleanupAllFiles();

            AppDataManager.SaveConfig();
            ProfileManager.SavePrompt();
        }
        public void UpdateGemsPerLevel()
        {
            SkillsPerLevel.Clear();

            var groupedList = AppDataManager.Instance().MyBuildSkillGems.GroupBy(gem => gem.RequiredLevel).OrderBy(grp => Convert.ToInt32(grp.Key));

            foreach (var level in groupedList)
            {
                SkillGemPerLevel gemPerLevel = new SkillGemPerLevel();
                int groupLevel = Convert.ToInt32(level.Key);

                foreach (var gem in level)
                {
                    gemPerLevel.GroupGemsPerLevel.Add(gem);
                }
                //Display that they are available with a different UI

                gemPerLevel.Available    = groupLevel <= CurrentLevel;
                gemPerLevel.SectionTitle = $"Level {level.Key}";
                //gemPerLevel.SectionTitle = gemPerLevel.Available ? $"Level {level.Key} UNLOCKED":$"Level {level.Key}";


                SkillsPerLevel.Add(gemPerLevel);
            }
        }
        private void loadBtn_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter           = "json (*.json)|*.json";
            dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            if (dlg.ShowDialog() == true)
            {
                using (StreamReader r = new StreamReader(dlg.FileName))
                {
                    string json = r.ReadToEnd();
                    AppDataManager.Instance().MyBuildSkillGems.Clear();
                    var list = JsonConvert.DeserializeObject <ObservableCollection <SkillGem> >(json);
                    foreach (var item in list)
                    {
                        //find corresponding gem in the AllList
                        var gem = AllSkillGems.Where(x => x.Name == item.Name).SingleOrDefault();
                        if (gem != null)
                        {
                            gem.CharacterClass = AppDataManager.Instance().Settings.User.Class;
                            AppDataManager.Instance().MyBuildSkillGems.Add(gem);
                        }
                    }
                }
            }
        }
Example #8
0
 static void Main()
 {
     Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
     AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
     Application.ApplicationExit += new EventHandler(Application_ExitHandler);
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     try
     {
         if (!AppDataManager.loadCfgFile())
         {
             MessageBox.Show(ErrorHelper.ConfigFileCorrupted, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     catch (Exception ex)
     {
         Logger.NewLog(ex, "Major config file problem at start.");
         MessageBox.Show(String.Format(ErrorHelper.ConfigFileFailure, Logger.LogsFolderPath), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Application.Exit();
     }
     if (IsFirstInstance())
     {
         Application.Run(new MainForm(true));
     }
     else
     {
         Application.Run(new MainForm(false));
     }
 }
Example #9
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                if (AppDataManager.getCfgParameter(AppDataNames.SaveOnClosing) == "1")
                {
                    SaveToXml();
                }
                else
                {
                    DialogResult answer = AskForSaving();
                    switch (answer)
                    {
                    case DialogResult.Cancel:
                        e.Cancel = true;
                        break;

                    case DialogResult.Yes:
                        SaveToXml();
                        break;
                    }
                }
                if (!e.Cancel)
                {
                    AppDataManager.setCfgParameter(AppDataNames.DefaultAudioOutputDevice, audioHkDevicesCmbBox.SelectedValue.ToString());
                    AppDataManager.saveCfg();
                    SoundPlayer.Instance.Notificator.Dispose();
                }
            }
            catch (Exception ex)
            {
                Logger.NewLog(ex, "Exception when closing the form");
                e.Cancel = false;
            }
        }
Example #10
0
        public void Build(IAppInfo appInfo)
        {
            if (startups == null)
            {
                throw new InvalidOperationException("Cannot build an already build container");
            }

            var serviceRegistry = new ServiceRegistry();

            var appDataManager = new AppDataManager(appInfo);
            var settingManager = new IOSettingsManager(appDataManager);

            serviceRegistry.AddSingleton(appInfo);
            serviceRegistry.AddSingleton <IAppDataManager>(appDataManager);
            serviceRegistry.AddSingletonWithAutoInject <IIOSettingsManager, IOSettingsManager>(settingManager);

            var startupContext = new StartupContext(appInfo, appDataManager, settingManager);

            foreach (var startup in startups)
            {
                serviceRegistry.AddAutoInject(startup);
                startup.ConfigureServices(serviceRegistry, startupContext);
            }

            _container = new Container(serviceRegistry);
            _setup     = null;

            startups.Clear();
            startups = null;

            foreach (var informService in _container.GetServices <IAfterDIContainerBuildListener>())
            {
                informService.AfterDIContainerBuild();
            }
        }
Example #11
0
        public static void Main()
        {
            ConfigureUnity();


            SettingsManager = new AppDataManager();
            bool check = true;

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginForm lf = Container.Resolve <LoginForm>();

            while (check)
            {
                lf.ShowDialog();
                if (lf.DialogResult == DialogResult.Yes)
                {
                    Application.Run(Container.Resolve <RegistrationForm>());
                }
                else if (lf.DialogResult == DialogResult.OK)
                {
                    Id = lf.GetId();
                    Application.Run(Container.Resolve <MainForm>());
                }
                else
                {
                    check = false;
                    Application.Exit();
                }
            }
        }
        public SelectTagWindow(TaskInfo taskInfo)
        {
            InitializeComponent();

            AppDataManager = AppDataManager.Instance;
            TaskInfo       = taskInfo;
        }
        private void gemLabel_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            GemLabelMouseDoubleClick?.Invoke(sender, e);
            var label = sender as TextBox;

            AppDataManager.Instance().MyBuildSkillGems.Remove((SkillGem)label.DataContext);
            //  UpdateGemsPerLevel();
        }
Example #14
0
    private void writeToDatabase(EmailExecutionObj exeObj)
    {
        EmailDataManager.EmailDataDesc dataDesc = new EmailDataManager.EmailDataDesc(-1, exeObj.WithWho, exeObj.IsPlayerTalking, exeObj.Subject, exeObj.Content, exeObj.Situation_Id);
        List <AppDataManager.DataDesc> dataList = new List <AppDataManager.DataDesc>();

        dataList.Add(dataDesc);
        AppDataManager.SetData(AppDataManager.Protocol.EMAIL_WRITE_TO_HISTORY, dataList);
    }
Example #15
0
        /// <summary>
        /// Core initialization that must happen for Mefino's base features to operate.
        /// </summary>
        internal static void CoreInit()
        {
            AppDataManager.LoadConfig();

            WebClientManager.Initialize();

            // Local refresh (doesn't download new manifests)
            RefreshAllPackages();
        }
Example #16
0
        private DialogResult AskForSaving()
        {
            DialogResult answer = DialogResult.None;

            if (AppDataManager.getCfgParameter(AppDataNames.DisableDirtyTracker) == "0" && dirtyTracker.IsFormDirty())
            {
                answer = MessageBox.Show("Save hotkeys?", "Save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
            }
            return(answer);
        }
Example #17
0
    public void RequestMessagesBySenders(string[] sender)
    {
        List <TextDataManager.TextDataDesc> data;

        for (int i = 0; i < sender.Length; i++)
        {
            data = AppDataManager.RequestData(AppDataManager.Protocol.TEXT_GET_LATEST_BY_SPEAKER, new string[] { TextObtainedCount.ToString(), sender[i] }).Cast <TextDataManager.TextDataDesc>().ToList();
            TextDataManager.AcquiredLatestMessageForConversation(data);
        }
    }
Example #18
0
        /// <summary>
        /// Invoked when application execution is being suspended.  Application state is saved
        /// without knowing whether the application will be terminated or resumed with the contents
        /// of memory still intact.
        /// </summary>
        /// <param name="sender">The source of the suspend request.</param>
        /// <param name="e">Details about the suspend request.</param>
        private async void OnSuspending(object sender, SuspendingEventArgs e)
        {
            var deferral = e.SuspendingOperation.GetDeferral();

            // TODO: Save application state and stop any background activity
            await SuspensionManager.SaveAsync();

            // save app's data
            AppDataManager.SaveTickets(MainPage.tickets);
            AppDataManager.SaveRequests(MainPage.requests);

            deferral.Complete();
        }
Example #19
0
        static void Main()
        {
            List <Person> myList = new List <Person>();

            Person person1 = new Person(1, "Name1");
            Person person2 = new Person(2, "Name2");

            myList.Add(person1);
            myList.Add(person2);

            Console.WriteLine("MyList:");

            foreach (Person p in myList)
            {
                Console.WriteLine(p.Id + ": " + p.Name);
            }

            AppDataManager <Person> manager = new AppDataManager <Person>("person_list", myList);

            Console.WriteLine(manager.BinPath);
            Console.WriteLine(manager.XmlPath);


            Person person3 = new Person(3, "Name3");

            manager.Items.Add(person3);

            manager.Save();

            manager.SaveXml();

            List <Person> loadedList = manager.Load();

            List <Person> loadedListXML = manager.LoadXml();

            Console.WriteLine("LoadedList:");

            foreach (Person p in loadedList)
            {
                Console.WriteLine(p.Id + ": " + p.Name);
            }

            Console.WriteLine("LoadedListXML:");

            foreach (Person p in loadedListXML)
            {
                Console.WriteLine(p.Id + ": " + p.Name);
            }

            Console.ReadLine();
        }
Example #20
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            AppDataManager = AppDataManager.Instance;

            AppDataManager.GetTags().ForEach(tag =>
            {
                var view = new TagView(tag)
                {
                    UseSelection = false
                };
                view.ClickDleted += View_ClickDleted;
                TagArea.Children.Add(view);
            });
        }
        async void YesClick(object sender, RoutedEventArgs e)
        {
            bool success = await AppDataManager.DeleteCacheAndSettingsAsync();

            if (success)
            {
                MessageTextBlock.Text = "Cache deleted successfully";
                YesButton.Visibility  = Visibility.Collapsed;
                NoButton.Content      = "OK";
            }
            else
            {
                MessageTextBlock.Text = "Error deleting cache";
            }
        }
	void Awake() 
	{
		if(_instance == null)
		{
			_instance = this;
			DontDestroyOnLoad(this);
		}
		else
		{
			if(this != _instance)
				Destroy(this.gameObject);
		}

		dataModels = new List<DataModel>();
	}
Example #23
0
 public OptionsForm(MainForm mainF)
 {
     this.mainF = mainF;
     InitializeComponent();
     this.FormBorderStyle                   = FormBorderStyle.FixedSingle;
     hotkeysStartTxtBox.Text                = AppDataManager.getCfgParameter(AppDataNames.DefaultXmlFilePath);
     hotkeysStartChkBox.Checked             = AppDataManager.getCfgParameter(AppDataNames.LoadXmlOnStartUp) == "1";
     disableDirtyTrackerChkBox.Checked      = AppDataManager.getCfgParameter(AppDataNames.DisableDirtyTracker) == "1";
     resetRatesOnNewPlayChkBox.Checked      = AppDataManager.getCfgParameter(AppDataNames.ResetRatesOnNewPlay) == "1";
     resetAutoRepeatOnNewPlayChkBox.Checked = AppDataManager.getCfgParameter(AppDataNames.ResetAutoRepeatOnNewPlay) == "1";
     displayFullFilepathsChkBox.Checked     = AppDataManager.getCfgParameter(AppDataNames.DisplayTracksFullFilepaths) == "1";
     enableNotifChkBox.Checked              = AppDataManager.getCfgParameter(AppDataNames.EnableNotifications) == "1";
     audioLatencyNumBox.Value               = int.TryParse(AppDataManager.getCfgParameter(AppDataNames.AudioLatency), out int latency) ? latency : 50;
     tracksPlayOrderCmbBox.Text             = AppDataManager.getCfgParameter(AppDataNames.TracksPlayOrder);
 }
Example #24
0
        private void cbClass_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            string charClass = ((sender as ComboBox).SelectedItem as ComboBoxItem).Content as string;

            AppDataManager.Instance().Settings.User.Class = charClass;
            //refresh all build gem quest reward by chosen class
            foreach (SkillGem gem in AppDataManager.Instance().MyBuildSkillGems)
            {
                if (gem.QuestRewards == null)
                {
                    continue;
                }
                gem.CharacterClass = charClass;
            }
        }
    public override void OnHide()
    {
        // Write executed news to the history and set the state to finished
        List <AppDataManager.DataDesc> dataDescList = new List <AppDataManager.DataDesc>();

        for (int i = 0; i < currentlyExecutingNews.Count; i++)
        {
            dataDescList.Add(new NewsDataManager.NewsDataDesc(-1, currentlyExecutingNews[i].title, currentlyExecutingNews[i].iconPath, currentlyExecutingNews[i].description));
            AppCallbackModule.Instance.Execute(currentlyExecutingNews[i].appCallback);
        }
        AppDataManager.SetData(AppDataManager.Protocol.NEWS_WRITE_TO_HISTORY, dataDescList);

        // NewsDataManager list up-to-date with the db
        RequestLatestNewsContents();
        currentlyExecutingNews.Clear();
    }
        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            //Save the gems in the build into a list
            var json = JsonConvert.SerializeObject(AppDataManager.Instance().MyBuildSkillGems);
            //TODO:Only save gem name
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            dlg.FileName         = "MyBuildSkillGems.json";
            dlg.Filter           = "json (*.json)|*.json";
            if (dlg.ShowDialog() == true)
            {
                //save
                File.WriteAllText(dlg.FileName, json);
            }
        }
Example #27
0
        private void Save()
        {
            AppDataManager.Instance().Settings.User.Character = character.Text;
            AppDataManager.Instance().Settings.User.POEFolder = poeFolder.Text;
            AppDataManager.Instance().Settings.User.Class = cbClass.Text;

            for (int i = 0; i < tabActs.Items.Count; i++)
            {
                TabItem tabItem = tabActs.Items[i] as TabItem;
                TextBox txtBox = tabItem.Content as TextBox;
                string  value = txtBox.Text;
                AppDataManager.Instance().Settings.User.ActNotes[$"Act{i+1}"] = value;
            }

            AppDataManager.Instance().Settings.Save();
        }
Example #28
0
        void StartGettingFeed(Frame frame)
        {
            getWeatherReportsSource = new CancellationTokenSource();
            CancellationToken WRtoken = getWeatherReportsSource.Token;

            getTweetsSource = new CancellationTokenSource();
            CancellationToken TweetsToken = getTweetsSource.Token;

            AppDataManager.viewModel = viewModel;

            getWeatherReportsTask = new Task(async() =>
            {
                viewModel.LoadReportCache = await AppDataManager.RestoreFromLocalCacheAsync <ObservableCollection <WeatherReport> >("reports");
                while (!WRtoken.IsCancellationRequested)
                {
                    await frame.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                    async() =>
                    {
                        viewModel.ReportsList = await FeedFetch.GetWeatherFeedAsync(AppSettingsData.GetReportQuery);
                        await AppDataManager.SaveToLocalCacheAsync <ObservableCollection <WeatherReport> >
                            (viewModel.ReportsList, AppSettingsData.reportsFileName);
                    });

                    WRtoken.WaitHandle.WaitOne(AppSettingsData.UpdatesIntervalMsec);
                }
            });

            getTweetsTask = new Task(async() =>
            {
                while (!TweetsToken.IsCancellationRequested)
                {
                    AppSettingsData.TweetsToLoad = await AppSettingsData.LoadTweets();
                    await frame.Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
                                                    async() =>
                    {
                        viewModel.TweetList = await FeedFetch.GetTweetsAsync(AppSettingsData.TweetsToLoad);
                    });
                    TweetsToken.WaitHandle.WaitOne(AppSettingsData.UpdatesIntervalMsec);
                }
            });


            getWeatherReportsTask.Start();
            getTweetsTask.Start();
        }
Example #29
0
        private void Load()
        {
            AppDataManager.Instance().Settings.Load();
            poeFolder.Text = AppDataManager.Instance().Settings.User.POEFolder;
            character.Text = AppDataManager.Instance().Settings.User.Character;
            cbClass.Text   = AppDataManager.Instance().Settings.User.Class;

            for (int i = 0; i < tabActs.Items.Count; i++)
            {
                TabItem tabItem = tabActs.Items[i] as TabItem;
                TextBox txtBox  = tabItem.Content as TextBox;
                string  key     = $"Act{i + 1}";
                if (AppDataManager.Instance().Settings.User.ActNotes.ContainsKey(key))
                {
                    txtBox.Text = AppDataManager.Instance().Settings.User.ActNotes[key];
                }
            }
        }
        private static void checkTickets()
        {
            IEnumerable <Ticket> tickets = AppDataManager.RetrieveTickets();

            foreach (Ticket tic in tickets)
            {
                if (tic.notifyBeforeDeparture && (tic.departure.GetDateTime() - DateTimeOffset.Now).Hours < 5)
                {
                    tic.notifyBeforeDeparture = false;
                    Notification.SendToast(
                        "У вас потяг " + tic.departure.date.ToString("d"),
                        tic.from + " - " + tic.to + " о " + tic.departure.time,
                        DateTimeOffset.Now.AddSeconds(15),
                        "UZTracer.TicketPage?info&" + JsonConvert.SerializeObject(tic));
                }
            }
            AppDataManager.SaveTickets(tickets);
        }
Example #31
0
 internal static void Cmd_SetOutwardPath(params string[] args)
 {
     if (args == null || args.Length < 1 || string.IsNullOrEmpty(args[0]))
     {
         Console.WriteLine("Invalid outward path!");
     }
     else
     {
         if (!Folders.SetOutwardFolderPath(args[0]))
         {
             Console.WriteLine($"Invalid Outward path '{args[0]}'");
         }
         else
         {
             AppDataManager.SaveConfig();
         }
     }
 }