示例#1
0
        private void TrafficController_OnLoggedIn(TrafficController sender, string info)
        {
            popUpForm.labelWhat.Text = info;
            /// Changes the status displayed in combobox, when you logged in
            if (trafficController.GetState() == State.LoggedIn)
            {
                if (SaveToFileCheckBox.Checked)
                {
                    SaveToJSON loginFile = new SaveToJSON()
                    {
                        login    = TextBoxLogin.Text,
                        password = TextBoxPassword.Text
                    };
                    string jsonWrite = new JavaScriptSerializer().Serialize(loginFile);
                    //File.WriteAllText(@".\file.json", jsonWrite);

                    var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
                    File.WriteAllText(path + "BzCOMfile.json", jsonWrite);
                }

                this.Hide();
                trafficController.GetUsers();
                new AddressBookForm();
                //MainForm.Show();
                //MainForm.Run(TextBoxLogin.Text, TextBoxPassword.Text);
            }

            if (trafficController.wrongLogin)
            {
                labelLoginInfo.Text          = "ZŁY LOGIN LUB HASŁO";
                trafficController.wrongLogin = false;
            }
        }
 private void Pay(object obj)
 {
     SaveToJSON.SaveList(filePathJson, SummaryMedicament);
     SaveToXML.SaveList(filePathXml, SummaryMedicament);
     MessageBox.Show("Twoje zamówienie zostało wysłane. Dziękujemy za skorzystanie z serwisu AptekaBezRecepty");
     Environment.Exit(1);
 }
示例#3
0
    // Use this for initialization
    /// <summary>
    /// Initialize the ScrollView in the beginning by reading the .json-File that lies in the persistentDataPath
    /// </summary>
    void Start()
    {
        nameJourney = PlayerPrefs.GetString("journeyclicked");
        if (PlayerPrefs.GetString("firstadded" + nameJourney).Equals(""))
        {
            PlayerPrefs.SetString("firstadded" + nameJourney, "-1");
        }
        journeys = new List <Journey>();
        save     = new SaveToJSON();

        try
        {
            journeys = JsonConvert.DeserializeObject <List <Journey> >(File.ReadAllText(Path.Combine(Application.persistentDataPath, "journey.json")));
            var fromFile = new ItemModel();

            Journey actualJourney = journeys.Find(x => x.Name.Equals(nameJourney));
            airplanes = actualJourney.Airplane;
            trains    = actualJourney.Train;
            buses     = actualJourney.Bus;
            if (trains != null)
            {
                foreach (Train train in trains)
                {
                    fromFile.date = train.Date;
                    fromFile.name = train.Departure + " - " + train.Destination;
                    fromFile.time = train.TimeDeparture;

                    OnReceiveNewModelTrain(fromFile);
                }
            }

            if (buses != null)
            {
                foreach (Bus bus in buses)
                {
                    fromFile.date = bus.Date;
                    fromFile.name = bus.Departure + " - " + bus.Destination;
                    fromFile.time = bus.TimeDeparture;
                    OnReceiveNewModelBus(fromFile);
                }
            }

            if (airplanes != null)
            {
                foreach (Airplane plane in airplanes)
                {
                    fromFile.date = plane.Date;
                    fromFile.name = plane.Departure + " - " + plane.Destination;
                    fromFile.time = plane.TimeDeparture;
                    OnReceiveNewModelAirplane(fromFile);
                }
            }
        }
        catch (FileNotFoundException)
        {
            Debug.Log("No Connection is available yet");
        }
    }
示例#4
0
    /// <summary>
    /// method changes the boolean-value in the .json if user clicks on checkbox
    /// </summary>
    public void CheckToggle(GameObject changedToggle, bool isChecked)
    {
        if (isChecked)
        {
            journeys.Find(x => x.Name.Equals(journeyName)).PackingList.item[changedToggle.GetComponentInChildren <TextMeshProUGUI>().text] = true;
        }
        else
        {
            journeys.Find(x => x.Name.Equals(journeyName)).PackingList.item[changedToggle.GetComponentInChildren <TextMeshProUGUI>().text] = false;
        }
        SaveToJSON saveToJSON = new SaveToJSON();

        saveToJSON.SaveJourney(journeys);
    }
