예제 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetContentView (Resource.Layout.welcome);

            prefs = GetPreferences (FileCreationMode.Append);
            firstTime = prefs.GetBoolean (FIRST, true);
            if (firstTime) {
                MakeQuestionDB ();
                MakeScoreDB ();
                editor = prefs.Edit ();
                editor.PutBoolean (FIRST, false);
                editor.Commit ();

            }

            Button button = FindViewById<Button> (Resource.Id.btnStarQuiz);
            button.Click += delegate {
                StartActivity (typeof(QuizActivity));
                Finish ();
            };
        }
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            OnImagePicked += (sender, image) =>
            {
                if (image == null)
                {
                    return;
                }

                ISharedPreferences preference = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext);
                String             appVersion = PackageManager.GetPackageInfo(PackageName, Android.Content.PM.PackageInfoFlags.Activities).VersionName;
                if (!preference.Contains("tesseract-data-version") || !preference.GetString("tesseract-data-version", null).Equals(appVersion) ||
                    !preference.Contains("tesseract-data-path"))
                {
                    AndroidFileAsset.OverwriteMethod overwriteMethod = AndroidFileAsset.OverwriteMethod.AlwaysOverwrite;

                    FileInfo a8 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.traineddata", "tmp", overwriteMethod);
                    FileInfo a0 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.bigrams", "tmp", overwriteMethod);
                    FileInfo a1 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.fold", "tmp", overwriteMethod);
                    FileInfo a2 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.lm", "tmp", overwriteMethod);
                    FileInfo a3 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.nn", "tmp", overwriteMethod);
                    FileInfo a4 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.params", "tmp", overwriteMethod);
                    FileInfo a5 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.size", "tmp", overwriteMethod);
                    FileInfo a6 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.cube.word-freq", "tmp", overwriteMethod);
                    FileInfo a7 = AndroidFileAsset.WritePermanantFileAsset(this, "tessdata/eng.tesseract_cube.nn", "tmp", overwriteMethod);

                    //save tesseract data path
                    ISharedPreferencesEditor editor = preference.Edit();
                    editor.PutString("tesseract-data-version", appVersion);
                    editor.PutString("tesseract-data-path", System.IO.Path.Combine(a0.DirectoryName, "..") + System.IO.Path.DirectorySeparatorChar);
                    editor.Commit();
                }

                LicensePlateDetector detector = new LicensePlateDetector(preference.GetString("tesseract-data-path", null));
                Stopwatch            watch    = Stopwatch.StartNew(); // time the detection process

                List <IInputOutputArray> licensePlateImagesList         = new List <IInputOutputArray>();
                List <IInputOutputArray> filteredLicensePlateImagesList = new List <IInputOutputArray>();
                List <RotatedRect>       licenseBoxList = new List <RotatedRect>();
                List <string>            words          = detector.DetectLicensePlate(
                    image,
                    licensePlateImagesList,
                    filteredLicensePlateImagesList,
                    licenseBoxList);

                watch.Stop(); //stop the timer

                StringBuilder builder = new StringBuilder();
                builder.Append(String.Format("{0} milli-seconds. ", watch.Elapsed.TotalMilliseconds));
                foreach (String w in words)
                {
                    builder.AppendFormat("{0} ", w);
                }
                SetMessage(builder.ToString());

                foreach (RotatedRect box in licenseBoxList)
                {
                    Rectangle rect = box.MinAreaRect();
                    image.Draw(rect, new Bgr(System.Drawing.Color.Red), 2);
                }

                SetImageBitmap(image.ToBitmap());
                image.Dispose();
            };


            OnButtonClick += delegate
            {
                PickImage("license-plate.jpg");
            };
        }
        public void OnServiceConnected(ComponentName name, IBinder service)
        {
            var ServiceBinder = service as RequestBinder;

            if (ServiceBinder != null)
            {
                activity.binder  = ServiceBinder;
                activity.isBound = true;
            }

            activity.BDD.DBConnection();

            ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(activity);

            if (!prefs.GetBoolean("Install", false))
            {
                activity.BDD.CreateTable();

                // mark first time has runned.
                ISharedPreferencesEditor editor = prefs.Edit();
                editor.PutBoolean("Install", true);
                editor.Commit();
            }

            if (activity.CheckInternet())
            {
                DateTime OldDate    = activity.BDD.GetOldest();
                TimeSpan difference = (DateTime.Now - OldDate);

                if ((DateTime.Now - OldDate) == (DateTime.Now - new DateTime()) || (difference.Days > 0 || (difference.Hours >= 3 && difference.Minutes > 0)))
                {
                    APICall Rservice = activity.binder.GetService();


                    string json = Rservice.GetJson();

                    if (json == null)
                    {
                        activity.StartActivity(new Intent(activity, typeof(NoData)));
                    }
                    else
                    {
                        List <WeatherApp.JSON.Weather> temp = JSON.Parsing.JsonToWeather(json);

                        activity.BDD.ClearTable();

                        activity.BDD.InsertList(temp);

                        activity.StartActivity(new Intent(activity, typeof(CreateListView)));
                    }
                }
                else
                {
                    activity.StartActivity(new Intent(activity, typeof(CreateListView)));
                }
            }
            else
            {
                activity.StartActivity(new Intent(activity, typeof(CreateListView)));
            }

            activity.BDD.BDDConnection.Close();
        }
예제 #4
0
 public void saveAccessKey(string key)
 {
     mPrefsEditor.PutString(LEGION_PREFERENCES, key);
     mPrefsEditor.Commit();
 }
예제 #5
0
        private async void OnShuffleButtonClick(string playlistId, ShuffleMode shuffleMode, View popup)
        {
            if (_state.Value != State.Waiting && _state.Value != State.Failed)
            {
                return;
            }

            _state.Value = State.LoadingTracks;

            Task <Exception> task = Task <Exception> .Factory.StartNew(() =>
            {
                try
                {
                    // get playlist
                    FullPlaylist playlist =
                        _api.GetPlaylist(playlistId, fields: "id,name,tracks.items(track.uri),tracks.total");

                    if (playlist.Tracks == null)
                    {
                        return(new Exception("Failed to get playlist"));
                    }

                    // get tracks
                    IList <FullTrack> tracks = Enumerable.Range(0, (int)Math.Ceiling(playlist.Tracks.Total / 100F))
                                               .Select(i =>
                                                       _api.GetPlaylistTracks(playlist.Id, fields: "items.track(uri,artists.name)",
                                                                              offset: i * 100))
                                               .SelectMany(group => group.Items.Select(playlistTrack => playlistTrack.Track))
                                               .ToList();

                    if (tracks.Count != playlist.Tracks.Total)
                    {
                        return(new Exception("Failed to get all tracks in playlist"));
                    }

                    // randomize track order
                    if (shuffleMode == ShuffleMode.Shuffle)
                    {
                        tracks.Shuffle();
                    }
                    else if (shuffleMode == ShuffleMode.Restrict)
                    {
                        // get value
                        EditText value = popup.FindViewById <EditText>(Resource.Id.restrict_value);
                        bool res       = int.TryParse(value.Text, out int artistLimit);

                        // check value is valid
                        if (!res || artistLimit < 1)
                        {
                            throw new Exception("Restrict value is not a positive integer");
                        }

                        // save value
                        ISharedPreferencesEditor editor = GetSharedPreferences("SPOTIFY", 0).Edit();
                        editor.PutString("RESTRICT_VALUE", artistLimit.ToString());
                        editor.Commit();

                        tracks = tracks
                                 .GroupBy(track => track.Artists[0].Name)
                                 .SelectMany(artist => artist.ToList().Shuffle().Take(artistLimit))
                                 .ToList()
                                 .Shuffle();
                    }

                    // add tracks
                    string id = _api.GetPrivateProfile().Id;

                    // delete old playlists
                    foreach (SimplePlaylist p in _playlists.Where(p => p.Name == playlist.Name + " " + shuffleMode)
                             .ToList())
                    {
                        ErrorResponse error = _api.UnfollowPlaylist(id, p.Id);
                        if (error.HasError())
                        {
                            return(new Exception("Failed to delete old playlist"));
                        }
                        _playlists.Remove(p);
                    }

                    // create new playlist
                    _state.Value             = State.AddingTracks;
                    FullPlaylist newPlaylist = _api.CreatePlaylist(id, playlist.Name + " " + shuffleMode, false);
                    if (newPlaylist.Id == null)
                    {
                        return(new Exception("Failed to create new playlist"));
                    }


                    _playlists.Add(new SimplePlaylist {
                        Id = newPlaylist.Id, Name = newPlaylist.Name
                    });

                    // add tracks
                    List <ErrorResponse> addResult = Enumerable.Range(0, (int)Math.Ceiling(tracks.Count / 100F)).Select(
                        i =>
                        _api.AddPlaylistTracks(newPlaylist.Id,
                                               tracks.Skip(i * 100).Take(100).Select(track => track.Uri).ToList()))
                                                     .ToList();

                    if (addResult.Any(error => error.HasError()))
                    {
                        return(new Exception("Failed to add all tracks to playlist"));
                    }

                    return(null);
                }
                catch (Exception)
                {
                    return(new Exception("Unknown error has occured"));
                }
            });

            await task.ContinueWith(errorTask =>
            {
                if (errorTask.Result == null)
                {
                    Log.Debug("ShuffleResult", "Shuffle succeeded");

                    _state.Value = State.Waiting;
                }
                else
                {
                    Log.Debug("ShuffleResult", $"Shuffle failed: {errorTask.Result}");
                    _lastError = errorTask.Result.Message;

                    _state.Value = State.Failed;
                }
            });
        }
