Пример #1
0
        public ProfileEditorViewModel(ProfileModule module,
                                      ICollection <ProfileEditorPanelViewModel> viewModels,
                                      IProfileEditorService profileEditorService,
                                      IProfileService profileService,
                                      IDialogService dialogService,
                                      ISettingsService settingsService)
        {
            _profileEditorService = profileEditorService;
            _profileService       = profileService;
            _settingsService      = settingsService;

            DisplayName   = "Profile editor";
            Module        = module;
            DialogService = dialogService;

            DisplayConditionsViewModel = (DisplayConditionsViewModel)viewModels.First(vm => vm is DisplayConditionsViewModel);
            LayerPropertiesViewModel   = (LayerPropertiesViewModel)viewModels.First(vm => vm is LayerPropertiesViewModel);
            ProfileTreeViewModel       = (ProfileTreeViewModel)viewModels.First(vm => vm is ProfileTreeViewModel);
            ProfileViewModel           = (ProfileViewModel)viewModels.First(vm => vm is ProfileViewModel);
            Profiles = new BindableCollection <Profile>();

            Items.AddRange(viewModels);

            module.ActiveProfileChanged += ModuleOnActiveProfileChanged;
        }
Пример #2
0
        private void _Click(object sender, RoutedEventArgs e)
        {
            var tag = (e.OriginalSource as Button)?.Tag as string;

            if (tag == null)
            {
                return;
            }
            if (tag == "apply")
            {
                ProfileModule.SetProfile(uiNameBox.Text, uiSignBox.Text);
            }
            else if (tag == "image")
            {
                var ofd = new System.Windows.Forms.OpenFileDialog()
                {
                    Filter = "位图文件|*.bmp;*.png;*.jpg"
                };
                if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }
                try
                {
                    ProfileModule.SetImage(ofd.FileName);
                }
                catch (Exception ex)
                {
                    Entrance.ShowError("设置头像失败!", ex);
                    Log.Error(ex);
                }
            }
        }
        public ProfileEditorViewModel(ProfileModule module,
                                      ProfileViewModel profileViewModel,
                                      ProfileTreeViewModel profileTreeViewModel,
                                      DisplayConditionsViewModel dataModelConditionsViewModel,
                                      LayerPropertiesViewModel layerPropertiesViewModel,
                                      IProfileEditorService profileEditorService,
                                      IProfileService profileService,
                                      IDialogService dialogService,
                                      ISettingsService settingsService,
                                      IModuleService moduleService,
                                      ISnackbarMessageQueue snackbarMessageQueue)
        {
            _profileEditorService = profileEditorService;
            _profileService       = profileService;
            _settingsService      = settingsService;
            _moduleService        = moduleService;
            _snackbarMessageQueue = snackbarMessageQueue;

            DisplayName   = "PROFILE EDITOR";
            Module        = module;
            DialogService = dialogService;

            Profiles = new BindableCollection <ProfileDescriptor>();

            // Populate the panels
            ProfileViewModel           = profileViewModel;
            ProfileTreeViewModel       = profileTreeViewModel;
            DisplayConditionsViewModel = dataModelConditionsViewModel;
            LayerPropertiesViewModel   = layerPropertiesViewModel;

            Items.Add(ProfileViewModel);
            Items.Add(ProfileTreeViewModel);
            Items.Add(dataModelConditionsViewModel);
            Items.Add(LayerPropertiesViewModel);
        }
Пример #4
0
        private void _Click(object sender, RoutedEventArgs e)
        {
            var tag = (e.OriginalSource as Button)?.Tag as string;

            if (tag == null)
            {
                return;
            }
            if (tag == "exit")
            {
                LinkModule.Shutdown();
                Application.Current.MainWindow.Close();
            }
            else if (tag == "out")
            {
                var mai = Application.Current.MainWindow as Entrance;
                if (mai == null)
                {
                    return;
                }
                LinkModule.Shutdown();
                ProfileModule.Shutdown();
                mai.frame.Navigate(new Connection());
            }
        }
Пример #5
0
        public ProfileImportViewModel(ProfileModule profileModule, IProfileService profileService, IMessageService messageService)
        {
            ProfileModule = profileModule;

            _profileService = profileService;
            _messageService = messageService;
        }
