コード例 #1
0
        // api/lookups/getsettingbyname?name=System_CRM_ForgetPasswordLink
        public IHttpActionResult GetSettingByName(string name)
        {
            AuthenticationHelper.ApiAuthorizationCheck(Request);
            try
            {
                var lang       = Request?.Headers?.AcceptLanguage?.FirstOrDefault()?.Value ?? "ar";
                var languageId = lang == "ar"
                    ? (int)GeneralEnums.LanguageEnum.Arabic
                    : (int)GeneralEnums.LanguageEnum.English;
                var result = new SettingViewModel();
                switch (name)
                {
                case Constants.SystemSettings.ForgetPasswordLink:
                    result = SettingHelper.GetOrCreate(name, "http://crm.smsm-it.com/Account/ForgotPassword", languageId);
                    break;

                case Constants.SystemSettings.RegistrationLink:
                    result = SettingHelper.GetOrCreate(name, "http://crm.smsm-it.com/Account/Register", languageId);
                    break;
                }

                return(Ok(result));
            }
            catch (Exception ex)
            {
                LogHelper.LogException(Constants.Users.Mobile, ex, Constants.Errors.Apis.ErrorGettingCustomSetting);
                return(Content(HttpStatusCode.InternalServerError, new BaseApiResponse()
                {
                    StatusCode = HttpStatusCode.InternalServerError,
                    Message = Constants.Errors.Apis.ErrorGettingCustomSetting
                }));
            }
        }
コード例 #2
0
ファイル: UserController.cs プロジェクト: jxnkwlp/dotnet-bbs
        public async Task <IActionResult> Setting(SettingViewModel model)
        {
            var userId = User.Identity.GetUserId <long>();

            try
            {
                await _userService.UpdateUserInfoAsync(new UserInfo()
                {
                    UserId = userId,

                    City     = model.City,
                    GitHubId = model.GitHubId,
                    SiteUrl  = model.SiteUrl,
                    UserSign = model.UserSign,
                    WeiboId  = model.WeiboId,
                });

                ShowMessage(true, "修改信息成功");
            }
            catch (Exception)
            {
                ShowMessage(false, "保存失败");
            }

            return(View(model));
        }
コード例 #3
0
        /// <summary>
        /// メニュー処理
        /// </summary>
        private void Menu_Command(MenuType type)
        {
            switch (type)
            {
            case MenuType.SearchByRanking:
                Current = new SearchVideoByRankingViewModel();
                break;

            case MenuType.SearchByTemporary:
                Current = new SearchVideoByTemporaryViewModel();
                break;

            case MenuType.SearchByHistory:
                Current = new SearchVideoByHistoryViewModel();
                break;

            case MenuType.SearchByMylist:
                Current = new SearchVideoByMylistViewModel();
                break;

            case MenuType.SearchMylist:
                Current = new SearchMylistViewModel();
                break;

            case MenuType.Setting:
                Current = new SettingViewModel();
                break;
            }
        }
コード例 #4
0
        public IActionResult UpdateSettings()
        {
            var data = _settingService.GetAll();

            if (data.Data != null)
            {
                SettingViewModel model = new SettingViewModel
                {
                    Title         = data.Data.Title,
                    Description   = data.Data.Description,
                    Address       = data.Data.Address,
                    CompanyName   = data.Data.CompanyName,
                    Email         = data.Data.Email,
                    Id            = data.Data.Id,
                    Maps          = data.Data.Maps,
                    Meta          = data.Data.Meta,
                    Phone         = data.Data.Phone,
                    WorkTime      = data.Data.WorkTime,
                    WhatsAppText  = data.Data.WhatsAppText,
                    WhatsAppPhone = data.Data.WhatsAppPhone
                };

                return(View(model));
            }

            ViewData["GeneralError"] = Messages.GeneralError;
            return(RedirectToAction("Index", "ManagementPanel"));
        }