예제 #6
0
 void Stations_Downloaded(object sender, DownloadStringCompletedEventArgs e)
 {
     SaveStations (e.Result);
     editor = prefs.Edit ();
     editor.PutBoolean (FIRST, false);
     editor.Commit ();
 }
예제 #7
0
        public FormSwitch(Context context, ReportElement element, int userID, int ownerID, int verifiedID, String type, ReportStatus Reportstatus, string sectionType, ImageLoader imgLoader)
            : base(context)
        {
            resource                = context.Resources;
            contextx                = context;
            OwnerID                 = ownerID;
            UserID                  = userID;
            VerifierID              = verifiedID;
            formType                = type;
            section                 = sectionType;
            theme                   = new FormTheme(context, element.Title);
            Orientation             = Orientation.Vertical;
            sharedPreferences       = PreferenceManager.GetDefaultSharedPreferences(context);
            sharedPreferencesEditor = sharedPreferences.Edit();
            Popup                   = new InformationPopup(context);
            reportStatus            = Reportstatus;
            imageLoader             = imgLoader;

            isArcheived = sharedPreferences.GetBoolean(Resources.GetString(Resource.String.is_archived), false);

            Switch swch = new Switch(context);

            RelativeLayout.LayoutParams paramsOfSwitch = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.WrapContent);
            paramsOfSwitch.AddRule(LayoutRules.AlignParentLeft);
            swch.LayoutParameters = paramsOfSwitch;

            swch.SetPadding(0, 30, 30, 30);
            swch.Id = element.Id;
            swch.SetTextColor(Color.White);

            switchState = element.Value;
            ImageView indicatorImage = (ImageView)theme.GetChildAt(1);

            //activateElementInfo(element);
            Popup.activateElementInfo(theme, element);

            if (switchState == "")
            {
                swch.Text = "1";
            }

            else if (switchState == "false")
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                swch.Checked = false;
                swch.Text    = "";
            }
            else if (switchState == "true")
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                swch.Checked = true;
                swch.Text    = "";
            }

            swch.CheckedChange += (sender, e) =>
            {
                swch.Text = "";
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);

                //if (element.Options != null && element.Options.FirstOrDefault(a => a.Code == "conditional").Value == "true")
                //{
                //    if (swch.Checked)
                //    {
                //        switchState = "true";
                //        element.Value = "true";

                //        if (ChildCount > 2)
                //        {
                //            RemoveViews(2, element.Rejected[0].Count);
                //        }

                //        for (int j = 0; j < element.Accepted[0].Count; j++)
                //        {
                //            AddView(getView(element.Accepted[0][j], element.Accepted[0]));
                //        }
                //    }
                //    else
                //    {
                //        switchState = "false";
                //        element.Value = "false";
                //        if (ChildCount > 2)
                //        {
                //            RemoveViews(2, element.Accepted[0].Count);
                //        }

                //        for (int k = 0; k < element.Rejected[0].Count; k++)
                //        {
                //            AddView(getView(element.Rejected[0][k], element.Rejected[0]));
                //        }
                //    }
                //}

                sharedPreferencesEditor.PutBoolean("ReportEditFlag", true);
                sharedPreferencesEditor.Commit();
            };

            //when opening a Draft or Archive
            if (swch.Checked)
            {
                indicatorImage.SetImageResource(Resource.Drawable.checked_forms_create_project_medium);
                switchState = "true";
            }

            if (OwnerID == 0 || OwnerID == userID)
            {
                if (VerifierID != 0)
                {
                    swch.Enabled = false;

                    if (reportStatus == ReportStatus.Rejected)
                    {
                        swch.Enabled = true;
                    }
                }

                else
                {
                    swch.Enabled = true;
                }
            }
            else
            {
                swch.Enabled = false;
            }

            TextView elementSplitLine = new TextView(context);

            elementSplitLine.TextSize = 0.5f;
            elementSplitLine.SetBackgroundColor(Color.ParseColor(resource.GetString(Resource.Color.grey)));

            if (isArcheived)
            {
                swch.Enabled = false;
            }

            AddView(theme);
            AddView(swch);
            SetPadding(55, 10, 45, 20);

            //if (element.Options != null)
            //{
            //    var conditionalCode = element.Options.FirstOrDefault(a => a.Code == "conditional");
            //    if (conditionalCode == null || !Convert.ToBoolean(conditionalCode.Value)) return;
            //    if (switchState.Equals("true"))
            //    {
            //        for (int i = 0; i < element.Accepted[0].Count; i++)
            //        {
            //            AddView(getView(element.Accepted[0][i], element.Accepted[0]));
            //        }
            //    }
            //    else
            //    {
            //        for (int i = 0; i < element.Rejected[0].Count; i++)
            //        {
            //            AddView(getView(element.Rejected[0][i], element.Rejected[0]));
            //        }

            //    }
            //}
        }
예제 #8
0
 public bool PutSaveLoginIdCheck(bool save_loginid_check)
 {
     appPrefsEditor.PutBoolean(this.SAVE_LOGINID_CHECK, save_loginid_check);
     return(appPrefsEditor.Commit());
 }
