コード例 #1
0
        private async void MaterialsClicked(object sender, EventArgs e)
        {
            //Get Materials
            string key      = $"/api/api/5?id=id$~{Maincnx.ID}~cmd$~getmaterialsettings";
            var    response = await Client.GET(Maincnx.Token, key);

            if (response == "errorerrorerror")
            {
                await DisplayAlert("Error", "There has been an error contacting our server, please try again.\n\nIf this keeps happening please restart the app.", "Ok");

                return;
            }

            SettingsObject[]      receivedMatSettings = SettingsObject.FromJson(response);
            List <SettingsObject> MatSettings         = new List <SettingsObject>();

            foreach (SettingsObject setting in receivedMatSettings)
            {
                MatSettings.Add(setting);
            }

            await Navigation.PushAsync(new Settings(Maincnx, MatSettings, "Material Settings"));


            //Go to materials page as a navigation page with list.
        }
コード例 #2
0
 public SettingSpecific(SettingsObject setting, Connection cnx, string type)
 {
     InitializeComponent();
     _type    = type;
     _setting = setting;
     Maincnx  = cnx;
     Start();
 }
コード例 #3
0
        private async Task gotoSpecificPage(SettingsObject settings)
        {
            SettingSpecific settingSpecific = new SettingSpecific(settings, Maincnx, Header);
            await Navigation.PushAsync(settingSpecific);

            MessagingCenter.Subscribe <SettingSpecific, SettingsObject>(settingSpecific, "send", (sender, arg) =>
            {
                for (int i = 0; i < UpdatedSettings.Count; i++)
                {
                    //check the last key to check it covers it.
                    if (UpdatedSettings[i].key == arg.key)
                    {
                        UpdatedSettings[i] = arg;
                    }
                }
            });
        }
コード例 #4
0
        public async void PostSetting(Connection maincnx, SettingsObject setting)
        {
            List <SettingsObject> OGSettingList = new List <SettingsObject>();

            OGSettingList.Add(setting);

            SettingsCapsule outgoing = new SettingsCapsule();
            OutgoingCommand command  = new OutgoingCommand();

            outgoing.settings = OGSettingList.ToArray();
            outgoing.user     = Maincnx.TokenInfoJsonProps;

            string key = "";

            if (_type == "Estimating Settings")
            {
                //REMEMBER WE NEED TO IMPLEMENT MD format;
                key             = $"/api/api/5?id=id$~{Maincnx.ID}~cmd$~putestimatingsettings";
                command.command = "postsettings";
            }
            else if (_type == "Material Settings")
            {
                key             = $"/api/api/5?id=id$~{Maincnx.ID}~cmd$~putmaterialsettings";
                command.command = "postmaterials";
            }
            else
            {
                await DisplayAlert("Error", "There has been an error communticating with our server\n\n" +
                                   "Please call us and state:\n\n" +
                                   "\"Error Code: SS####\"", "Ok");

                return;
            }

            outgoing.cmd = command;

            var outgoingJson = JsonConvert.SerializeObject(outgoing, Formatting.None, new JsonSerializerSettings()
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });
            var response = await Client.Post(Maincnx.Token, key, outgoingJson);

            var x = response;

            MessagingCenter.Send <SettingSpecific, SettingsObject>(this, "send", _setting);
        }
コード例 #5
0
        private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            SettingsObject settings = e.SelectedItem as SettingsObject;

            await gotoSpecificPage(settings);
        }