Пример #6
0
        public ActionResult ContactMe(ProfileModule profilemodule)
        {
            if (ModelState.IsValid)
            {
                var body    = "<p>Email From: {0} ({1})</p><p>Message:</p><p>{2}</p>";
                var message = new MailMessage();
                message.To.Add(new MailAddress("*****@*****.**"));          // your email address
                message.From       = new MailAddress(profilemodule.ContactEmail); // sender email address
                message.Subject    = "Email from my online Resume";
                message.Body       = string.Format(body, profilemodule.ContactName, profilemodule.ContactEmail, profilemodule.ContactComment);
                message.IsBodyHtml = true;

                using (var smtp = new SmtpClient())
                {
                    var credential = new NetworkCredential
                    {
                        UserName = "******", // email id
                        Password = "******"           // password
                    };
                    smtp.Credentials = credential;
                    smtp.Host        = "smtp-mail.outlook.com";
                    smtp.Port        = 587;
                    smtp.EnableSsl   = true;
                    smtp.Send(message);
                    //return RedirectToAction("Sent");
                    ViewBag.Message = OnlineResumeRes.Emailhassend; //"Your message has been sent";
                    return((ActionResult)this.RedirectToAction("Index", "Home"));
                }
            }

            return(View(profilemodule));
        }
Пример #7
0
        public ProfileEditorViewModel(ProfileModule module,
                                      ProfileViewModel profileViewModel,
                                      ProfileTreeViewModel profileTreeViewModel,
                                      DisplayConditionsViewModel dataModelConditionsViewModel,
                                      LayerPropertiesViewModel layerPropertiesViewModel,
                                      IProfileEditorService profileEditorService,
                                      IProfileService profileService,
                                      IDialogService dialogService,
                                      ISettingsService settingsService,
                                      IModuleService moduleService,
                                      IMessageService messageService)
        {
            _profileEditorService = profileEditorService;
            _profileService       = profileService;
            _settingsService      = settingsService;
            _moduleService        = moduleService;
            _messageService       = messageService;

            DisplayName   = "PROFILE EDITOR";
            Module        = module;
            DialogService = dialogService;

            Profiles = new BindableCollection <ProfileDescriptor>();

            // Populate the panels
            ProfileViewModel = profileViewModel;
            ProfileViewModel.ConductWith(this);
            ProfileTreeViewModel = profileTreeViewModel;
            ProfileTreeViewModel.ConductWith(this);
            DisplayConditionsViewModel = dataModelConditionsViewModel;
            DisplayConditionsViewModel.ConductWith(this);
            LayerPropertiesViewModel = layerPropertiesViewModel;
            LayerPropertiesViewModel.ConductWith(this);
        }
        internal DataModelJsonPluginEndPoint(ProfileModule <T> profileModule, string name, PluginsModule pluginsModule) : base(profileModule, name, pluginsModule)
        {
            _profileModule = profileModule ?? throw new ArgumentNullException(nameof(profileModule));

            ThrowOnFail = true;
            Accepts     = MimeType.Json;
        }
        public ProfileImportViewModel(ProfileModule profileModule, IProfileService profileService, ISnackbarMessageQueue mainMessageQueue)
        {
            ProfileModule = profileModule;
            Document      = new TextDocument();

            _profileService   = profileService;
            _mainMessageQueue = mainMessageQueue;
        }
Пример #10
0
        public ProfileImportViewModel(ProfileModule profileModule, IProfileService profileService, IMessageService messageService)
        {
            ProfileModule = profileModule;
            Document      = new TextDocument();

            _profileService = profileService;
            _messageService = messageService;
        }
Пример #11
0
        internal ProfileDescriptor(ProfileModule profileModule, ProfileEntity profileEntity)
        {
            ProfileModule = profileModule;

            Id   = profileEntity.Id;
            Name = profileEntity.Name;
            IsLastActiveProfile = profileEntity.IsActive;
        }
Пример #12
0
        public async Task ActivateLastProfileAnimated(ProfileModule profileModule)
        {
            ProfileDescriptor activeProfile = GetLastActiveProfile(profileModule);

            if (activeProfile != null)
            {
                await ActivateProfileAnimated(activeProfile);
            }
        }
Пример #13
0
        public void ActivateLastProfile(ProfileModule profileModule)
        {
            ProfileDescriptor activeProfile = GetLastActiveProfile(profileModule);

            if (activeProfile != null)
            {
                ActivateProfile(activeProfile);
            }
        }