예제 #9
0
        private async Task <tblUserProfile> getUserProfile()
        {
            long id = session.GetLong("userid", -1);

            if (session.GetLong("userid", -1) > 0)
            {
                _client.ReadRecord_UserProfileAsync(session.GetLong("userid", -1));
                //Figure out a better way to wait and break out
                while (msg == null || msg != "Read UserProfile Successful!")
                {
                    await delayTask();

                    if (msg != null && msg != "Read UserProfile Successful!")
                    {
                        break;  //Error
                    }
                }

                if (msg == "Read UserProfile Successful!")
                {
                    ISharedPreferencesEditor session_editor = session.Edit();
                    session_editor.PutString("UserProfile", JsonConvert.SerializeObject(userProfile));
                    session_editor.Commit();
                    return(userProfile);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                if (Intent.Extras.ContainsKey("UserInfo"))
                {
                    var         resultData = Intent.GetStringExtra("UserInfo");
                    tblUserInfo userInfo   = JsonConvert.DeserializeObject <tblUserInfo>(resultData);
                    _client.ReadRecord_UserProfileAsync(userInfo.UserID);
                    //Figure out a better way to wait and break out
                    while (msg == null || msg != "Read UserProfile Successful!")
                    {
                        await delayTask();

                        if (msg != null && msg != "Read UserProfile Successful!")
                        {
                            break;  //Error
                        }
                    }
                    if (msg == "Read UserProfile Successful!")
                    {
                        ISharedPreferencesEditor session_editor = session.Edit();
                        session_editor.PutString("UserProfile", JsonConvert.SerializeObject(userProfile));
                        session_editor.Commit();
                        return(userProfile);
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
        }
예제 #10
0
 public void saveValue(string key, string value)//save data value
 {
     namePrefEditor.PutString(key, value);
     namePrefEditor.Commit();
 }
        async Task ParseAndDisplay(JsonValue json, String login_Id)
        {
            if (json.Count > 0)
            {
                for (int i = 0; i < json.Count; i++)
                {
                    try
                    {
                        detail = new LoginModel
                        {
                            OrganizationId    = json[i]["OrganizationId"],
                            Organization      = json[i]["Organization"],
                            OfficeId          = json[i]["OfficeId"],
                            OfficeName        = json[i]["OfficeName"],
                            NaturalPersonId   = json[i]["NaturalPersonId"],
                            UserName          = json[i]["UserName"],
                            NpToOrgRelationID = json[i]["NpToOrgRelationID"],
                            DesignationId     = json[i]["DesignationId"],
                            Designation       = json[i]["Designation"],
                            MobileNumber      = json[i]["MobileNumber"],
                            Message           = json[i]["Message"],
                            ProjectArea       = json[i]["ProjectArea"],
                            Controller        = json[i]["Controller"],
                            ControllerAction  = json[i]["ControllerAction"],
                            IsActive          = json[i]["IsActive"].ToString(),
                            EmailAddress      = json[i]["EmailAddress"]
                        };
                        //User_List.Add(detail);
                    }
                    catch (Exception e) { Log.Error("Error", e.Message); }
                }

                ISharedPreferencesEditor editor = prefs.Edit();
                editor.PutString("OrganizationId", detail.OrganizationId);
                editor.PutString("Organization", detail.Organization);
                editor.PutString("OfficeId", detail.OfficeId);
                editor.PutString("OfficeName", detail.OfficeName);
                editor.PutString("NaturalPersonId", detail.NaturalPersonId);
                editor.PutString("UserName", detail.UserName);
                editor.PutString("NpToOrgRelationID", detail.NpToOrgRelationID);
                editor.PutString("DesignationId", detail.DesignationId);
                editor.PutString("Designation", detail.Designation);
                editor.PutString("MobileNumber", detail.MobileNumber);
                editor.PutString("EmailAddress", detail.EmailAddress);

                editor.Apply();

                geolocation = geo.GetGeoLocation(ApplicationContext);

                if (detail.UserName != null && detail.UserName != "")
                {
                    try
                    {
                        string isRegistered = await restService.RegisterUser(licenceid, detail.MobileNumber, detail.UserName, geolocation,
                                                                             detail.NaturalPersonId, detail.DesignationId).ConfigureAwait(false);

                        progress.Dismiss();

                        if (isRegistered.Contains("Success"))
                        {
                            editor.PutBoolean("IsRegistered", true);
                            editor.Commit();

                            Intent intent = new Intent(this, typeof(MainActivity));
                            intent.AddFlags(ActivityFlags.NewTask);
                            StartActivity(intent);
                            Finish();
                        }
                        else
                        {
                            progress.Dismiss();
                            Toast.MakeText(ApplicationContext, "Try after some time", ToastLength.Short).Show();
                        }
                    }
                    catch (Exception ex)
                    {
                        progress.Dismiss();
                        Toast.MakeText(ApplicationContext, "Try after some time", ToastLength.Short).Show();
                    }
                }
                else
                {
                    progress.Dismiss();
                    Toast.MakeText(ApplicationContext, "Invalid User name or Password", ToastLength.Short).Show();
                }
            }
            else
            {
                progress.Dismiss();
                Toast.MakeText(ApplicationContext, "Invalid User name or Password", ToastLength.Short).Show();
            }
        }
예제 #12
0
        private async void OpenFileIn(TreeNode clickedItem)
        {
            try {
                if (popupWindow != null)
                {
                    popupWindow.Dismiss();
                }



                string mimeTypeOfClickedItem = MimeTypeHelper.GetMimeType(clickedItem.Path);
                clickedItem.Type = mimeTypeOfClickedItem;

                if (clickedItem.Type.Equals("application/pdf"))
                {
                    Intent intent = new Intent(Intent.ActionView);

                    new Thread(new ThreadStart(async delegate {
                        //Show progress dialog while loading
                        parentActivity.HideProgressDialog();
                        parentActivity.ShowProgressDialog(null);
                        string fullFilePath = await DataLayer.Instance.GetFilePath(clickedItem.Path);

                        //Controleer internet verbinding
                        var connectivityManager = (ConnectivityManager)Android.App.Application.Context.GetSystemService(Context.ConnectivityService);
                        var activeConnection    = connectivityManager.ActiveNetworkInfo;

                        if ((activeConnection != null) && activeConnection.IsConnected)                                 //Internet verbinding gedetecteerd

                        //Create temp file
                        {
                            string temporaryFilePath = System.IO.Path.Combine("/storage/emulated/0/Download", clickedItem.Name);

                            if (File.Exists(temporaryFilePath))
                            {
                                File.Delete(temporaryFilePath);
                            }

                            //Save settings of last opened file
                            ISharedPreferences prefs        = PreferenceManager.GetDefaultSharedPreferences(Activity);
                            ISharedPreferencesEditor editor = prefs.Edit();
                            editor.PutString("fileNameLastOpenedPdf", clickedItem.Name);
                            editor.PutString("pathLastOpenedPdf", clickedItem.Path);
                            editor.PutString("temporaryFilePath", temporaryFilePath);
                            editor.PutBoolean("isFavorite", clickedItem.IsFavorite);
                            editor.Commit();

                            //Save temporary file in filesystem
                            Byte[] fileBytes = File.ReadAllBytes(fullFilePath);

                            File.WriteAllBytes(temporaryFilePath, fileBytes);

                            Android.Net.Uri uri = Android.Net.Uri.Parse("file://" + temporaryFilePath);
                            intent.SetDataAndType(uri, clickedItem.Type);

                            parentActivity.HideProgressDialog();
                            if (File.Exists(temporaryFilePath))
                            {
                                Activity.StartActivity(intent);
                            }
                            else
                            {
                                Toast.MakeText(Android.App.Application.Context, "Openen bestand mislukt", ToastLength.Long).Show();
                            }
                        }
                        else
                        {
                            //Geen internet verbinding
                            var alertDialogConfirmDelete = new Android.App.AlertDialog.Builder(Activity);
                            alertDialogConfirmDelete.SetTitle("Geen verbinding");
                            alertDialogConfirmDelete.SetMessage("U heeft momenteel geen internet verbinding. Het maken van PDF annotaties is daarom niet mogelijk.");

                            alertDialogConfirmDelete.SetPositiveButton("OK", async delegate {
                                Android.Net.Uri uri = Android.Net.Uri.Parse("file://" + fullFilePath);
                                intent.SetDataAndType(uri, clickedItem.Type);

                                parentActivity.HideProgressDialog();
                                Activity.StartActivity(intent);
                            });
                            alertDialogConfirmDelete.Create().Show();
                        }
                    })).Start();
                }
                else                    //Ander bestandstype dan PDF openen


                //Show progress dialog while loading
                {
                    parentActivity.HideProgressDialog();
                    parentActivity.ShowProgressDialog(null);
                    string fullFilePath = await DataLayer.Instance.GetFilePath(clickedItem.Path);


                    Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(CustomContentProvider.CONTENT_URI + fullFilePath));
                    intent.SetFlags(ActivityFlags.GrantReadUriPermission);
                    intent.SetFlags(ActivityFlags.NewTask);
                    intent.SetFlags(ActivityFlags.ClearWhenTaskReset);
                    Activity.StartActivity(intent);
                }
            } catch (Exception ex) {
                Insights.Report(ex);
                Console.WriteLine(ex.Message);

                parentActivity.HideProgressDialog();

                if (ex is ActivityNotFoundException)
                {
                    Toast.MakeText(Android.App.Application.Context, "Geen app op uw apparaat gevonden om dit bestandstype te kunnen openen", ToastLength.Long).Show();
                }
                else
                {
                    Toast.MakeText(Android.App.Application.Context, "Openen bestand mislukt", ToastLength.Long).Show();
                }
            }
        }
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            btnConnect        = FindViewById <Button>(Resource.Id.btnConnect);
            btnConnect.Click += async(sender, e) =>
            {
                string url    = txtAPIAddress.Text + "/sshconnect/connect";
                string result = await InitiateWebRequest(url);

                SetItemsVisibility(result);
            };

            spinnerKillProcess = FindViewById <Spinner>(Resource.Id.spinnerKillProcess);

            btnKillProcess        = FindViewById <Button>(Resource.Id.btnKillProcess);
            btnKillProcess.Click += async(sender, e) =>
            {
                var    selectedItem = spinnerKillProcess.SelectedItem.ToString();
                string url          = txtAPIAddress.Text + "/sshconnect/killprocess/" + selectedItem;
                string result       = await InitiateWebRequest(url);
            };

            btnRestart        = FindViewById <Button>(Resource.Id.btnRestart);
            btnRestart.Click += async(sender, e) =>
            {
                string url    = txtAPIAddress.Text + "/sshconnect/restart";
                string result = await InitiateWebRequest(url);

                SetItemsVisibility(result);
            };

            btnShutdown        = FindViewById <Button>(Resource.Id.btnShutdown);
            btnShutdown.Click += async(sender, e) =>
            {
                string url    = txtAPIAddress.Text + "/sshconnect/shutdown";
                string result = await InitiateWebRequest(url);

                SetItemsVisibility(result);
            };

            preferences = PreferenceManager.GetDefaultSharedPreferences(Application.Context);

            layoutSave     = FindViewById <LinearLayout>(Resource.Id.layoutSave);
            txtUsername    = FindViewById <EditText>(Resource.Id.txtUsername);
            txtPassword    = FindViewById <EditText>(Resource.Id.txtPassword);
            txtAPIAddress  = FindViewById <EditText>(Resource.Id.txtAPIAddress);
            btnSave        = FindViewById <Button>(Resource.Id.btnSave);
            btnSave.Click += delegate
            {
                // Save to preferences
                ISharedPreferencesEditor editor = preferences.Edit();
                editor.PutString("txtUsername", txtUsername.Text);
                editor.PutString("txtPassword", txtPassword.Text);
                editor.PutString("txtAPIAddress", txtAPIAddress.Text);
                editor.Commit();
            };

            txtUsername.Text   = preferences.GetString("txtUsername", "");
            txtPassword.Text   = preferences.GetString("txtPassword", "");
            txtAPIAddress.Text = preferences.GetString("txtAPIAddress", "");

            SetDefaultItemsVisibility();

            var listResult = await InitiateWebRequest(txtAPIAddress.Text + "/sshconnect/killprocesslist");

            string[] killProcessList = listResult.Split(',');
            for (int i = 0; i < killProcessList.Count(); i++)
            {
                killProcessList[i] = killProcessList[i].Trim('[', ']', '\\', '"');
            }
            var adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, killProcessList);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerKillProcess.Adapter = adapter;

            string isConnectedResult = await InitiateWebRequest(txtAPIAddress.Text + "/sshconnect/isconnected");

            SetItemsVisibility(isConnectedResult);
        }
예제 #14
0
 public void SaveAccessKey(string vaule)
 {
     mPrefsEditor.PutString(PREFERENCE_ACCESS_KEY, vaule);
     mPrefsEditor.Commit();
 }
예제 #15
0
        public void ProvjeriIzdavanjePotvrde()
        {
            int radniNalogLokacijaId   = localKomitentLokacija.GetInt("radniNalogLokacijaId", 0);
            List <DID_Potvrda> potvrda = db.Query <DID_Potvrda>(
                "SELECT * " +
                "FROM DID_Potvrda " +
                "WHERE RadniNalogLokacijaId = ?", radniNalogLokacijaId);

            if (potvrda.Any())
            {
                izradaPotvrde.Visibility = Android.Views.ViewStates.Visible;
                potvrdaBtn.Text          = "Prikaži potvrdu";

                string infestacija = db.Query <DID_RazinaInfestacije>(
                    "SELECT * " +
                    "FROM DID_RazinaInfestacije " +
                    "WHERE Sifra = ?", potvrda.FirstOrDefault().Infestacija).FirstOrDefault().Naziv;

                //Potvrda str.1
                localPotvrdaEdit.PutBoolean("potvrdaPage1", true);
                localPotvrdaEdit.PutString("godina", potvrda.FirstOrDefault().Godina);
                localPotvrdaEdit.PutString("datumPotvrde", potvrda.FirstOrDefault().DatumVrijeme.ToString());
                localPotvrdaEdit.PutString("opisRadaInput", potvrda.FirstOrDefault().OpisRada);
                localPotvrdaEdit.PutString("potvrdaBrInput", potvrda.FirstOrDefault().Broj.ToString());
                localPotvrdaEdit.PutString("razinaInfestacije", infestacija);

                //Potvrda str.2
                List <DID_Potvrda_Djelatnost> djelatnostDeratizacija = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 1);

                if (djelatnostDeratizacija.Any())
                {
                    localPotvrdaEdit.PutBoolean("deratizacijaBtn", true);
                    foreach (var posao in djelatnostDeratizacija)
                    {
                        if (posao.TipPosla == "1")
                        {
                            localPotvrdaEdit.PutBoolean("postavljanjeMaterijala", true);
                        }
                        else if (posao.TipPosla == "2")
                        {
                            localPotvrdaEdit.PutBoolean("kontrola", true);
                        }
                    }
                }
                else
                {
                    localPotvrdaEdit.PutBoolean("deratizacijaBtn", false);
                    localPotvrdaEdit.PutBoolean("postavljanjeMaterijala", false);
                    localPotvrdaEdit.PutBoolean("kontrola", false);
                }

                List <DID_Potvrda_Djelatnost> djelatnostDezinsekcija = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 2);

                if (djelatnostDezinsekcija.Any())
                {
                    localPotvrdaEdit.PutBoolean("dezinsekcijaBtn", true);
                    foreach (var posao in djelatnostDezinsekcija)
                    {
                        if (posao.TipPosla == "3")
                        {
                            localPotvrdaEdit.PutBoolean("postavljanjeLovki", true);
                        }
                    }
                }
                else
                {
                    localPotvrdaEdit.PutBoolean("dezinsekcijaBtn", false);
                    localPotvrdaEdit.PutBoolean("postavljanjeLovki", false);
                }

                List <DID_Potvrda_Djelatnost> djelatnostDezinfekcija = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 3);

                if (djelatnostDezinfekcija.Any())
                {
                    localPotvrdaEdit.PutBoolean("dezinfekcijaBtn", true);
                    foreach (var posao in djelatnostDezinfekcija)
                    {
                        if (posao.TipPosla == "4")
                        {
                            localPotvrdaEdit.PutBoolean("tretman", true);
                        }
                    }
                }
                else
                {
                    localPotvrdaEdit.PutBoolean("dezinfekcijaBtn", false);
                    localPotvrdaEdit.PutBoolean("tretman", false);
                }

                List <DID_Potvrda_Djelatnost> djelatnostZasistaBilja = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 5);

                if (djelatnostZasistaBilja.Any())
                {
                    localPotvrdaEdit.PutBoolean("zastitaBiljaBtn", true);
                    foreach (var posao in djelatnostZasistaBilja)
                    {
                        if (posao.TipPosla == "6")
                        {
                            localPotvrdaEdit.PutBoolean("tretman2", true);
                        }
                    }
                }
                else
                {
                    localPotvrdaEdit.PutBoolean("zastitaBiljaBtn", false);
                    localPotvrdaEdit.PutBoolean("tretman2", false);
                }

                List <DID_Potvrda_Djelatnost> djelatnostDezodorizacija = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 4);

                List <DID_Potvrda_Djelatnost> djelatnostSuzbijanjeStetnika = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 6);

                List <DID_Potvrda_Djelatnost> djelatnostKIInsekti = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 7);

                List <DID_Potvrda_Djelatnost> djelatnostKIGlodavci = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 8);

                List <DID_Potvrda_Djelatnost> djelatnostuzimanjeBriseva = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 9);

                List <DID_Potvrda_Djelatnost> djelatnostsuzbijanjeKorova = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 10);

                List <DID_Potvrda_Djelatnost> djelatnostkosnjaTrave = db.Query <DID_Potvrda_Djelatnost>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Djelatnost " +
                    "WHERE Potvrda = ? " +
                    "AND Djelatnost = ?", potvrda.FirstOrDefault().Id, 11);

                localPotvrdaEdit.PutBoolean("dezodorizacijaBtn", djelatnostDezodorizacija.Any() ? true : false);
                localPotvrdaEdit.PutBoolean("suzbijanjeStetnikaBtn", djelatnostSuzbijanjeStetnika.Any() ? true : false);
                localPotvrdaEdit.PutBoolean("KIInsektiBtn", djelatnostKIInsekti.Any() ? true : false);
                localPotvrdaEdit.PutBoolean("KIGlodavciBtn", djelatnostKIGlodavci.Any() ? true : false);
                localPotvrdaEdit.PutBoolean("uzimanjeBrisevaBtn", djelatnostuzimanjeBriseva.Any() ? true : false);
                localPotvrdaEdit.PutBoolean("suzbijanjeKorovaBtn", djelatnostsuzbijanjeKorova.Any() ? true : false);
                localPotvrdaEdit.PutBoolean("kosnjaTraveBtn", djelatnostkosnjaTrave.Any() ? true : false);
                localPotvrdaEdit.PutBoolean("potvrdaPage2", true);

                //Potvrda str.3
                List <DID_Potvrda_Nametnik> nametnici = db.Query <DID_Potvrda_Nametnik>(
                    "SELECT * " +
                    "FROM DID_Potvrda_Nametnik " +
                    "WHERE Potvrda = ?", potvrda.FirstOrDefault().Id);

                foreach (var nametnik in nametnici)
                {
                    if (nametnik.Nametnik == "11")
                    {
                        localPotvrdaEdit.PutBoolean("mis", true);
                    }
                    if (nametnik.Nametnik == "12")
                    {
                        localPotvrdaEdit.PutBoolean("stakor", true);
                    }
                    if (nametnik.Nametnik == "13")
                    {
                        localPotvrdaEdit.PutBoolean("ostaliGlodavci", true);
                    }
                    if (nametnik.Nametnik == "21")
                    {
                        localPotvrdaEdit.PutBoolean("muha", true);
                    }
                    if (nametnik.Nametnik == "210")
                    {
                        localPotvrdaEdit.PutBoolean("ostaliInsekti", true);
                    }
                    if (nametnik.Nametnik == "22")
                    {
                        localPotvrdaEdit.PutBoolean("buha", true);
                    }
                    if (nametnik.Nametnik == "23")
                    {
                        localPotvrdaEdit.PutBoolean("zohar", true);
                    }
                    if (nametnik.Nametnik == "24")
                    {
                        localPotvrdaEdit.PutBoolean("mrav", true);
                    }
                    if (nametnik.Nametnik == "25")
                    {
                        localPotvrdaEdit.PutBoolean("komarac", true);
                    }
                    if (nametnik.Nametnik == "26")
                    {
                        localPotvrdaEdit.PutBoolean("stjenica", true);
                    }
                    if (nametnik.Nametnik == "27")
                    {
                        localPotvrdaEdit.PutBoolean("us", true);
                    }
                    if (nametnik.Nametnik == "28")
                    {
                        localPotvrdaEdit.PutBoolean("osa", true);
                    }
                    if (nametnik.Nametnik == "29")
                    {
                        localPotvrdaEdit.PutBoolean("strsljen", true);
                    }
                    if (nametnik.Nametnik == "30")
                    {
                        localPotvrdaEdit.PutBoolean("zmije", true);
                    }
                    if (nametnik.Nametnik == "31")
                    {
                        localPotvrdaEdit.PutBoolean("bakterije", true);
                    }
                    if (nametnik.Nametnik == "32")
                    {
                        localPotvrdaEdit.PutBoolean("komaracAdulti", true);
                    }
                    if (nametnik.Nametnik == "33")
                    {
                        localPotvrdaEdit.PutBoolean("moljci", true);
                    }
                }
                localPotvrdaEdit.PutBoolean("potvrdaPage3", true);
                localPotvrdaEdit.PutInt("id", potvrda.FirstOrDefault().Id);
                localPotvrdaEdit.PutBoolean("edit", true);
                localPotvrdaEdit.Commit();
            }
            else
            {
                DID_Lokacija lokacija = db.Query <DID_Lokacija>(
                    "SELECT * " +
                    "FROM DID_Lokacija " +
                    "WHERE DID_Lokacija.SAN_Id = ?", lokacijaId).FirstOrDefault();

                List <DID_LokacijaPozicija> pozicijeOdradene = db.Query <DID_LokacijaPozicija>(
                    "SELECT * " +
                    "FROM DID_LokacijaPozicija " +
                    "INNER JOIN DID_Anketa ON DID_LokacijaPozicija.POZ_Id = DID_Anketa.ANK_POZ_Id " +
                    "WHERE DID_Anketa.ANK_RadniNalog = ? " +
                    "AND DID_LokacijaPozicija.SAN_Id = ?", radniNalog, lokacijaId);

                List <DID_LokacijaPozicija> pozicijeUkupno = db.Query <DID_LokacijaPozicija>(
                    "SELECT * " +
                    "FROM DID_LokacijaPozicija " +
                    "INNER JOIN DID_RadniNalog_Lokacija ON DID_LokacijaPozicija.SAN_Id = DID_RadniNalog_Lokacija.Lokacija " +
                    "WHERE DID_RadniNalog_Lokacija.RadniNalog = ? " +
                    "AND DID_LokacijaPozicija.SAN_Id = ?", radniNalog, lokacijaId);

                // AKo je lokacija oznacena kao da ne postoje pozicije onda odma mos kreirati potvrdu
                if (pozicijeOdradene.Count == pozicijeUkupno.Count || !lokacija.SAN_AnketePoPozicijama)
                {
                    izradaPotvrde.Visibility = Android.Views.ViewStates.Visible;
                }
                else
                {
                    HidePotvrdaButton();
                }
            }
        }