コード例 #5
0
        public ReturnViewModel Update(SettingViewModel model)
        {
            var result = new ReturnViewModel();
            var entity = _repository.GetById(model.SettingId);

            if (entity == null)
            {
                result.Message = "setting not found";
                return(result);
            }
            entity.StopHourOn   = model.StopHourOn;
            entity.Announcement = model.Announcement;
            entity.ModifiedOn   = DateTime.Now;

            try
            {
                _repository.Update(entity);
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
                return(result);
            }

            result.IsSuccess = true;
            return(result);
        }
コード例 #6
0
        public MainWindow(MainWindowViewModel viewModel,
                          RFC5780ViewModel rfc5780ViewModel,
                          RFC3489ViewModel rfc3489ViewModel,
                          SettingViewModel settingViewModel
                          )
        {
            InitializeComponent();
            ViewModel = viewModel;
            ThemeManager.Current.ApplicationTheme = null;

            this.WhenActivated(d =>
            {
                #region Server

                this.Bind(ViewModel,
                          vm => vm.Config.StunServer,
                          v => v.ServersComboBox.Text
                          ).DisposeWith(d);

                this.OneWayBind(ViewModel,
                                vm => vm.StunServers,
                                v => v.ServersComboBox.ItemsSource
                                ).DisposeWith(d);

                #endregion

                this.Bind(ViewModel, vm => vm.Router, v => v.RoutedViewHost.Router).DisposeWith(d);
                Observable.FromEventPattern <NavigationViewSelectionChangedEventArgs>(NavigationView, nameof(NavigationView.SelectionChanged))
                .Subscribe(args =>
                {
                    if (args.EventArgs.IsSettingsSelected)
                    {
                        ViewModel.Router.Navigate.Execute(settingViewModel);
                        return;
                    }

                    if (args.EventArgs.SelectedItem is not NavigationViewItem {
                        Tag: string tag
                    })
                    {
                        return;
                    }

                    switch (tag)
                    {
                    case @"1":
                        {
                            ViewModel.Router.Navigate.Execute(rfc5780ViewModel);
                            break;
                        }

                    case @"2":
                        {
                            ViewModel.Router.Navigate.Execute(rfc3489ViewModel);
                            break;
                        }
                    }
                }).DisposeWith(d);
                NavigationView.SelectedItem = NavigationView.MenuItems.OfType <NavigationViewItem>().First();
            });
コード例 #7
0
        public IActionResult Mail(SettingViewModel settingVM)
        {
            if (ModelState.IsValid)
            {
                var smtpUserName = settingService.GetSettingByName("SmtpUserName");
                smtpUserName.Value = settingVM.SmtpUserName;
                settingService.UpdateSetting(smtpUserName);

                var smtpPassword = settingService.GetSettingByName("SmtpPassword");
                smtpPassword.Value = settingVM.SmtpPassword;
                settingService.UpdateSetting(smtpPassword);

                var smtpHost = settingService.GetSettingByName("SmtpHost");
                smtpHost.Value = settingVM.SmtpHost;
                settingService.UpdateSetting(smtpHost);

                var smtpUseSSL = settingService.GetSettingByName("SmtpUseSSL");
                smtpUseSSL.Value = settingVM.SmtpUseSSL;
                settingService.UpdateSetting(smtpUseSSL);

                var smtpPort = settingService.GetSettingByName("SmtpPort");
                smtpPort.Value = settingVM.SmtpPort;
                settingService.UpdateSetting(smtpPort);

                settingService.SaveSetting();
                return(RedirectToAction("Mail"));
            }
            return(RedirectToAction("Mail"));
        }
コード例 #8
0
        public JsonResult StationList(string device)
        {
            SettingViewModel settingviewModel = new SettingViewModel(baserepository, wtequipmentrepo, wtsampleinfo);
            Object           stationlist      = settingviewModel.GetStationList(device);

            return(Json(stationlist, JsonRequestBehavior.AllowGet));
        }
コード例 #9
0
        public SettingsPage()
        {
            InitializeComponent();
            _vm = new SettingViewModel();

            DataContext = _vm;

            Loaded += (s, e) =>
            {
                if (Settings.DisplayImages)
                {
                    imagePicker.SelectedIndex = 1;
                }

                if (Settings.CurrentTheme == Settings.Theme.Dark)
                {
                    themePicker.SelectedIndex = 1;
                }
                else if (Settings.CurrentTheme == Settings.Theme.Light)
                {
                    themePicker.SelectedIndex = 2;
                }

                if (Settings.HeaderFooterTheme == Settings.Theme.Dark)
                {
                    headerThemePicker.SelectedIndex = 1;
                }
                else if (Settings.HeaderFooterTheme == Settings.Theme.Light)
                {
                    headerThemePicker.SelectedIndex = 2;
                }
            };

            BuildLocalizedApplicationBar();
        }
コード例 #10
0
        public EarlyWarningSetting()
        {
            InitializeComponent();
            SettingViewModel vm = new SettingViewModel();

            this.DataContext = vm;
        }
コード例 #11
0
 /// <summary>
 /// Provides a deterministic way to create the Main property.
 /// </summary>
 public static void CreateSetting()
 {
     if (_setting == null)
     {
         _setting = new SettingViewModel();
     }
 }
コード例 #12
0
        public IActionResult Settings(SettingViewModel settingViewModel)
        {
            SettingDataModel settingDataModel = applicationContext.Settings.FirstOrDefault(o => o.Id == 1);

            if (ModelState.IsValid)
            {
                if (!(settingViewModel.Logo == null || settingViewModel.Logo.Length <= 0))
                {
                    using (var memoryStream = new MemoryStream())
                    {
                        settingViewModel.Logo.CopyTo(memoryStream);
                        settingDataModel.Logo = memoryStream.ToArray();
                    }
                }

                if (!(settingViewModel.Background == null || settingViewModel.Background.Length <= 0))
                {
                    System.IO.File.Delete(".//wwwroot//images//Background.png");
                    using (var fileStream = new FileStream(".//wwwroot//images//Background.png", FileMode.Create))
                    {
                        settingViewModel.Background.CopyTo(fileStream);
                    }
                }

                settingDataModel.Title = settingViewModel.Title;

                this.applicationContext.Update(settingDataModel);
                this.applicationContext.SaveChanges();
            }

            ViewBag.LogoToBytes = settingDataModel.Logo;

            return(View(settingViewModel));
        }
コード例 #13
0
        public async Task <IActionResult> Put([FromBody] SettingViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (!model.Languages.Any())
                {
                    return(BadRequest("Languages is empty"));
                }

                var setting = await _settingService.UpdateSettingAsync(model);

                if (setting == null)
                {
                    return(StatusCode(404, "Setting was not found"));
                }

                return(Ok(setting));
            }
            catch (Exception ex)
            {
                _logger.LogError("Failed to execute PUT");
                return(StatusCode(500, ex.Message));
            }
        }