Пример #14
0
 public void ActivateProfile(ProfileModule module, Profile profile)
 {
     module.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
     if (profile != null)
     {
         InstantiateProfileLayerBrushes(profile);
         InstantiateProfileKeyframeEngines(profile);
     }
 }
Пример #15
0
        public ProfileDescriptor CreateProfileDescriptor(ProfileModule module, string name)
        {
            ProfileEntity profileEntity = new ProfileEntity {
                Id = Guid.NewGuid(), Name = name, PluginGuid = module.PluginInfo.Guid
            };

            _profileRepository.Add(profileEntity);

            return(new ProfileDescriptor(module, profileEntity));
        }
Пример #16
0
        public ProfileDescriptor ImportProfile(string json, ProfileModule profileModule)
        {
            ProfileEntity profileEntity = JsonConvert.DeserializeObject <ProfileEntity>(json, ExportSettings);

            // Assign a new GUID to make sure it is unique in case of a previous import of the same content
            profileEntity.UpdateGuid(Guid.NewGuid());
            profileEntity.Name = $"{profileEntity.Name} - Imported";

            _profileRepository.Add(profileEntity);
            return(new ProfileDescriptor(profileModule, profileEntity));
        }
Пример #17
0
        internal Profile(ProfileModule module, ProfileEntity profileEntity)
        {
            Profile       = this;
            ProfileEntity = profileEntity;
            EntityId      = profileEntity.Id;

            Module    = module;
            UndoStack = new Stack <string>();
            RedoStack = new Stack <string>();

            Load();
        }
Пример #18
0
        private void _SendText()
        {
            var str = uiInputBox.Text.TrimEnd(new char[] { '\0', '\r', '\n', '\t', ' ' });

            if (str.Length < 1)
            {
                return;
            }
            uiInputBox.Text = string.Empty;
            PostModule.Text(_profile.Id, str);
            ProfileModule.SetRecent(_profile);
        }
Пример #19
0
        public static void _ListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var lst = e.AddedItems;

            if (lst.Count < 1)
            {
                return;
            }
            var itm = lst[0] as Profile;

            ProfileModule.SetInscope(itm);
        }
Пример #20
0
        public ProfileDescriptor GetLastActiveProfile(ProfileModule module)
        {
            List <ProfileEntity> moduleProfiles = _profileRepository.GetByPluginGuid(module.PluginInfo.Guid);

            if (!moduleProfiles.Any())
            {
                return(CreateProfileDescriptor(module, "Default"));
            }

            ProfileEntity profileEntity = moduleProfiles.FirstOrDefault(p => p.IsActive) ?? moduleProfiles.FirstOrDefault();

            return(profileEntity == null ? null : new ProfileDescriptor(module, profileEntity));
        }
Пример #21
0
        public Profile CreateProfile(ProfileModule module, string name)
        {
            var profile = new Profile(module.PluginInfo, name);

            _profileRepository.Add(profile.ProfileEntity);

            if (_surfaceService.ActiveSurface != null)
            {
                profile.PopulateLeds(_surfaceService.ActiveSurface);
            }

            return(profile);
        }
Пример #22
0
        public DataModelJsonPluginEndPoint <T> AddDataModelJsonEndPoint <T>(ProfileModule <T> profileModule, string endPointName) where T : DataModel
        {
            if (profileModule == null)
            {
                throw new ArgumentNullException(nameof(profileModule));
            }
            if (endPointName == null)
            {
                throw new ArgumentNullException(nameof(endPointName));
            }
            DataModelJsonPluginEndPoint <T> endPoint = new(profileModule, endPointName, PluginsModule);

            PluginsModule.AddPluginEndPoint(endPoint);
            return(endPoint);
        }
Пример #23
0
        private void SaveActiveProfile(ProfileModule module)
        {
            if (module.ActiveProfile == null)
            {
                return;
            }

            List <ProfileEntity> profileEntities = _profileRepository.GetByPluginGuid(module.PluginInfo.Guid);

            foreach (ProfileEntity profileEntity in profileEntities)
            {
                profileEntity.IsActive = module.ActiveProfile.EntityId == profileEntity.Id;
                _profileRepository.Save(profileEntity);
            }
        }