예제 #16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.acquaintanceListFloatingActionButton);

            /*Snackbar
            *  .Make(fab, "Text Here", Snackbar.LengthLong)
            *  .SetAction("Party", (x) => { })
            *  .Show();*/
            shp  = Application.Context.GetSharedPreferences("ewosettings", FileCreationMode.Append);
            edtr = shp.Edit();
            if (!shp.Contains("drafts"))
            {
                drafts = new List <EWO>();
                edtr.PutString("drafts", JsonConvert.SerializeObject(drafts));
                edtr.Commit();
            }
            else
            {
                drafts = JsonConvert.DeserializeObject <List <EWO> >(shp.GetString("drafts", JsonConvert.SerializeObject(new List <EWO>())));
            }

            // instantiate adapter
            _Adapter = new AcquaintanceCollectionAdapter();

            // instantiate the layout manager
            var layoutManager = new LinearLayoutManager(this);


            // setup the action bar
            SetSupportActionBar(FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar));

            // ensure that the system bar color gets drawn
            Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);

            // set the title of both the activity and the action bar
            Title = SupportActionBar.Title = "EW Observations";

            _SwipeRefreshLayout = (SwipeRefreshLayout)FindViewById(Resource.Id.acquaintanceListSwipeRefreshContainer);

            _SwipeRefreshLayout.Refresh += async(sender, e) => { await LoadAcquaintances(); };

            _SwipeRefreshLayout.Post(() => _SwipeRefreshLayout.Refreshing = true);

            // instantiate/inflate the RecyclerView
            var recyclerView = (RecyclerView)FindViewById(Resource.Id.acquaintanceRecyclerView);

            // set RecyclerView's layout manager
            recyclerView.SetLayoutManager(layoutManager);

            // set RecyclerView's adapter
            recyclerView.SetAdapter(_Adapter);

            var addButton    = (FloatingActionButton)FindViewById(Resource.Id.acquaintanceListFloatingActionButton);
            var draftsButton = (FloatingActionButton)FindViewById(Resource.Id.EwoEditFloatingActionButton);

            draftsButton.Click += async(sender, e) =>
            {
                Toast.MakeText(this, "Switching to " + (!showDratfs ? "Drafts" : "Online") + " records", ToastLength.Long).Show();
                showDratfs = !showDratfs;
                await LoadAcquaintances();
            };
            addButton.Click += (sender, e) => {
                var Infoactivity = new Intent(this, typeof(EwoInfo));
                Infoactivity.PutExtra("ewoObject", JsonConvert.SerializeObject(new EWO()
                {
                    Date = DateTime.Now, id = minId()
                }));
                StartActivity(Infoactivity);
            };
        }