コード例 #14
0
        public SettingPage()
        {
            InitializeComponent();
            BindingContext = new SettingViewModel();

            (BindingContext as SettingViewModel).GoToPage += (sender, arg) => { this.GoToPage(arg); };
        }
コード例 #15
0
        public string GetServices(SettingViewModel model)
        {
            var    data     = _setting_Service.GetSettings(model.Page);
            string jsonData = JsonConvert.SerializeObject(data);

            return(jsonData);
        }
コード例 #16
0
        public static SettingViewModel CreateSettingViewModel(User user, PropertyChangedEventHandler callback)
        {
            SettingViewModel settingViewModel = new SettingViewModel(user);

            settingViewModel.PropertyChanged += callback;
            return(settingViewModel);
        }
コード例 #17
0
        public IActionResult Settings(SettingViewModel settingViewModel)
        {
            SettingDataModel settingDataModel = applicationDbContext.Settings.FirstOrDefault(o => o.Id == 1);

            if (ModelState.IsValid)
            {
                if (!(settingViewModel.Logo == null || settingViewModel.Logo.Length <= 0))
                {
                    using (var memoryStream = new MemoryStream())
                    {
                        settingViewModel.Logo.CopyTo(memoryStream);
                        settingDataModel.Logo = memoryStream.ToArray();
                    }
                }

                settingDataModel.Title = settingViewModel.Title;

                this.applicationDbContext.Update(settingDataModel);
                this.applicationDbContext.SaveChanges();
            }

            ViewBag.LogoToBytes = settingDataModel.Logo;

            return(View(settingViewModel));
        }