示例#5
0
 // Use this for initialization
 void Start()
 {
     AndroidNativeController.OnFileSelectSuccessEvent   = OnSuccess;
     AndroidNativeController.OnFileSelectFailureEvent   = OnFailure;
     AndroidNativeController.OnPositiveButtonPressEvent = (message) => {
         journeys = JsonConvert.DeserializeObject <List <Journey> >(File.ReadAllText(Path.Combine(Application.persistentDataPath, "journey.json")));
         name     = PlayerPrefs.GetString("journeyclicked");
         journeys.RemoveAll(x => x.Name.Equals(name));
         SaveToJSON save = new SaveToJSON();
         save.SaveJourney(journeys);
         SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex - 1);
     };
     AndroidNativeController.OnNegativeButtonPressEvent = (message) => {
         // Code whatever you want on click "NO" Button.
     };
 }
示例#6
0
    /// <summary>
    /// The method checks if the fields are empty and if not generates a new itemmodel with the
    /// values from the fields. Also saves an expenditure in the .json-File
    /// </summary>
    public void UpdateItem()
    {
        int resultInt;

        if (string.IsNullOrEmpty(expenditure.text))
        {
            SSTools.ShowMessage("name empty", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else if (string.IsNullOrEmpty(amount.text))
        {
            SSTools.ShowMessage("amount empty", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else if (!int.TryParse(amount.text, out resultInt))
        {
            SSTools.ShowMessage("amount in numbers", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else
        {
            var result = new ItemModel();
            result.expenditure = expenditure.text;
            result.amount      = amount.text;
            totalSpent        += Int32.Parse(amount.text);
            spent.SetText("Spent: " + totalSpent + "€");

            name = PlayerPrefs.GetString("journeyclicked");
            Journey actualJourney = journeys.Find(x => x.Name.Equals(name));
            Debug.Log(journeys);
            Debug.Log(actualJourney);
            left.SetText("Left: " + (actualJourney.Budget.Total - totalSpent) + "€");
            BudgetBar.GetComponent <Image>().fillAmount = (totalSpent / actualJourney.Budget.Total);
            //result.name = journey.GetName();

            SaveToJSON save = new SaveToJSON();
            save.SaveExpenditure(result.expenditure, int.Parse(result.amount), journeys);
            Debug.Log("save");

            OnReceiveNewModel(result);
        }
    }
示例#7
0
    /// <summary>
    /// method should use the db api for getting more information about trains, doesn't work so
    /// </summary>

    /* public void ShowMoreTrains() {
     *
     *       HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://api.deutschebahn.com/freeplan/v1/location/berlin");
     *       request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
     *
     *       using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
     *       using (Stream stream = response.GetResponseStream())
     *       using (StreamReader reader = new StreamReader(stream))
     *       {
     *           result = reader.ReadToEnd();
     *
     *       }
     *
     * }*/

    /// <summary>
    /// this method adds a new checkbox to the packinglist and saves the item in the .json-file
    /// </summary>
    public void AddItem()
    {
        if (string.IsNullOrEmpty(nameItem.text))
        {
            SSTools.ShowMessage("name empty", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else
        {
            journeyName = PlayerPrefs.GetString("journeyclicked");
            journeys.Find(x => x.Name.Equals(journeyName)).PackingList.item.Add(nameItem.text, false);
            SaveToJSON save = new SaveToJSON();
            save.SaveJourney(journeys);
            GameObject toggle = (GameObject)Instantiate(checkBox.gameObject) as GameObject;
            toggle.transform.SetParent(Packingcontent, false);
            toggle.GetComponentInChildren <TextMeshProUGUI>().text = nameItem.text;
            toggle.GetComponentInChildren <Toggle>().onValueChanged.AddListener(delegate(bool b) { CheckToggle(toggle, b); });
            toggle.GetComponentInChildren <Toggle>().isOn = false;

            addItem.SetActive(false);
            overview.SetActive(true);
        }
    }
    /// <summary>
    /// The method checks if the fields are empty and if not generates a new itemmodel with the
    /// values from the fields. Also saves a journey in the .json-File and generates the packinglistitems
    /// </summary>
    public void UpdateItem()
    {
        //DateTime dt;
        int resultInt;

        if (string.IsNullOrEmpty(MName.text))
        {
            SSTools.ShowMessage("Please enter name", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else if (string.IsNullOrEmpty(mDate.text))
        {
            SSTools.ShowMessage("Please enter date", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }

        /*else if (!DateTime.TryParseExact(mDate.text, "dd.MM.yyyy - dd.MM.yyyy", CultureInfo.InvariantCulture,
         *                             DateTimeStyles.None, out dt))
         * {
         *  SSTools.ShowMessage("Please enter in format dd.mm.jjjj - dd.mm.jjjj", SSTools.Position.bottom, SSTools.Time.twoSecond);
         * }*/
        else if (string.IsNullOrEmpty(geld.text))
        {
            SSTools.ShowMessage("Please enter budget", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else if (!int.TryParse(geld.text, out resultInt))
        {
            SSTools.ShowMessage("budget in numbers", SSTools.Position.bottom, SSTools.Time.twoSecond);
        }
        else
        {
            sortedDictionaryPacking = new SortedDictionary <string, bool>();
            sortedDictionaryPacking.Add("Auslandswährung", false);
            sortedDictionaryPacking.Add("Bargeld", false);
            sortedDictionaryPacking.Add("Bauch-/Gürteltasche", false);
            sortedDictionaryPacking.Add("Handtasche", false);
            sortedDictionaryPacking.Add("Rucksack", false);
            sortedDictionaryPacking.Add("EC-Karte", false);
            sortedDictionaryPacking.Add("Geldversteck", false);
            sortedDictionaryPacking.Add("Kreditkarte", false);
            sortedDictionaryPacking.Add("Portmonee", false);

            sortedDictionaryPacking.Add("Apres Lotion", false);
            sortedDictionaryPacking.Add("Haarbürste/Kamm", false);
            sortedDictionaryPacking.Add("Deodorant", false);
            sortedDictionaryPacking.Add("Shampoo", false);
            sortedDictionaryPacking.Add("Haarkur", false);
            sortedDictionaryPacking.Add("Haargummi", false);
            sortedDictionaryPacking.Add("Handcreme", false);
            sortedDictionaryPacking.Add("Kontaktlinsen + Zubehör", false);
            sortedDictionaryPacking.Add("Kulturtasche", false);
            sortedDictionaryPacking.Add("Labello", false);
            sortedDictionaryPacking.Add("Nagelpflegeset", false);
            sortedDictionaryPacking.Add("Wattestäbchen", false);
            sortedDictionaryPacking.Add("Rasierer", false);
            sortedDictionaryPacking.Add("Make-up/Make-up-Entferner", false);
            sortedDictionaryPacking.Add("Sonnencreme", false);
            sortedDictionaryPacking.Add("Damenhygieneartikel (Tampons etc.)", false);
            sortedDictionaryPacking.Add("Taschentücher", false);
            sortedDictionaryPacking.Add("Verhütungsmittel", false);
            sortedDictionaryPacking.Add("Zahnbürste", false);
            sortedDictionaryPacking.Add("Zahnpasta", false);

            sortedDictionaryPacking.Add("Badesachen", false);
            sortedDictionaryPacking.Add("Fleecepullover", false);
            sortedDictionaryPacking.Add("Gürtel", false);
            sortedDictionaryPacking.Add("Hosen/Shorts, kurz", false);
            sortedDictionaryPacking.Add("Hosen/Jeans, lang", false);
            sortedDictionaryPacking.Add("Kleid", false);
            sortedDictionaryPacking.Add("Rock", false);
            sortedDictionaryPacking.Add("Mütze/Cap/Hüte", false);
            sortedDictionaryPacking.Add("Pullover/Sweatshirt", false);
            sortedDictionaryPacking.Add("Regenjacke/Regencape", false);
            sortedDictionaryPacking.Add("Schlafanzug", false);
            sortedDictionaryPacking.Add("Socken", false);
            sortedDictionaryPacking.Add("Schuhe", false);
            sortedDictionaryPacking.Add("Sonnenbrille", false);
            sortedDictionaryPacking.Add("Trekkinghose", false);
            sortedDictionaryPacking.Add("T-Shirts", false);
            sortedDictionaryPacking.Add("Unterwäsche", false);
            sortedDictionaryPacking.Add("Wander-/Funktionssocken", false);

            sortedDictionaryPacking.Add("Medikamente", false);

            sortedDictionaryPacking.Add("ADAC Unterlagen", false);
            sortedDictionaryPacking.Add("Adressliste für Postkarten", false);
            sortedDictionaryPacking.Add("Auslandskrankenversicherung", false);
            sortedDictionaryPacking.Add("Führerschein", false);
            sortedDictionaryPacking.Add("Hotel-/Hostelunterlagen", false);
            sortedDictionaryPacking.Add("Impfpass", false);
            sortedDictionaryPacking.Add("Karte", false);
            sortedDictionaryPacking.Add("Krankenversichertenkarte", false);
            sortedDictionaryPacking.Add("Mietwagenunterlagen", false);
            sortedDictionaryPacking.Add("Personalausweis", false);
            sortedDictionaryPacking.Add("Reiseführer", false);
            sortedDictionaryPacking.Add("Reisepass", false);
            sortedDictionaryPacking.Add("Reisetagebuch", false);
            sortedDictionaryPacking.Add("Studentenausweis", false);
            sortedDictionaryPacking.Add("Tauchnachweis/Segelschein/etc.", false);
            sortedDictionaryPacking.Add("Visum", false);
            sortedDictionaryPacking.Add("Wegbeschreibung", false);
            sortedDictionaryPacking.Add("Zugticket/Bahncard/Flugticket", false);

            sortedDictionaryPacking.Add("aufblasbares Kopfkissen", false);
            sortedDictionaryPacking.Add("Brille + Etui", false);
            sortedDictionaryPacking.Add("Buch/Zeitschrift", false);
            sortedDictionaryPacking.Add("Kofferanhänger", false);
            sortedDictionaryPacking.Add("Luftpumpe", false);
            sortedDictionaryPacking.Add("Ohrstöpsel", false);
            sortedDictionaryPacking.Add("Regenschirm", false);
            sortedDictionaryPacking.Add("Reisehandtücher", false);
            sortedDictionaryPacking.Add("Schreibzeug", false);
            sortedDictionaryPacking.Add("Spiele", false);
            sortedDictionaryPacking.Add("Taschenlampe", false);

            sortedDictionaryPacking.Add("Liege", false);
            sortedDictionaryPacking.Add("Schnorchelausrüstung", false);
            sortedDictionaryPacking.Add("Sonnenschirm", false);
            sortedDictionaryPacking.Add("Strandmuschel", false);
            sortedDictionaryPacking.Add("Strandtuch", false);
            sortedDictionaryPacking.Add("Windschutz", false);

            sortedDictionaryPacking.Add("Kamera", false);
            sortedDictionaryPacking.Add("eBook-Reader", false);
            sortedDictionaryPacking.Add("Handy + Ladekabel", false);
            sortedDictionaryPacking.Add("wasserdichte Handyhülle", false);
            sortedDictionaryPacking.Add("Kopfhörer", false);
            sortedDictionaryPacking.Add("Ladegeräte", false);
            sortedDictionaryPacking.Add("Powerbank", false);
            sortedDictionaryPacking.Add("Speicherkarten", false);
            sortedDictionaryPacking.Add("Selfie-Stick", false);
            sortedDictionaryPacking.Add("Steckdosenadapter", false);
            sortedDictionaryPacking.Add("Boxen", false);


            packingList = new PackingList(sortedDictionaryPacking);



            sortedDictionaryBudget = new SortedDictionary <string, int>();
            budget   = new Budget(int.Parse(geld.text), sortedDictionaryBudget);
            airplane = new List <Airplane>();
            train    = new List <Train>();
            bus      = new List <Bus>();

            path = PlayerPrefs.GetString("path");

            journey = new Journey(MName.text, mDate.text, path, packingList, budget, airplane, train, bus);
            var result = new ItemModel();
            result.date = mDate.text;
            result.name = MName.text;
            //result.name = journey.GetName();
            OnReceiveNewModel(result);
            SaveToJSON save = new SaveToJSON();
            journeys.Add(journey);
            save.SaveJourney(journeys);
        }
    }