예제 #17
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            LayoutInflater inflater = (LayoutInflater)context
                                      .GetSystemService(Context.LayoutInflaterService);
            var view                 = inflater.Inflate(Resource.Layout.stationListViewItem, parent, false);
            var tvstationname        = view.FindViewById <TextView>(Resource.Id.tvStationName);
            var tvstationAddress     = view.FindViewById <TextView>(Resource.Id.tvStationAddress);
            var tvactivedevicenumber = view.FindViewById <TextView>(Resource.Id.tvOcuppiedSpotsNumber);
            var tvValue              = view.FindViewById <TextView>(Resource.Id.tvValue);
            var ivsettings           = view.FindViewById <ImageView>(Resource.Id.imageviewAddToFavourites);
            var img_favorite         = view.FindViewById <ImageView>(Resource.Id.imageviewAddToFavourites);
            var imageviewActive      = view.FindViewById <ImageView>(Resource.Id.imageviewActive);

            if (itemList[position].is_favorite)
            {
                img_favorite.SetImageResource(Resource.Drawable.favouriteselected_48);
            }
            else
            {
                img_favorite.SetImageResource(Resource.Drawable.favourite_50);
            }



            ListViewItemStation station = itemList[position];

            if (station.station.Status != "Functionala" && station.station.StatusType != "Online")
            {
                imageviewActive.SetImageResource(Resource.Drawable.in_active);
            }

            if (favorite)
            {
                img_favorite.SetImageResource(Resource.Drawable.favouriteselected_48);
                img_favorite.Click += delegate
                {
                    ISharedPreferences       sharedPref            = activity.GetSharedPreferences("favorite_stations", FileCreationMode.Private);
                    ICollection <string>     favorite_stations     = sharedPref.GetStringSet("favorite_stations", new List <string>());
                    ISharedPreferencesEditor editor                = sharedPref.Edit();
                    List <string>            new_favorite_stations = new List <string>();
                    new_favorite_stations.AddRange(favorite_stations);
                    new_favorite_stations.Remove(station.station.StationName);
                    editor.PutStringSet("favorite_stations", new_favorite_stations);
                    editor.Commit();
                    itemList.Remove(station);
                    this.NotifyDataSetChanged();
                };
            }
            else
            {
                img_favorite.Click += delegate
                {
                    ISharedPreferences       sharedPref            = activity.GetSharedPreferences("favorite_stations", FileCreationMode.Private);
                    ICollection <string>     favorite_stations     = sharedPref.GetStringSet("favorite_stations", new List <string>());
                    ISharedPreferencesEditor editor                = sharedPref.Edit();
                    List <string>            new_favorite_stations = new List <string>();
                    new_favorite_stations.AddRange(favorite_stations);
                    new_favorite_stations.Add(station.station.StationName);
                    editor.PutStringSet("favorite_stations", new_favorite_stations);
                    editor.Commit();
                    itemList.Find(x => x.station == station.station).is_favorite = true;
                    this.NotifyDataSetChanged();
                };
            }

            tvstationname.Text        = itemList[position].station.StationName;
            tvstationAddress.Text     = itemList[position].station.Address;
            tvactivedevicenumber.Text = "Bikes " + itemList[position].station.OcuppiedSpots.ToString();
            tvValue.Text = "Parking " + itemList[position].station.EmptySpots.ToString();

            return(view);
        }