コード例 #18
0
        public async Task <IActionResult> Edit(SettingViewModel model)
        {
            //if (!HasPermission("EDIT_SETTINGS"))
            //{
            //    return Unauthorized();
            //}

            if (ModelState.IsValid)
            {
                var setting = await _context.Settings.SingleAsync(m => m.Name == model.Name);

                if (setting == null)
                {
                    return(NotFound());
                }

                setting = model.UpdateEntity(setting);

                _context.Update(setting);

                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
コード例 #19
0
        public async Task <IActionResult> Data(SettingViewModel viewModel)
        {
            #region Login Information
            LoginInit(Constants.Rights.System, (int)ERights.Add);
            if (!(bool)ViewData[Constants.ActionViews.IsLogin])
            {
                await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);

                return(RedirectToAction(Constants.ActionViews.Login, Constants.Controllers.Account));
            }
            #endregion

            var entity = viewModel.Setting;

            if (string.IsNullOrEmpty(entity.Id))
            {
                dbContext.Settings.InsertOne(entity);
            }
            else
            {
                var builder = Builders <Setting> .Filter;
                var filter  = builder.Eq(m => m.Id, entity.Id);
                var update  = Builders <Setting> .Update
                              .Set(m => m.Key, entity.Key)
                              .Set(m => m.Domain, entity.Domain)
                              .Set(m => m.Value, entity.Value)
                              .Set(m => m.IsCode, entity.IsCode)
                              .Set(m => m.Type, entity.Type)
                              .Set(m => m.Enable, entity.Enable);

                dbContext.Settings.UpdateOne(filter, update);
            }

            return(Redirect("/setting"));
        }
コード例 #20
0
        public async Task <IActionResult> Settings(SettingViewModel settingViewModel)
        {
            if (ModelState.IsValid)
            {
                if (!(settingViewModel.Logo == null || settingViewModel.Logo.Length <= 0))
                {
                    await this.blogOptionService.SetLogo(settingViewModel.Logo.ToByteArray());
                }

                if (!(settingViewModel.Background == null || settingViewModel.Background.Length <= 0))
                {
                    System.IO.File.Delete(".//wwwroot//images//Background.png");
                    using (var fileStream = new FileStream(".//wwwroot//images//Background.png", FileMode.Create))
                    {
                        settingViewModel.Background.CopyTo(fileStream);
                    }
                }

                await this.blogOptionService.SetTitle(settingViewModel.Title);
            }

            ViewBag.LogoToBytes = await this.blogOptionService.GetLogo();

            return(View(settingViewModel));
        }
コード例 #21
0
 public ActionResult AddOrEdit(SettingViewModel sm)
 {
     using (ELaundryDBEntities db = new ELaundryDBEntities())
     {
         if (sm.SettingId == 0)
         {
             tblSetting tb = new tblSetting();
             tb.DiscountRate = sm.DiscountRate;
             tb.Description  = sm.Description;
             tb.IsActive     = sm.IsActive;
             db.tblSettings.Add(tb);
             db.SaveChanges();
             return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             tblSetting tbm = db.tblSettings.Where(m => m.SettingId == sm.SettingId).FirstOrDefault();
             tbm.DiscountRate = sm.DiscountRate;
             tbm.Description  = sm.Description;
             tbm.IsActive     = sm.IsActive;
             db.SaveChanges();
             return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
 }
コード例 #22
0
        public override bool?GetCurrentValue(SettingViewModel <bool?> setting)
        {
            setting.MessageBar = null;

            try
            {
                var startupValue = Registry.GetValue(CurrentUserRegisteryKey + StartupRegisteryKey, appInfo.Name, null);

                if (!string.IsNullOrEmpty(startupValue as string))
                {
                    //check for windows 10 disable
                    var disableValue = Registry.GetValue(CurrentUserRegisteryKey + DisabledRegisteryKey, appInfo.Name, null);

                    if (disableValue is byte[] castedDisabledRun && castedDisabledRun[0] != 2)
                    {
                        setting.MessageBar = new MessageBarViewModel(MessageBarType.Information, MessageBarLevel.Low, "Disabled in TaskManager");
                        return(null);
                    }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                setting.MessageBar = new MessageBarViewModel(MessageBarType.Error, MessageBarLevel.Medium, $"Could not get current state :( \n {ex.Message}");
                return(null);
            }
        }
コード例 #23
0
        //dependency injection container
        protected override void OnStartup(StartupEventArgs e)
        {
            // dependenies
            FrameSourceService frameSourceService = new FrameSourceService();
            InvokerService     invokerService     = new InvokerService();
            AuthService        authService        = new AuthService();

            // viewModels
            MainViewModel        mainViewModel        = new MainViewModel(frameSourceService, invokerService);
            HomeViewModel        homeViewModel        = new HomeViewModel(frameSourceService, invokerService);
            LoginViewModel       loginViewModel       = new LoginViewModel(frameSourceService, invokerService, authService);
            RegisterViewModel    registerViewModel    = new RegisterViewModel(frameSourceService, invokerService, authService);
            SettingViewModel     settingViewModel     = new SettingViewModel(frameSourceService, invokerService, authService);
            GalleryViewModel     galleryViewModel     = new GalleryViewModel(frameSourceService, invokerService, authService);
            TaskManagerViewModel taskManagerViewModel = new TaskManagerViewModel(frameSourceService, invokerService, authService);
            ManagerPassViewModel managerPassViewModel = new ManagerPassViewModel(frameSourceService, invokerService, authService);

            // singleton
            ViewModelContainer.Init(mainViewModel, homeViewModel, loginViewModel, registerViewModel,
                                    settingViewModel, galleryViewModel, taskManagerViewModel, managerPassViewModel);

            invokerService.Invoke <MainViewModel>(new InitializationViewModel());

            base.OnStartup(e);
        }
コード例 #24
0
        public ActionResult EditSample(RollerSampleInfo rollersampleinfo)
        {
            if (ModelState.IsValid)
            {
                rollersampleinfo.State = "准备";
                TestSampleInfo.GetInstance().AddTestSample(rollersampleinfo);
                repository.SaveRollerSampleInfo(rollersampleinfo);
                //同步中间数据库
                Entities context = new Entities();
                context.PROCEDURE_ROLLERSAMPLEINFO(0);
                context.SaveChanges();

                RollerSampleInfo rsi = repository.RollerSampleInfos.Include(x => x.RollerBaseStation).Include(x => x.RollerBaseStation.TimerCfg).Include(x => x.RollerBaseStation.ForcerCfg).FirstOrDefault(x => x.RollerSampleInfoID == rollersampleinfo.RollerSampleInfoID);
                TestSampleInfo.GetInstance().EditSampleList(rsi);
                return(RedirectToAction("ViewInfo", new { RollerProjectInfoID = rollersampleinfo.RollerProjectInfoID }));
            }
            else
            {
                SettingViewModel settingviewModel = new SettingViewModel(baserepository, wtequipmentrepo, wtsampleinfo);
                int TestID = projectrepo.RollerProjectInfos.FirstOrDefault(x => x.RollerProjectInfoID == rollersampleinfo.RollerProjectInfoID).TestID;
                ViewData["Device"]       = settingviewModel.GetLISDeviceList();
                ViewData["StationList"]  = settingviewModel.GetStationList();
                ViewData["SampleIDList"] = settingviewModel.GetSampleIDList(TestID);
                ViewData["TestTypeList"] = settingviewModel.GetTestTypeList();
                return(View(rollersampleinfo));
            }
        }
コード例 #25
0
        public async Task <ActionResult> UpdateTheme(SettingViewModel sModel)
        {
            try
            {
                var model = sModel.ThemeSetting;
                if (!ModelState.IsValid)
                {
                    return(Json(new AjaxResult(ModelState.JoinMessages())));
                }

                var result = await _userService.SetThemeSetting(model);

                if (result.NotFound)
                {
                    return(Json(new AjaxResult("تنظیمات یافت نشد.")));
                }
                if (result.Succeeded)
                {
                    return(Json(new AjaxResult(true, "اطلاعات با موفقیت ذخیره گردید.")));
                }

                return(Json(new AjaxResult(result.State.Errors.JoinMessages())));
            }
            catch (Exception e)
            {
                return(Json(new AjaxResult(e.JoinMessages())));
            }
        }
コード例 #26
0
        public IActionResult Index(SettingViewModel settingVM)
        {
            if (ModelState.IsValid)
            {
                var headerScript = settingService.GetSettingByName("HeaderScript");
                headerScript.Value = settingVM.HeaderScript;
                settingService.UpdateSetting(headerScript);

                var googleAnalytics = settingService.GetSettingByName("GoogleAnalytics");
                googleAnalytics.Value = settingVM.GoogleAnalytics;
                settingService.UpdateSetting(googleAnalytics);

                var footerScript = settingService.GetSettingByName("FooterScript");
                footerScript.Value = settingVM.FooterScript;
                settingService.UpdateSetting(footerScript);

                var mapLat = settingService.GetSettingByName("MapLat");
                mapLat.Value = settingVM.MapLat;
                settingService.UpdateSetting(mapLat);

                var mapLon = settingService.GetSettingByName("MapLon");
                mapLon.Value = settingVM.MapLon;
                settingService.UpdateSetting(mapLon);

                settingService.SaveSetting();
                return(RedirectToAction("Index"));
            }
            return(RedirectToAction("Index"));
        }
コード例 #27
0
        public ActionResult Index()
        {
            ViewBag.Title = "Cài đặt";
            var model = new SettingViewModel();

            return(View(model));
        }
コード例 #28
0
ファイル: Setting.xaml.cs プロジェクト: yandongquan123/BPMSV1
 public Setting()
 {
     InitializeComponent();
     vm = new SettingViewModel();
     this.DataContext = vm;
     this.lstboxLeftMenu.SelectionChanged += lstboxLeftMenu_SelectionChanged;
 }
コード例 #29
0
        public async Task <ActionResult> Edit(SettingViewModel model)
        {
            var timeStart = TimeSpan.Parse(model.AppointmentStartTimeString);

            model.AppointmentStartTime = (int)timeStart.TotalMinutes;

            var timeEnd = TimeSpan.Parse(model.AppointmentEndTimeString);

            model.AppointmentEndTime = (int)timeEnd.TotalMinutes;

            if (ModelState.IsValid)
            {
                //Call API Provider
                var strUrl = APIProvider.APIGenerator(controllerName, APIConstant.ACTION_UPDATE);
                var result = await APIProvider.Authorize_DynamicTransaction <SettingViewModel, bool>(model, _userSession.BearerToken, strUrl, APIConstant.API_Resource_CORE, ARS.Edit);

                if (result)
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.TypeResult.SUCCESS, ApplicationGenerator.GeneralActionMessage(APIConstant.ACTION_UPDATE, ApplicationGenerator.TypeResult.SUCCESS));
                }
                else
                {
                    TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.TypeResult.FAIL, ApplicationGenerator.GeneralActionMessage(APIConstant.ACTION_UPDATE, ApplicationGenerator.TypeResult.FAIL));
                }
            }
            else
            {
                TempData["Alert"] = ApplicationGenerator.RenderResult(ApplicationGenerator.TypeResult.ERROR, ApplicationGenerator.GeneralActionMessage(APIConstant.ACTION_UPDATE, ApplicationGenerator.TypeResult.ERROR));
            }
            return(RedirectToAction("Index"));
        }
コード例 #30
0
        /* ----------------------------------------------------------------- */
        ///
        /// Set
        ///
        /// <summary>
        /// ViewModel に設定内容を反映させます。
        /// </summary>
        ///
        /// <remarks>
        /// 一部の値は無効化されます。
        /// </remarks>
        ///
        /* ----------------------------------------------------------------- */
        private void Set(SettingViewModel vm, SettingValue src)
        {
            vm.Language          = src.Language;
            vm.Format            = src.Format;
            vm.SaveOption        = src.SaveOption;
            vm.Resolution        = src.Resolution;
            vm.Grayscale         = src.Grayscale;
            vm.ImageFilter       = src.ImageFilter;
            vm.IsAutoOrientation = src.Orientation == Orientation.Auto;
            vm.IsLandscape       = src.Orientation == Orientation.Landscape;
            vm.IsPortrait        = src.Orientation == Orientation.Portrait;
            vm.Linearization     = src.Linearization;
            vm.PostProcess       = src.PostProcess;
            vm.UserProgram       = src.UserProgram;
            vm.CheckUpdate       = src.CheckUpdate;

            // see remarks
            // vm.Source         = src.Source;
            // vm.Destination    = src.Destination;

            vm.PostProcess = src.PostProcess != PostProcess.Open &&
                             src.PostProcess != PostProcess.OpenDirectory ?
                             src.PostProcess :
                             PostProcess.None;
        }
コード例 #31
0
ファイル: App.xaml.cs プロジェクト: NPadrutt/Places
        /// <summary>
        /// Constructor for the Application object.
        /// </summary>
        public App()
        {
            BugSenseHandler.Instance.InitAndStartSession(new ExceptionManager(Current), RootFrame, "7cbded60");
            #if DEBUG
            BugSenseHandler.Instance.HandleWhileDebugging = false;
            #endif

            // Global handler for uncaught exceptions.
            UnhandledException += Application_UnhandledException;

            // Standard Silverlight initialization
            InitializeComponent();

            // Phone-specific initialization
            InitializePhoneApplication();

            // Show graphics profiling information while debugging.
            if (Debugger.IsAttached)
            {
                // Display the current frame rate counters.
                Current.Host.Settings.EnableFrameRateCounter = false;

                // Show the areas of the app that are being redrawn in each frame.
                //Application.Current.Host.Settings.EnableRedrawRegions = true;

                // Enable non-production analysis visualization mode,
                // which shows areas of a page that are being GPU accelerated with a colored overlay.
                //Application.Current.Host.Settings.EnableCacheVisualization = true;

                // Disable the application idle detection by setting the UserIdleDetectionMode property of the
                // application's PhoneApplicationService object to Disabled.
                // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run
                // and consume battery power when the user is not using the phone.
                PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
            }
            viewModel = new MainViewModel();
            viewModel.LoadTags();

            settings = new SettingViewModel();

            Action actionGetPosition = () => Deployment.Current.Dispatcher.BeginInvoke(() => Utilities.GetPosition(PositionAccuracy.Default, 4));
            Task.Factory.StartNew(actionGetPosition, TaskCreationOptions.LongRunning);
        }
コード例 #32
0
        public ActionResult Settings()
        {
            var fbAccount = DbContext.FbAccounts
                                      .Include("Settings")
                                      .Include("Settings.TestRailConfig")
                                      .Single(a => a.Id == UserContext.FbAccountId);
            FbAccountSettings fbAccountSettings;

            if (fbAccount == null)
                fbAccountSettings = new FbAccountSettings();
            else
                fbAccountSettings = fbAccount.Settings;

            var viewModel = new SettingViewModel();

            viewModel.Setup();

            MapSettingsViewModel(viewModel, fbAccountSettings);

            return View("Update", viewModel);
        }
コード例 #33
0
        private void MapSettingsEntity(FbAccountSettings entity, SettingViewModel viewModel)
        {
            entity.Id = viewModel.Id;
            entity.ResolvedVerifiedStatusId = viewModel.ResolvedVerifiedStatusId;
            entity.AllowSubProjects = viewModel.AllowSubProjects;
            entity.QaPercentage = viewModel.QaPercentage ?? 0;
            entity.AllowTestRail = viewModel.AllowTestRail;
            entity.SendDailyDigestEmails = viewModel.AllowSendDailyDigestEmails;

            if (entity.SendDailyDigestEmails)
            {
                entity.SendDailyDigestEmailsTo = viewModel.SendDailyDigestEmailsTo;
                entity.Guid = Guid.NewGuid();
            }
            else
            {
                entity.SendDailyDigestEmailsTo = String.Empty;
                entity.Guid = null;
            }

            if (entity.AllowTestRail)
            {
                if(entity.TestRailConfig == null)
                    entity.TestRailConfig = new TestRailConfiguration();

                entity.TestRailConfig.Url = viewModel.TestRailUrl;
                entity.TestRailConfig.Token = viewModel.TestRailToken;
            }
            entity.SubProjectTag = viewModel.SubProjectTag;

            entity.AllowQaEstimates = viewModel.AllowQaEstimates;
            entity.QaEstimateCustomFieldName = viewModel.QaEstimateCustomFieldname;
        }
コード例 #34
0
        public ActionResult Settings(SettingViewModel viewModel)
        {
            viewModel.Setup();

            if (!ModelState.IsValid)
            {
                return View("Update", viewModel);
            }

            var fbAccount = DbContext.FbAccounts
                                    .Include("Settings")
                                    .Include("Settings.TestRailConfig")
                                    .SingleOrDefault(s => s.Id == viewModel.Id);

            FbAccountSettings fbAccountSettings;

            if (fbAccount == null)
                fbAccountSettings = new FbAccountSettings();
            else
                fbAccountSettings = fbAccount.Settings;

            //refresh cache when qa estimate settings changed
            if (fbAccountSettings.AllowQaEstimates != viewModel.AllowQaEstimates
                || fbAccountSettings.QaEstimateCustomFieldName != viewModel.QaEstimateCustomFieldname
                || fbAccountSettings.QaPercentage != viewModel.QaPercentage)
            {
                CleareCachedCaseSets();
            }

            MapSettingsEntity(fbAccountSettings, viewModel);

            var service = new FbAccountService();

            if (fbAccount != null && fbAccount.Settings != null)
            {
                if (fbAccount.Settings.SendDailyDigestEmails)
                {
                    string cacheKeyToken = MsCacheKey.Gen(MsCacheDataType.FogBugz_ClientByFogBugzUrl, UserContext.FogBugzUrl);
                    object fbClientObject = null;
                    MsCache.TryGet(cacheKeyToken, ref fbClientObject);
                    var fbClient = (FogBugzClientEx) fbClientObject;
                    fbAccount.Token = fbClient.GetToken();
                }
                else
                {
                    fbAccount.Token = String.Empty;
                }
            }

            // save settings in db
            service.Update(fbAccount);

            var cacheKey = MsCacheKey.Gen(MsCacheDataType.ProjectLists, UserContext.FogBugzUrl);
            MsCache.TryRemove(cacheKey);

            cacheKey = MsCacheKey.Gen(MsCacheDataType.FogBugz_ClientCacheByFogBugzUrl, UserContext.FogBugzUrl);
            MsCache.TryRemove(cacheKey);

            UserContext.SetNotification(PageNotificationType.Success, "Settings have been updated.");

            return RedirectToAction("Settings");
        }
コード例 #35
0
        private void MapSettingsViewModel(SettingViewModel viewModel, FbAccountSettings fbAccountSettings)
        {
            viewModel.Id = fbAccountSettings.Id;
            viewModel.ResolvedVerifiedStatusId = fbAccountSettings.ResolvedVerifiedStatusId;
            viewModel.AllowSubProjects = fbAccountSettings.AllowSubProjects;
            viewModel.QaPercentage = fbAccountSettings.QaPercentage;
            viewModel.AllowTestRail = fbAccountSettings.AllowTestRail;
            viewModel.AllowSendDailyDigestEmails = fbAccountSettings.SendDailyDigestEmails;

            if (fbAccountSettings.SendDailyDigestEmails)
            {
                viewModel.SendDailyDigestEmailsTo = fbAccountSettings.SendDailyDigestEmailsTo;
            }

            if (fbAccountSettings.TestRailConfig != null)
            {
                viewModel.TestRailUrl = fbAccountSettings.TestRailConfig.Url;
                viewModel.TestRailToken = fbAccountSettings.TestRailConfig.Token;
            }

            viewModel.SubProjectTag = fbAccountSettings.SubProjectTag;

            viewModel.AllowQaEstimates = fbAccountSettings.AllowQaEstimates;
            viewModel.QaEstimateCustomFieldname = fbAccountSettings.QaEstimateCustomFieldName;
        }