Пример #24
0
        internal Profile(ProfileModule module, string name)
        {
            ProfileEntity = new ProfileEntity();
            EntityId      = Guid.NewGuid();

            Profile   = this;
            Module    = module;
            Name      = name;
            UndoStack = new Stack <string>();
            RedoStack = new Stack <string>();

            Folder _ = new Folder(this, "Root folder");

            Save();
        }
Пример #25
0
        public void RedoUpdateProfile(Profile profile, ProfileModule module)
        {
            if (!profile.RedoStack.Any())
            {
                return;
            }

            ActivateProfile(module, null);
            var top     = profile.RedoStack.Pop();
            var memento = JsonConvert.SerializeObject(profile.ProfileEntity);

            profile.UndoStack.Push(memento);
            profile.ProfileEntity = JsonConvert.DeserializeObject <ProfileEntity>(top);
            profile.ApplyToProfile();
            ActivateProfile(module, profile);
        }
Пример #26
0
        public void InitializeHttpEvents(HttpApplication application)
        {
            SannsynConfiguration sannsynConfiguration = ServiceLocator.Current.GetInstance <SannsynConfiguration>();

            if (sannsynConfiguration.ModuleEnabled)
            {
                for (int i = 0; i < application.Modules.Count; i++)
                {
                    ProfileModule module = application.Modules[i] as ProfileModule;
                    if (module != null)
                    {
                        module.MigrateAnonymous += OnMigrateAnonymous;
                        _log.Debug("Initializing Anonymous Migration Module");
                    }
                }
            }
        }
Пример #27
0
        public Profile GetActiveProfile(ProfileModule module)
        {
            if (module.ActiveProfile != null)
            {
                return(module.ActiveProfile);
            }

            var moduleProfiles = _profileRepository.GetByPluginGuid(module.PluginInfo.Guid);
            var profileEntity  = moduleProfiles.FirstOrDefault(p => p.IsActive) ?? moduleProfiles.FirstOrDefault();

            if (profileEntity == null)
            {
                return(null);
            }

            return(new Profile(module.PluginInfo, profileEntity));
        }
Пример #28
0
        public void Profile()
        {
            var cid = Data["id"].As <int>();
            var pro = new Profile(cid)
            {
                Name = Data["name"].As <string>(),
                Text = Data["text"].As <string>(),
            };

            var buf = Data["image"].As <byte[]>();

            if (buf.Length > 0)
            {
                pro.Image = CacheModule.SetBuffer(buf, true);
            }
            ProfileModule.Insert(pro);
        }
Пример #29
0
        public List <Profile> GetProfiles(ProfileModule module)
        {
            var profileEntities = _profileRepository.GetByPluginGuid(module.PluginInfo.Guid);
            var profiles        = new List <Profile>();

            foreach (var profileEntity in profileEntities)
            {
                // If the profile entity matches the module's currently active profile, use that instead
                if (module.ActiveProfile != null && module.ActiveProfile.EntityId == profileEntity.Id)
                {
                    profiles.Add(module.ActiveProfile);
                }
                else
                {
                    profiles.Add(new Profile(module.PluginInfo, profileEntity));
                }
            }

            return(profiles);
        }
Пример #30
0
        private void _PushImage()
        {
            var ofd = new OpenFileDialog()
            {
                Filter = "位图文件|*.bmp;*.png;*.jpg"
            };

            if (ofd.ShowDialog() != true)
            {
                return;
            }
            try
            {
                var buf = CacheModule.ImageZoom(ofd.FileName);
                PostModule.Image(_profile.Id, buf);
                ProfileModule.SetRecent(_profile);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                Entrance.ShowError("发送图片失败", ex);
            }
        }
Пример #31
0
 public static void AddModules(int id, List<int> modules)
 {
     try {
         EcommercePlatformDataContext db = new EcommercePlatformDataContext();
         List<ProfileModule> new_mods = new List<ProfileModule>();
         foreach (int m in modules) {
             // Make sure we don't have a record for this user that ties them to the looped module
             ProfileModule pm = db.ProfileModules.Where(x => x.moduleID.Equals(m) && x.profileID.Equals(id)).FirstOrDefault<ProfileModule>();
             if (pm == null) {
                 ProfileModule pm_new = new ProfileModule {
                     moduleID = m,
                     profileID = id
                 };
                 new_mods.Add(pm_new);
             }
         }
         db.ProfileModules.InsertAllOnSubmit<ProfileModule>(new_mods);
         db.SubmitChanges();
     } catch (Exception) {
         throw new Exception();
     }
 }