예제 #18
0
        void IPreferencesBackend.Commit()
        {
            if (!dirty)
            {
                return;
            }

            dirty = false;

            using (MemoryStream s = new MemoryStream()) {
                using (BinaryWriter w = new BinaryWriter(s)) {
                    w.Write((ushort)data.Count);

                    foreach (var pair in data)
                    {
                        w.Write(pair.Key);

                        switch (pair.Value)
                        {
                        case string value: {
                            w.Write((byte)0);
                            w.Write(value);
                            break;
                        }

                        case bool value: {
                            w.Write((byte)1);
                            w.Write(value);
                            break;
                        }

                        case byte value: {
                            w.Write((byte)2);
                            w.Write(value);
                            break;
                        }

                        case int value: {
                            w.Write((byte)3);
                            w.Write(value);
                            break;
                        }

                        case long value: {
                            w.Write((byte)4);
                            w.Write(value);
                            break;
                        }

                        case short value: {
                            w.Write((byte)5);
                            w.Write(value);
                            break;
                        }

                        case uint value: {
                            w.Write((byte)6);
                            w.Write(value);
                            break;
                        }

                        case string[] value: {
                            w.Write((byte)10);
                            w.Write((byte)value.Length);
                            for (int j = 0; j < value.Length; j++)
                            {
                                w.Write(value[j]);
                            }
                            break;
                        }

                        case bool[] value: {
                            w.Write((byte)11);
                            w.Write((byte)value.Length);
                            for (int j = 0; j < value.Length; j++)
                            {
                                w.Write(value[j]);
                            }
                            break;
                        }

                        case byte[] value: {
                            w.Write((byte)12);
                            w.Write((byte)value.Length);
                            for (int j = 0; j < value.Length; j++)
                            {
                                w.Write(value[j]);
                            }
                            break;
                        }

                        case int[] value: {
                            w.Write((byte)13);
                            w.Write((byte)value.Length);
                            for (int j = 0; j < value.Length; j++)
                            {
                                w.Write(value[j]);
                            }
                            break;
                        }

                        case long[] value: {
                            w.Write((byte)14);
                            w.Write((byte)value.Length);
                            for (int j = 0; j < value.Length; j++)
                            {
                                w.Write(value[j]);
                            }
                            break;
                        }

                        case short[] value: {
                            w.Write((byte)15);
                            w.Write((byte)value.Length);
                            for (int j = 0; j < value.Length; j++)
                            {
                                w.Write(value[j]);
                            }
                            break;
                        }

                        case uint[] value: {
                            w.Write((byte)16);
                            w.Write((byte)value.Length);
                            for (int j = 0; j < value.Length; j++)
                            {
                                w.Write(value[j]);
                            }
                            break;
                        }

                        default:
                            Log.Write(LogType.Error, "Unknown preference type: " + pair.Value.GetType().FullName);
                            break;
                        }
                    }
                }

                ArraySegment <byte> buffer;
                if (s.TryGetBuffer(out buffer))
                {
                    string base64 = Base64.EncodeToString(buffer.Array, buffer.Offset, buffer.Count, Base64Flags.NoPadding | Base64Flags.NoWrap);

                    ISharedPreferencesEditor editor = sharedPrefs.Edit();

                    editor.PutString("Root", base64);

                    editor.Commit();
                }
                else
                {
                    Log.Write(LogType.Error, "Can't get memory buffer to save preferences.");
                }
            }
        }
예제 #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AppPreference appPreference = new AppPreference();

            CvInvoke.UseOpenCL = false;  //appPreference.UseOpenCL;
            string oclDeviceName = appPreference.OpenClDeviceName;

            if (!string.IsNullOrEmpty(oclDeviceName))
            {
                CvInvoke.OclSetDefaultDevice(oclDeviceName);
                Log.Error(TAG, "\t\t --OclSetDefaultDevice: " + oclDeviceName);
            }

            mFile = new Java.IO.File(GetExternalFilesDir(null), "derp.jpg");

            ISharedPreferences preference = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext);
            string             appVersion = PackageManager.GetPackageInfo(PackageName, Android.Content.PM.PackageInfoFlags.Activities).VersionName;

            if (!preference.Contains("cascade-data-version") || !preference.GetString("cascade-data-version", null).Equals(appVersion) ||
                !(preference.Contains("cascade-eye-data-path") || preference.Contains("cascade-face-data-path")))
            {
                AndroidFileAsset.OverwriteMethod overwriteMethod = AndroidFileAsset.OverwriteMethod.AlwaysOverwrite;

                FileInfo eyeFile  = AndroidFileAsset.WritePermanantFileAsset(this, "haarcascade_eye.xml", "cascade", overwriteMethod);
                FileInfo faceFile = AndroidFileAsset.WritePermanantFileAsset(this, "haarcascade_frontalface_alt_tree.xml", "cascade", overwriteMethod);

                Log.Error(TAG, "\t\t --eyeFile.FullName: " + eyeFile.FullName);
                Log.Error(TAG, "\t\t --faceFile.FullName: " + faceFile.FullName);

                //save tesseract data path
                ISharedPreferencesEditor editor = preference.Edit();
                editor.PutString("cascade-data-version", appVersion);
                editor.PutString("cascade-eye-data-path", eyeFile.FullName);
                editor.PutString("cascade-face-data-path", faceFile.FullName);
                editor.Commit();
            }

            eyeXml  = preference.GetString("cascade-eye-data-path", null);
            faceXml = preference.GetString("cascade-face-data-path", null);

            Log.Error(TAG, "\t\t --eyeXml: " + eyeXml);
            Log.Error(TAG, "\t\t --faceXml: " + faceXml);

            //face = new CascadeClassifier(faceXml);
            //eye = new CascadeClassifier(eyeXml);

            // Hide the window title and go fullscreen.
            RequestWindowFeature(WindowFeatures.NoTitle);
            Window.AddFlags(WindowManagerFlags.Fullscreen);

            SetContentView(Resource.Layout.take_photo_surface_view);
            mTextureView     = (AutoFitTextureView)FindViewById(Resource.Id.CameraView);
            mTransparentView = (SurfaceView)FindViewById(Resource.Id.TransparentView);

            mTransparentView.SetZOrderOnTop(true);
            mTransparentView.BringToFront();

            mTransparentView.Holder.SetFormat(Android.Graphics.Format.Transparent);
            mTransparentView.Holder.AddCallback(this);

            var manager = GetSystemService(Context.WindowService).JavaCast <IWindowManager>();
            var size    = new Android.Graphics.Point();

            manager.DefaultDisplay.GetSize(size);

            screenX = size.X / 2;
            screenY = size.Y / 2;

            L = screenX - 200;
            T = screenY - 200;
            R = screenX + 200;
            B = screenY + 200;

            mStateCallback = new CameraStateListener()
            {
                owner = this
            };
            mSurfaceTextureListener   = new Camera2BasicSurfaceTextureListener(this);
            mOnImageAvailableListener = new ImageAvailableListener()
            {
                Owner = this
            };

            // fill ORIENTATIONS list
            ORIENTATIONS.Append((int)SurfaceOrientation.Rotation0, 90);
            ORIENTATIONS.Append((int)SurfaceOrientation.Rotation90, 0);
            ORIENTATIONS.Append((int)SurfaceOrientation.Rotation180, 270);
            ORIENTATIONS.Append((int)SurfaceOrientation.Rotation270, 180);
        }
예제 #20
0
 void RadioButtonClick(object sender, EventArgs e)
 {
     var radio = sender as RadioButton;
     switch (radio.Id) {
     case Resource.Id.rbArrival:
         radio.Typeface = kalingab;
         rbDepart.Typeface = kalinga;
         tSel = false;
         break;
     default:
         radio.Typeface = kalingab;
         rbArrive.Typeface = kalinga;
         tSel = true;
         break;
     }
     rbDepart.Checked = tSel;
     rbArrive.Checked = !tSel;
     editor = prefs.Edit ();
     editor.PutBoolean (TIMESEL, tSel);
     editor.Commit ();
 }
        private void MAdapter_ItemDelete(object sender, int e)
        {
            if (flagLokacijaPotvrda && filtriraneAnkete.Count == 1)
            {
                string nazivLokacije = db.Query <DID_Lokacija>(
                    "SELECT * " +
                    "FROM DID_Lokacija " +
                    "WHERE SAN_Id = ?", lokacijaId).FirstOrDefault().SAN_Naziv;

                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Upozorenje!");
                alert.SetMessage("Lokacija: " + nazivLokacije + " je zaključana. Ova anketa je jedina na lokaciji te ukoliko obrišete anketu automatski će se obrisati potvrda. Jeste li sigurni da želite obrisati anketu?");
                alert.SetPositiveButton("OBRIŠI", (senderAlert, arg) =>
                {
                    localOdradeneAnketeEdit.PutBoolean("visited", true);
                    localOdradeneAnketeEdit.Commit();
                    localPozicijaEdit.PutString("sifraPartnera", sifraPartnera);
                    localPozicijaEdit.Commit();
                    Guid anketaId  = filtriraneAnkete[e].Id;
                    int pozicijaId = filtriraneAnkete[e].ANK_POZ_Id;
                    if (pozicijaId < 0)
                    {
                        db.Delete <DID_LokacijaPozicija>(pozicijaId);
                    }


                    DeleteMaterijaleNaAnketama(pozicijaId);


                    db.Delete <DID_Anketa>(anketaId);
                    //db.Execute(
                    //    "DELETE FROM DID_AnketaMaterijali " +
                    //    "WHERE RadniNalog = ? " +
                    //    "AND PozicijaId = ?", radniNalogId, pozicijaId);
                    db.Execute(
                        "DELETE FROM DID_Potvrda_Materijal " +
                        "WHERE Potvrda = ?", potvrda.FirstOrDefault().Id);
                    db.Query <DID_Potvrda_Djelatnost>(
                        "DELETE FROM DID_Potvrda_Djelatnost " +
                        "WHERE Potvrda = ?", potvrda.FirstOrDefault().Id);
                    db.Query <DID_Potvrda_Nametnik>(
                        "DELETE FROM DID_Potvrda_Nametnik " +
                        "WHERE Potvrda = ?", potvrda.FirstOrDefault().Id);
                    db.Delete <DID_Potvrda>(potvrdaId);

                    //Update lokacije
                    db.Query <DID_RadniNalog_Lokacija>(
                        "UPDATE DID_RadniNalog_Lokacija " +
                        "SET Status = 2 " +
                        "WHERE Lokacija = ? " +
                        "AND RadniNalog = ?", lokacijaId, radniNalogId);

                    UpdateStatusRadniNalog();

                    intent = new Intent(this, typeof(Activity_OdradeneAnkete));
                    StartActivity(intent);
                });

                alert.SetNegativeButton("ODUSTANI", (senderAlert, arg) => { });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
            else if (flagLokacijaPotvrda && filtriraneAnkete.Count > 1)
            {
                string nazivLokacije = db.Query <DID_Lokacija>(
                    "SELECT * " +
                    "FROM DID_Lokacija " +
                    "WHERE SAN_Id = ?", lokacijaId).FirstOrDefault().SAN_Naziv;

                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Upozorenje!");
                alert.SetMessage("Lokacija: " + nazivLokacije + " je zaključana. Ako obrišete anketu obrisati će se i materijali vezani za odabranu poziciju. Jeste li sigurni da želite obrisati anketu?");
                alert.SetPositiveButton("OBRIŠI", (senderAlert, arg) =>
                {
                    localOdradeneAnketeEdit.PutBoolean("visited", true);
                    localOdradeneAnketeEdit.Commit();
                    localPozicijaEdit.PutString("sifraPartnera", sifraPartnera);
                    localPozicijaEdit.Commit();
                    Guid anketaId  = filtriraneAnkete[e].Id;
                    int pozicijaId = filtriraneAnkete[e].ANK_POZ_Id;

                    if (pozicijaId < 0)
                    {
                        db.Delete <DID_LokacijaPozicija>(pozicijaId);
                    }

                    DeleteMaterijaleNaAnketama(pozicijaId);

                    db.Delete <DID_Anketa>(anketaId);
                    //db.Execute(
                    //    "DELETE FROM DID_AnketaMaterijali " +
                    //    "WHERE RadniNalog = ? " +
                    //    "AND PozicijaId = ?", radniNalogId, pozicijaId);

                    db.Execute(
                        "DELETE FROM DID_Potvrda_Materijal " +
                        "WHERE Potvrda = ?", potvrda.FirstOrDefault().Id);

                    db.Execute(
                        "INSERT INTO DID_Potvrda_Materijal (Potvrda, Materijal, Utroseno, MaterijalNaziv) " +
                        "SELECT pot.Id, mat.MaterijalSifra, TOTAL(mat.Kolicina), mat.MaterijalNaziv " +
                        "FROM DID_AnketaMaterijali mat " +
                        "INNER JOIN DID_LokacijaPozicija poz ON poz.POZ_Id = mat.PozicijaId " +
                        "INNER JOIN DID_Potvrda pot ON pot.RadniNalog = mat.RadniNalog " +
                        "AND pot.Lokacija = poz.SAN_Id " +
                        "WHERE pot.Id = ? " +
                        "GROUP BY mat.MaterijalSifra, mat.MjernaJedinica", potvrda.FirstOrDefault().Id);

                    var listaMaterijalaPotvrda = db.Query <DID_Potvrda_Materijal>("SELECT * FROM DID_Potvrda_Materijal WHERE Potvrda = ?", potvrda.FirstOrDefault().Id);

                    foreach (var materijal in listaMaterijalaPotvrda)
                    {
                        db.Execute(
                            "UPDATE DID_Potvrda_Materijal " +
                            "SET SinhronizacijaPrivremeniKljuc = ? " +
                            "WHERE Id = ?", materijal.Id, materijal.Id);
                    }

                    intent = new Intent(this, typeof(Activity_OdradeneAnkete));
                    StartActivity(intent);
                });

                alert.SetNegativeButton("ODUSTANI", (senderAlert, arg) => { });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
            else
            {
                AlertDialog.Builder alert = new AlertDialog.Builder(this);
                alert.SetTitle("Upozorenje!");
                alert.SetMessage("Brisanjem ankete obrisati će se i materijali vezani uz ovu poziciju. Jeste li sigurni da želite obrisati anketu?");
                alert.SetPositiveButton("OBRIŠI", (senderAlert, arg) =>
                {
                    localOdradeneAnketeEdit.PutBoolean("visited", true);
                    localOdradeneAnketeEdit.Commit();
                    localPozicijaEdit.PutString("sifraPartnera", sifraPartnera);
                    localPozicijaEdit.Commit();
                    Guid anketaId  = filtriraneAnkete[e].Id;
                    int pozicijaId = filtriraneAnkete[e].ANK_POZ_Id;

                    if (pozicijaId < 0)
                    {
                        db.Delete <DID_LokacijaPozicija>(pozicijaId);
                    }

                    db.Delete <DID_Anketa>(anketaId);

                    DeleteMaterijaleNaAnketama(pozicijaId);

                    //db.Execute(
                    //    "DELETE FROM DID_AnketaMaterijali " +
                    //    "WHERE RadniNalog = ? " +
                    //    "AND PozicijaId = ?", radniNalogId, pozicijaId);

                    intent = new Intent(this, typeof(Activity_OdradeneAnkete));
                    StartActivity(intent);
                });

                alert.SetNegativeButton("ODUSTANI", (senderAlert, arg) => { });
                Dialog dialog = alert.Create();
                dialog.Show();
            }
        }
        private void MAdapter_ItemClick(object sender, int e)
        {
            localPozicija.Edit().Clear().Commit();
            localAnketa.Edit().Clear().Commit();
            localOdradeneAnketeEdit.PutBoolean("visited", true);
            localOdradeneAnketeEdit.Commit();

            var anketaId = filtriraneAnkete[e].Id;
            var anketa   = db.Query <DID_Anketa>(
                "SELECT * " +
                "FROM DID_Anketa " +
                "WHERE Id = ?", anketaId).FirstOrDefault();
            int tipKutije = db.Query <DID_LokacijaPozicija>(
                "SELECT * " +
                "FROM DID_LokacijaPozicija " +
                "WHERE POZ_Id = ?", anketa.ANK_POZ_Id).FirstOrDefault().POZ_Tip;

            if (anketa.ANK_RazlogNeizvrsenja != 0)
            {
                string razlogNeizvrsenja = db.Query <DID_RazlogNeizvrsenjaDeratizacije>(
                    "SELECT * " +
                    "FROM DID_RazlogNeizvrsenjaDeratizacije " +
                    "WHERE Sifra = ?", anketa.ANK_RazlogNeizvrsenja).FirstOrDefault().Naziv;
                localAnketaEdit.PutString("spinnerSelectedItem", razlogNeizvrsenja);
                localAnketaEdit.PutBoolean("neprovedenoRadioBtn", true);
            }
            else
            {
                localAnketaEdit.PutString("spinnerSelectedItem", null);
                localAnketaEdit.PutBoolean("neprovedenoRadioBtn", false);
            }

            localPozicijaEdit.PutString("anketaId", anketaId.ToString());
            localPozicijaEdit.PutInt("pozicijaId", anketa.ANK_POZ_Id);
            localPozicijaEdit.PutInt("lokacijaId", lokacijaId);
            localPozicijaEdit.PutString("sifraPartnera", sifraPartnera);
            localPozicijaEdit.PutInt("tipKutije", tipKutije);
            localPozicijaEdit.Commit();

            localAnketaEdit.PutString("napomeneInput", anketa.ANK_Napomena);
            localAnketaEdit.PutBoolean("visitedPage1", true);
            localAnketaEdit.PutBoolean("visitedPage2", true);
            localAnketaEdit.PutBoolean("visitedPage3", true);
            localAnketaEdit.PutBoolean("visitedMaterijali", true);
            localAnketaEdit.PutBoolean("edit", true);
            localAnketaEdit.Commit();

            if (anketa.ANK_TipDeratizacije == 1)
            {
                if (anketa.ANK_TipDeratizacijskeKutijeSifra == 2)
                {
                    localAnketaEdit.PutBoolean("ANK_Kutija_Ljep", true);
                    localAnketaEdit.PutBoolean("kutijaUrednaLjep", anketa.ANK_Utvrdjeno_Ljep_KutijaUredna);
                    localAnketaEdit.PutBoolean("kutijaOstecenaLjep", anketa.ANK_Utvrdjeno_Ljep_KutijaOstecena);
                    localAnketaEdit.PutBoolean("nemaKutijeLjep", anketa.ANK_Utvrdjeno_Ljep_NemaKutije);
                    localAnketaEdit.PutBoolean("ulovljenStakorLjep", anketa.ANK_Utvrdjeno_Ljep_UlovljenStakor);
                    localAnketaEdit.PutBoolean("ulovljenMisLjep", anketa.ANK_Utvrdjeno_Ljep_UlovljenMis);
                    localAnketaEdit.PutBoolean("novaLjepPodUcinjenoLjep", anketa.ANK_Ucinjeno_Ljep_NovaLjepljivaPodloska);
                    localAnketaEdit.PutBoolean("novaKutijaUcinjenoLjep", anketa.ANK_Ucinjeno_Ljep_NovaKutija);
                }
                else if (anketa.ANK_TipDeratizacijskeKutijeSifra == 1)
                {
                    localAnketaEdit.PutBoolean("ANK_Kutija_Rot", true);
                    localAnketaEdit.PutBoolean("kutijaUrednaRot", anketa.ANK_Utvrdjeno_Rot_KutijaUredna);
                    localAnketaEdit.PutBoolean("kutijaOstecenaRot", anketa.ANK_Utvrdjeno_Rot_KutijaOstecena);
                    localAnketaEdit.PutBoolean("nemaKutijeRot", anketa.ANK_Utvrdjeno_Rot_NemaKutije);
                    localAnketaEdit.PutBoolean("tragoviGlodanjaRot", anketa.ANK_Utvrdjeno_Rot_TragoviGlodanja);
                    localAnketaEdit.PutBoolean("izmetRot", anketa.ANK_Utvrdjeno_Rot_Izmet);
                    localAnketaEdit.PutBoolean("pojedenaMekaRot", anketa.ANK_Utvrdjeno_Rot_PojedenaMeka);
                    localAnketaEdit.PutBoolean("ostecenaMekaRot", anketa.ANK_Utvrdjeno_Rot_OstecenaMeka);
                    localAnketaEdit.PutBoolean("uginuliStakorRot", anketa.ANK_Utvrdjeno_Rot_UginuliStakor);
                    localAnketaEdit.PutBoolean("uginuliMisRot", anketa.ANK_Utvrdjeno_Rot_UginuliMis);
                    localAnketaEdit.PutBoolean("noviMamciUcinjenoRot", anketa.ANK_Ucinjeno_Rot_PostavljeniMamci);
                    localAnketaEdit.PutBoolean("novaKutijaUcinjenoRot", anketa.ANK_Ucinjeno_Rot_NovaKutija);
                    localAnketaEdit.PutBoolean("nadopunjenaMekomUcinjenoRot", anketa.ANK_Ucinjeno_Rot_NadopunjenaMekom);
                }
                else if (anketa.ANK_TipDeratizacijskeKutijeSifra == 3)
                {
                    localAnketaEdit.PutBoolean("ANK_Kutija_Ziv", true);
                    localAnketaEdit.PutBoolean("kutijaUrednaZiv", anketa.ANK_Utvrdjeno_Ziv_KutijaUredna);
                    localAnketaEdit.PutBoolean("kutijaOstecenaZiv", anketa.ANK_Utvrdjeno_Ziv_KutijaOstecena);
                    localAnketaEdit.PutBoolean("nemaKutijeZiv", anketa.ANK_Utvrdjeno_Ziv_NemaKutije);
                    localAnketaEdit.PutBoolean("uginuliMisZiv", anketa.ANK_Utvrdjeno_Ziv_UlovljenMis);
                    localAnketaEdit.PutBoolean("uginuliStakorZiv", anketa.ANK_Utvrdjeno_Ziv_UlovljenStakor);
                    localAnketaEdit.PutBoolean("novaKutijaUcinjenoZiv", anketa.ANK_Ucinjeno_Ziv_NovaKutija);
                }
                localAnketaEdit.Commit();
                intent = new Intent(this, typeof(Activity_Kontola_page1));
                StartActivity(intent);
            }
            else if (anketa.ANK_TipDeratizacije == 2)
            {
                if (anketa.ANK_TipDeratizacijskeKutijeSifra == 2)
                {
                    localAnketaEdit.PutBoolean("ANK_Kutija_Ljep", true);
                    localAnketaEdit.PutBoolean("kutijaUrednaLjep", anketa.ANK_Utvrdjeno_Ljep_KutijaUredna);
                    localAnketaEdit.PutBoolean("kutijaOstecenaLjep", anketa.ANK_Utvrdjeno_Ljep_KutijaOstecena);
                    localAnketaEdit.PutBoolean("nemaKutijeLjep", anketa.ANK_Utvrdjeno_Ljep_NemaKutije);
                    localAnketaEdit.PutBoolean("ulovljenStakorLjep", anketa.ANK_Utvrdjeno_Ljep_UlovljenStakor);
                    localAnketaEdit.PutBoolean("ulovljenMisLjep", anketa.ANK_Utvrdjeno_Ljep_UlovljenMis);
                    localAnketaEdit.PutBoolean("novaLjepPodUcinjenoLjep", anketa.ANK_Ucinjeno_Ljep_NovaLjepljivaPodloska);
                    localAnketaEdit.PutBoolean("novaKutijaUcinjenoLjep", anketa.ANK_Ucinjeno_Ljep_NovaKutija);
                }
                else if (anketa.ANK_TipDeratizacijskeKutijeSifra == 1)
                {
                    localAnketaEdit.PutBoolean("ANK_Kutija_Rot", true);
                    localAnketaEdit.PutBoolean("kutijaUrednaRot", anketa.ANK_Utvrdjeno_Rot_KutijaUredna);
                    localAnketaEdit.PutBoolean("kutijaOstecenaRot", anketa.ANK_Utvrdjeno_Rot_KutijaOstecena);
                    localAnketaEdit.PutBoolean("nemaKutijeRot", anketa.ANK_Utvrdjeno_Rot_NemaKutije);
                    localAnketaEdit.PutBoolean("tragoviGlodanjaRot", anketa.ANK_Utvrdjeno_Rot_TragoviGlodanja);
                    localAnketaEdit.PutBoolean("izmetRot", anketa.ANK_Utvrdjeno_Rot_Izmet);
                    localAnketaEdit.PutBoolean("pojedenaMekaRot", anketa.ANK_Utvrdjeno_Rot_PojedenaMeka);
                    localAnketaEdit.PutBoolean("ostecenaMekaRot", anketa.ANK_Utvrdjeno_Rot_OstecenaMeka);
                    localAnketaEdit.PutBoolean("uginuliStakorRot", anketa.ANK_Utvrdjeno_Rot_UginuliStakor);
                    localAnketaEdit.PutBoolean("uginuliMisRot", anketa.ANK_Utvrdjeno_Rot_UginuliMis);
                    localAnketaEdit.PutBoolean("noviMamciUcinjenoRot", anketa.ANK_Ucinjeno_Rot_PostavljeniMamci);
                    localAnketaEdit.PutBoolean("novaKutijaUcinjenoRot", anketa.ANK_Ucinjeno_Rot_NovaKutija);
                    localAnketaEdit.PutBoolean("nadopunjenaMekomUcinjenoRot", anketa.ANK_Ucinjeno_Rot_NadopunjenaMekom);
                }
                else if (anketa.ANK_TipDeratizacijskeKutijeSifra == 3)
                {
                    localAnketaEdit.PutBoolean("ANK_Kutija_Ziv", true);
                    localAnketaEdit.PutBoolean("kutijaUrednaZiv", anketa.ANK_Utvrdjeno_Ziv_KutijaUredna);
                    localAnketaEdit.PutBoolean("kutijaOstecenaZiv", anketa.ANK_Utvrdjeno_Ziv_KutijaOstecena);
                    localAnketaEdit.PutBoolean("nemaKutijeZiv", anketa.ANK_Utvrdjeno_Ziv_NemaKutije);
                    localAnketaEdit.PutBoolean("uginuliMisZiv", anketa.ANK_Utvrdjeno_Ziv_UlovljenMis);
                    localAnketaEdit.PutBoolean("uginuliStakorZiv", anketa.ANK_Utvrdjeno_Ziv_UlovljenStakor);
                    localAnketaEdit.PutBoolean("novaKutijaUcinjenoZiv", anketa.ANK_Ucinjeno_Ziv_NovaKutija);
                }

                localAnketaEdit.PutBoolean("rupeBox", anketa.ANK_Poc_Prisutnost_Rupe);
                localAnketaEdit.PutBoolean("legloBox", anketa.ANK_Poc_Prisutnost_Leglo);
                localAnketaEdit.PutBoolean("tragoviNoguBox", anketa.ANK_Poc_Prisutnost_TragoviNogu);
                localAnketaEdit.PutBoolean("videnZiviGlodavacBox", anketa.ANK_Poc_Prisutnost_GlodavacZivi);
                localAnketaEdit.PutBoolean("izmetBox", anketa.ANK_Poc_Prisutnost_Izmet);
                localAnketaEdit.PutBoolean("videnUginuliGlodavacBox", anketa.ANK_Poc_Prisutnost_GlodavacUginuli);
                localAnketaEdit.PutBoolean("stetaBox", anketa.ANK_Poc_Prisutnost_Steta);
                localAnketaEdit.PutBoolean("stakoriBox", anketa.ANK_Poc_Infestacija_Stakori);
                localAnketaEdit.PutBoolean("miseviBox", anketa.ANK_Poc_Infestacija_Misevi);
                localAnketaEdit.PutBoolean("drugiGlodavciBox", anketa.ANK_Poc_Infestacija_DrugiGlodavci);
                localAnketaEdit.PutBoolean("okolisBox", anketa.ANK_Poc_Uvjeti_NeuredanOkolis);
                localAnketaEdit.PutBoolean("hranaBox", anketa.ANK_Poc_Uvjeti_Hrana);
                localAnketaEdit.PutBoolean("odvodnjaBox", anketa.ANK_Poc_Uvjeti_NeispravnaOdvodnja);
                localAnketaEdit.PutBoolean("visitedPage4", true);
                localAnketaEdit.Commit();
                intent = new Intent(this, typeof(Activity_PrvaDer_page1));
                StartActivity(intent);
            }
        }
예제 #23
0
 public void SaveUserId(string key) // Save data Values
 {
     namePrefsEditor.PutString(PREFERENCE_ACCESS_KEY, key);
     namePrefsEditor.Commit();
 }