Esempio n. 1
0
 public void AddOrUpdate(ISite site) {
     var setting = GetSiteSetting();
     if (setting == null) {
         setting = new SiteSetting {
             SiteName = site.SiteName,
             BaseUrl = site.BaseUrl,
             HomePage = site.HomePage,
             Logo = site.Logo,
             CopyRight = site.CopyRight,
             PageSize = site.PageSize,
             SeoDesc = site.SeoDesc,
             SeoKeys = site.SeoKeys,
             SiteSalt = site.SiteSalt,
             SuperUser = site.SuperUser
         };
         _settingRepository.Create((SiteSetting)setting);
     } else {
         setting.SiteName = site.SiteName;
         setting.BaseUrl = site.BaseUrl;
         setting.HomePage = site.HomePage;
         setting.Logo = site.Logo;
         setting.CopyRight = site.CopyRight;
         setting.PageSize = site.PageSize;
         setting.SeoDesc = site.SeoDesc;
         setting.SeoKeys = site.SeoKeys;
         setting.SiteSalt = site.SiteSalt;
         _settingRepository.Update((SiteSetting)setting);
     }
 }
Esempio n. 2
0
        public static string ResolveFileName(string filename, ISite site, bool designMode)
        {
            string fileName = null;
            if (!Path.IsPathRooted(filename))
            {
                // in design mode, resolve url using IUrlResolutionService
                if (designMode)
                {
                    IWebApplication app = (IWebApplication) site.GetService(typeof(IWebApplication));
                    if (app != null)
                    {
                        IProjectItem projectItem = app.GetProjectItemFromUrl(filename);
                        if (projectItem == null)
                            throw new InvalidOperationException("Could not load ProjectItem corresponding to source filename '" + filename + "'.");

                        fileName = projectItem.PhysicalPath;
                    }
                }
                else if (HttpContext.Current != null)
                {
                    fileName = HttpContext.Current.Server.MapPath(filename);
                }

                if (fileName == null)
                    throw new InvalidOperationException("Could not resolve source filename.");
            }
            else
            {
                fileName = filename;
            }

            return fileName;
        }
Esempio n. 3
0
        /// <summary>
        /// Reads a specific forum by the UID
        /// </summary>
        /// <param name="uid">The specific form uid</param>
        /// <returns>The specified forum including comment data</returns>
        public RatingForum RatingForumReadByUIDAndUserList(string uid, ISite site, int[] userIds)
        {
            RatingForum RatingForum = null;
            using (var reader = CreateReader("RatingForumreadbyuid"))
            {

                try
                {
                    reader.AddParameter("uid", uid);
                    reader.AddParameter("siteid", site.SiteID);
                    reader.Execute();

                    if (reader.HasRows && reader.Read())
                    {
                        RatingForum = RatingForumCreateFromReader(reader);
                        RatingForum.identityPolicy = site.IdentityPolicy;
                        RatingForum = RatingsReadByUserIDs(RatingForum, site, userIds);
                    }
                }
                catch(ApiException apiException)
                {
                    throw apiException;
                }
                catch (Exception ex)
                {
                    throw new ApiException(ex.Message, ex.InnerException);
                    //DnaApiWebProtocalException.ThrowDnaApiWebProtocalException(System.Net.HttpStatusCode.InternalServerError, ex.Message, ex);
                }
            }
            return RatingForum;
        }
Esempio n. 4
0
 //конструктор - принимает пару Название-Автор
 public BookComponent(string Title, string Author)
 {
     m_curISBNSite = null;
       Disposed = null;
       m_bookTitle = Title;
       m_bookAuthor = Author;
 }
Esempio n. 5
0
 /// <summary>
 /// 从站点领域对象转换成为数据传输对象
 /// </summary>
 /// <param name="site"></param>
 /// <returns></returns>
 public static SiteDto ConvertFromSite(ISite site)
 {
     return new SiteDto
     {
         Address = site.Address,
         DirName = site.DirName,
         Domain = site.Domain,
         Email = site.Email,
         Fax = site.Fax,
         Language = site.Language,
         PostCode = site.PostCode,
         Name = site.Name,
         Note = site.Note,
         Notice = site.Note,
         Phone = site.Phone,
         Im = site.Im,
         RunType = (int)site.RunType,
         SeoDescription = site.SeoDescription,
         SeoKeywords = site.SeoKeywords,
         SeoTitle = site.SeoTitle,
         SiteId = site.SiteId,
         Slogan = site.Slogan,
         State = site.State,
         Tel = site.Tel,
         Tpl = site.Tpl
     };
 }
Esempio n. 6
0
 public override FastBitmap GetBitmap(ISite site, bool designMode)
 {
     byte[] bytes = this.Bytes;
     if (bytes != null && bytes.Length > 0)
         return new FastBitmap(bytes);
     return null;
 }
Esempio n. 7
0
        public void SetUp()
        {
            _mock = new Mockery();
            _site = _mock.NewMock<ISite>();
            Stub.On(_site).GetProperty("DefaultSkin").Will(Return.Value(SITE_DEFAULT_SKIN));
            Stub.On(_site).Method("DoesSkinExist").With(SITE_DEFAULT_SKIN).Will(Return.Value(true));
            Stub.On(_site).Method("DoesSkinExist").With(INVALID_SKIN).Will(Return.Value(false));
            Stub.On(_site).Method("DoesSkinExist").With(USER_PREFERRED_SKIN).Will(Return.Value(true));
            Stub.On(_site).Method("DoesSkinExist").With(Is.Null).Will(Return.Value(false));
            Stub.On(_site).Method("DoesSkinExist").With(REQUESTED_SKIN).Will(Return.Value(true));
            Stub.On(_site).Method("DoesSkinExist").With(FILTER_DERIVED_SKIN).Will(Return.Value(true));
            Stub.On(_site).Method("DoesSkinExist").With("xml").Will(Return.Value(true));
            Stub.On(_site).GetProperty("SkinSet").Will(Return.Value("vanilla"));
            
            _user = _mock.NewMock<IUser>();

            _inputContext = _mock.NewMock<IInputContext>();
            Stub.On(_inputContext).GetProperty("CurrentSite").Will(Return.Value(_site));

            _outputContext = _mock.NewMock<IOutputContext>();
            Stub.On(_outputContext).Method("VerifySkinFileExists").Will(Return.Value(true));
    
            _skinSelector = new SkinSelector();
           
            _request = _mock.NewMock<IRequest>();
        }
 public CommandSet(ISite site)
 {
     this.site = site;
     this.eventService = (IEventHandlerService) site.GetService(typeof(IEventHandlerService));
     this.eventService.EventHandlerChanged += new EventHandler(this.OnEventHandlerChanged);
     IDesignerHost host = (IDesignerHost) site.GetService(typeof(IDesignerHost));
     if (host != null)
     {
         host.Activated += new EventHandler(this.UpdateClipboardItems);
     }
     this.statusCommandUI = new StatusCommandUI(site);
     IUIService uiService = site.GetService(typeof(IUIService)) as IUIService;
     this.commandSet = new CommandSetItem[] {
         new CommandSetItem(this, new EventHandler(this.OnStatusDelete), new EventHandler(this.OnMenuDelete), StandardCommands.Delete, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusCopy), new EventHandler(this.OnMenuCopy), StandardCommands.Copy, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusCut), new EventHandler(this.OnMenuCut), StandardCommands.Cut, uiService), new ImmediateCommandSetItem(this, new EventHandler(this.OnStatusPaste), new EventHandler(this.OnMenuPaste), StandardCommands.Paste, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusSelectAll), new EventHandler(this.OnMenuSelectAll), StandardCommands.SelectAll, true, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnMenuDesignerProperties), MenuCommands.DesignerProperties, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeyCancel), MenuCommands.KeyCancel, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeyCancel), MenuCommands.KeyReverseCancel, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusPrimarySelection), new EventHandler(this.OnKeyDefault), MenuCommands.KeyDefaultAction, true, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAnySelection), new EventHandler(this.OnKeyMove), MenuCommands.KeyMoveUp, true, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAnySelection), new EventHandler(this.OnKeyMove), MenuCommands.KeyMoveDown, true, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAnySelection), new EventHandler(this.OnKeyMove), MenuCommands.KeyMoveLeft, true, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAnySelection), new EventHandler(this.OnKeyMove), MenuCommands.KeyMoveRight, true), new CommandSetItem(this, new EventHandler(this.OnStatusAnySelection), new EventHandler(this.OnKeyMove), MenuCommands.KeyNudgeUp, true, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAnySelection), new EventHandler(this.OnKeyMove), MenuCommands.KeyNudgeDown, true, uiService), new CommandSetItem(this, new EventHandler(this.OnStatusAnySelection), new EventHandler(this.OnKeyMove), MenuCommands.KeyNudgeLeft, true, uiService),
         new CommandSetItem(this, new EventHandler(this.OnStatusAnySelection), new EventHandler(this.OnKeyMove), MenuCommands.KeyNudgeRight, true, uiService)
      };
     this.selectionService = (ISelectionService) site.GetService(typeof(ISelectionService));
     if (this.selectionService != null)
     {
         this.selectionService.SelectionChanged += new EventHandler(this.OnSelectionChanged);
     }
     this.menuService = (IMenuCommandService) site.GetService(typeof(IMenuCommandService));
     if (this.menuService != null)
     {
         for (int i = 0; i < this.commandSet.Length; i++)
         {
             this.menuService.AddCommand(this.commandSet[i]);
         }
     }
     IDictionaryService service = site.GetService(typeof(IDictionaryService)) as IDictionaryService;
     if (service != null)
     {
         service.SetValue(typeof(CommandID), new CommandID(new Guid("BA09E2AF-9DF2-4068-B2F0-4C7E5CC19E2F"), 0));
     }
 }
Esempio n. 9
0
 public int UpdateSite(ISite site)
 {
     return base.ExecuteNonQuery(
         SqlQueryHelper.Format(DbSql.Site_EditSite,
         new object[,]{
             {"@siteId",site.Id},
             {"@name",site.Name},
             {"@dirname",site.DirName},
             {"@tpl",site.Tpl},
             {"@domain",site.Domain},
             {"@location",site.Location},
             {"@language",site.Language},
             {"@note",site.Note},
             {"@seotitle",site.SeoTitle},
             {"@seokeywords",site.SeoKeywords},
             {"@seodescription",site.SeoDescription},
             {"@state",site.State},
             {"@protel",site.Tel},
             {"@prophone",site.Phone},
             {"@profax",site.Fax},
             {"@proaddress",site.Address},
             {"@proemail",site.Email},
             {"@im",site.Im},
             {"@postcode",site.PostCode},
             {"@pronotice",site.Notice},
             {"@proslogan",site.Slogan}
         }));
 }
 public override Scene GetScene(ISite site, bool designMode)
 {
     string resolvedFileName = FileSourceHelper.ResolveFileName(FileName, site, designMode);
     if (File.Exists(resolvedFileName))
         return MeshellatorLoader.ImportFromFile(resolvedFileName);
     return null;
 }
 public ControlCommandSet(ISite site) : base(site)
 {
     this.statusCommandUI = new StatusCommandUI(site);
     this.commandSet = new CommandSet.CommandSetItem[] { 
         new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuAlignByPrimary), StandardCommands.AlignLeft, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuAlignByPrimary), StandardCommands.AlignTop, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusControlsOnlySelectionAndGrid), new EventHandler(this.OnMenuAlignToGrid), StandardCommands.AlignToGrid, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuAlignByPrimary), StandardCommands.AlignBottom, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuAlignByPrimary), StandardCommands.AlignHorizontalCenters, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuAlignByPrimary), StandardCommands.AlignRight, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuAlignByPrimary), StandardCommands.AlignVerticalCenters, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusControlsOnlySelection), new EventHandler(this.OnMenuCenterSelection), StandardCommands.CenterHorizontally, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusControlsOnlySelection), new EventHandler(this.OnMenuCenterSelection), StandardCommands.CenterVertically, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectNonContained), new EventHandler(this.OnMenuSpacingCommand), StandardCommands.HorizSpaceConcatenate, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectNonContained), new EventHandler(this.OnMenuSpacingCommand), StandardCommands.HorizSpaceDecrease, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectNonContained), new EventHandler(this.OnMenuSpacingCommand), StandardCommands.HorizSpaceIncrease, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectNonContained), new EventHandler(this.OnMenuSpacingCommand), StandardCommands.HorizSpaceMakeEqual, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectNonContained), new EventHandler(this.OnMenuSpacingCommand), StandardCommands.VertSpaceConcatenate, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectNonContained), new EventHandler(this.OnMenuSpacingCommand), StandardCommands.VertSpaceDecrease, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectNonContained), new EventHandler(this.OnMenuSpacingCommand), StandardCommands.VertSpaceIncrease, true), 
         new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectNonContained), new EventHandler(this.OnMenuSpacingCommand), StandardCommands.VertSpaceMakeEqual, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuSizingCommand), StandardCommands.SizeToControl, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuSizingCommand), StandardCommands.SizeToControlWidth, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusMultiSelectPrimary), new EventHandler(this.OnMenuSizingCommand), StandardCommands.SizeToControlHeight, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusControlsOnlySelectionAndGrid), new EventHandler(this.OnMenuSizeToGrid), StandardCommands.SizeToGrid, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusZOrder), new EventHandler(this.OnMenuZOrderSelection), StandardCommands.BringToFront, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusZOrder), new EventHandler(this.OnMenuZOrderSelection), StandardCommands.SendToBack, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusShowGrid), new EventHandler(this.OnMenuShowGrid), StandardCommands.ShowGrid, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusSnapToGrid), new EventHandler(this.OnMenuSnapToGrid), StandardCommands.SnapToGrid, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAnyControls), new EventHandler(this.OnMenuTabOrder), StandardCommands.TabOrder, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusLockControls), new EventHandler(this.OnMenuLockControls), StandardCommands.LockControls, true), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySize), MenuCommands.KeySizeWidthIncrease), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySize), MenuCommands.KeySizeHeightIncrease), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySize), MenuCommands.KeySizeWidthDecrease), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySize), MenuCommands.KeySizeHeightDecrease), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySize), MenuCommands.KeyNudgeWidthIncrease), 
         new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySize), MenuCommands.KeyNudgeHeightIncrease), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySize), MenuCommands.KeyNudgeWidthDecrease), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySize), MenuCommands.KeyNudgeHeightDecrease), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySelect), MenuCommands.KeySelectNext), new CommandSet.CommandSetItem(this, new EventHandler(this.OnStatusAlways), new EventHandler(this.OnKeySelect), MenuCommands.KeySelectPrevious)
      };
     if (base.MenuService != null)
     {
         for (int i = 0; i < this.commandSet.Length; i++)
         {
             base.MenuService.AddCommand(this.commandSet[i]);
         }
     }
     IDesignerHost service = (IDesignerHost) this.GetService(typeof(IDesignerHost));
     if (service != null)
     {
         Control rootComponent = service.RootComponent as Control;
         if (rootComponent != null)
         {
             this.baseControl = rootComponent;
         }
     }
 }
    public TranscriptViewModel(IRoom room, ISite site, string searchTerm, 
      DateTime searchDate, MessageViewModelFactory messageViewModelFactory, IEventAggregator eventAggregator)
    {
      this.room = room;
      this.site = site;

      this.SearchTerm = searchTerm;
      this.SearchDate = searchDate;

      this.dispatcher = Dispatcher.CurrentDispatcher;

      this.messageViewModelFactory = messageViewModelFactory;
      this.Messages = new ObservableCollection<ViewModelBase>();
      this.Rooms = new ObservableCollection<RoomViewModel>();

      if (!string.IsNullOrWhiteSpace(this.SearchTerm))
        SearchByString();
      else if (this.SearchDate != DateTime.MinValue)
        SearchByDate();

      if (SearchDate == DateTime.MinValue)
        SearchDate = DateTime.Today;

      this.SearchByStringCommand = new RelayCommand(SearchByString);
      this.SearchByDateCommand = new RelayCommand(SearchByDate);

      foreach (var r in this.site.Rooms)
        this.Rooms.Add(new RoomViewModel(site, null, r, eventAggregator));
    }
 public RegexEditorDialog(ISite site)
 {
     this.site = site;
     this.InitializeComponent();
     this.settingValue = false;
     this.regularExpression = string.Empty;
 }
        /// <summary>
        /// This function is a customization point for Enumeration and Multiselect CMS
        /// elements to provide options like data driven select lists etc. 
        /// </summary>
        /// <param name="schemaName">Schema root name (i.e. Page Type)</param>
        /// <param name="elementName">Tag name of the element</param>
        /// <param name="options">object that is used both as input and
        /// output for this customizable function. Some options include information 
        /// about the request, while others allow modifying how the response is processed.</param>
        /// <param name="site">the CSAPI Site Object, created in a special session</param>
        /// <returns>Collection of strings and field choices</returns>
        public IEnumerable<SelectionChoiceItem> GetElementValues(string schemaName, string elementName,
            ChoicesProviderOptions options, ISite site)
        {
           // return new SelectionChoiceItem[0];

            /////////////////////////////////////////////////////////////////
            // Sample:
            //
            return new[] {
            //	new SelectionChoiceItem {
            //		Label = "One",
            //		Value = "1"
            //	},
            //	new SelectionChoiceItem {
            //		Label = "Two",
            //		Value = "2"
            //	},
                new SelectionChoiceItem
                {
                    Label = "Three",
                    Value = "3"
                }
            };

        }
        internal WebConfigManager(ISite site)
        {
            Debug.Assert(site != null);
            _site = site;

            IWebApplication webApplicationService = (IWebApplication)_site.GetService(typeof(IWebApplication));
            if (webApplicationService != null) {
                IProjectItem dataFileProjectItem = webApplicationService.GetProjectItemFromUrl("~/web.config");
                if (dataFileProjectItem != null) {
                    _path = dataFileProjectItem.PhysicalPath;
                }
            }

/* VSWhidbey 271075, 257678
            // the following inspired by:
            // \VSDesigner\Designer\Microsoft\VisualStudio\Designer\Serialization\BaseDesignerLoader.cs

            Type projectItemType = Type.GetType("EnvDTE.ProjectItem, " + AssemblyRef.EnvDTE);
            if (projectItemType != null)
            {
                Object currentProjItem = _site.GetService(projectItemType);
                PropertyInfo containingProjectProp = projectItemType.GetProperty("ContainingProject");
                Object dteProject = containingProjectProp.GetValue(currentProjItem, new Object[0]);
                Type projectType = Type.GetType("EnvDTE.Project, " + AssemblyRef.EnvDTE);
                PropertyInfo fullNameProperty = projectType.GetProperty("FullName");
                String projectPath = (String)fullNameProperty.GetValue(dteProject, new Object[0]);

                _path = Path.GetDirectoryName(projectPath) + "\\web.config";
            }
*/
        }
 public virtual void Add(IComponent component, string name)
 {
     lock (this.syncObj)
     {
         if (component != null)
         {
             ISite site = component.Site;
             if ((site == null) || (site.Container != this))
             {
                 if (this.sites == null)
                 {
                     this.sites = new ISite[4];
                 }
                 else
                 {
                     this.ValidateName(component, name);
                     if (this.sites.Length == this.siteCount)
                     {
                         ISite[] destinationArray = new ISite[this.siteCount * 2];
                         Array.Copy(this.sites, 0, destinationArray, 0, this.siteCount);
                         this.sites = destinationArray;
                     }
                 }
                 if (site != null)
                 {
                     site.Container.Remove(component);
                 }
                 ISite site2 = this.CreateSite(component, name);
                 this.sites[this.siteCount++] = site2;
                 component.Site = site2;
                 this.components = null;
             }
         }
     }
 }
        public override Scene GetScene(ISite site, bool designMode)
        {
            Scene scene = new Scene();

            foreach (Mesh mesh in Meshes)
            {
                Meshellator.Mesh meshellatorMesh = new Meshellator.Mesh();
                scene.Meshes.Add(meshellatorMesh);

                meshellatorMesh.Positions.AddRange(mesh.Positions.Select(p => new Nexus.Point3D(p.X, p.Y, p.Z)));
                meshellatorMesh.TextureCoordinates.AddRange(mesh.TextureCoordinates.Select(p => new Nexus.Point3D(p.X, p.Y, 0)));
                MeshUtility.CalculateNormals(meshellatorMesh, false);

                meshellatorMesh.Indices.AddRange(mesh.Indices.Select(i => i.Value));

                Meshellator.Material meshellatorMaterial = new Meshellator.Material();
                meshellatorMaterial.DiffuseColor = ConversionUtility.ToNexusColorRgbF(mesh.Material.DiffuseColor);
                if (!string.IsNullOrEmpty(mesh.Material.TextureFileName))
                {
                    string textureFileName = FileSourceHelper.ResolveFileName(mesh.Material.TextureFileName, Site, DesignMode);
                    if (!File.Exists(textureFileName))
                        throw new DynamicImageException("Could not find texture '" + mesh.Material.TextureFileName + "'.");
                    meshellatorMaterial.DiffuseTextureName = textureFileName;
                }
                meshellatorMaterial.Shininess = mesh.Material.Shininess;
                meshellatorMaterial.SpecularColor = ConversionUtility.ToNexusColorRgbF(mesh.Material.SpecularColor);
                meshellatorMaterial.Transparency = mesh.Material.Transparency;

                meshellatorMesh.Material = meshellatorMaterial;
                scene.Materials.Add(meshellatorMaterial);
            }

            return scene;
        }
Esempio n. 18
0
        public int SaveSite(ISite site)
        {
            if (site.ID == 0)
            {
                //
                //NOTO:创建站点时应创建一个ROOT栏目节点
                //

                int siteId=siteDal.CreateSite(site);
                if (siteId==-1)
                {
                    throw new ArgumentException("创建站点失败");
                }
                else
                {
                    //清理缓存
                    RepositoryDataCache._siteDict = null;
                    RepositoryDataCache._categories = null;
                }
            }
            else
            {
                if (siteDal.UpdateSite(site) != 1)
                {
                    throw new ArgumentException("站点不存在,保存失败");
                }

                //清理缓存
                RepositoryDataCache._siteDict = null;
                RepositoryDataCache._categories = null;
            }

            return site.SiteId;
        }
Esempio n. 19
0
        /// <summary>
        /// Reads a specific forum by the UID
        /// </summary>
        /// <param name="uid">The specific form uid</param>
        /// <returns>The specified forum including comment data</returns>
        public RatingForum RatingForumReadByUID(string uid, ISite site)
        {
            RatingForum RatingForum = null;

            if(RatingForumReadByUIDFromCache(uid, site, ref RatingForum))
            {
                return RatingForum;
            }
            using (var reader = CreateReader("RatingForumreadbyuid"))
            {
                try
                {
                    reader.AddParameter("uid", uid);
                    reader.AddParameter("siteid", site.SiteID);
                    reader.Execute();

                    if (reader.HasRows && reader.Read())
                    {
                        RatingForum = RatingForumCreateFromReader(reader);
                        RatingForum.identityPolicy = site.IdentityPolicy;
                        RatingForum.ratingsList = RatingsReadByForumID(RatingForum.ForumID, site);
                        RatingForumAddToCache(RatingForum, site);
                    }
                }
                catch (Exception ex)
                {
                    throw new ApiException(ex.Message, ex.InnerException);
                    //DnaApiWebProtocalException.ThrowDnaApiWebProtocalException(System.Net.HttpStatusCode.InternalServerError, ex.Message, ex);
                }
            }
            return RatingForum;
        }
Esempio n. 20
0
 internal SiteLink(ISiteRepository siteRep, ISite site, int id,string text)
 {
     this._siteRep = siteRep;
     this._site = site;
     this.Id = id;
     this.Text = text;
 }
Esempio n. 21
0
 /// <summary>
 /// Starts kernel. Initializes container and site of kernel.
 /// </summary>
 /// <param name="hostSite">The parent site this kernel should attach to.</param>
 public static void Run(ISite hostSite)
 {
     KernelServiceContainer serviceContainer = new KernelServiceContainer(hostSite);
     KernelContainer container = new KernelContainer(serviceContainer);
     KernelSite site = new KernelSite(serviceContainer, container);
     Kernel.site = site;
 }
 public LocalizationExtenderProvider(ISite serviceProvider, IComponent baseComponent)
 {
     this.serviceProvider = serviceProvider;
     this.baseComponent = baseComponent;
     if (serviceProvider != null)
     {
         IExtenderProviderService service = (IExtenderProviderService) serviceProvider.GetService(typeof(IExtenderProviderService));
         if (service != null)
         {
             service.AddExtenderProvider(this);
         }
     }
     this.language = CultureInfo.InvariantCulture;
     ResourceManager manager = new ResourceManager(baseComponent.GetType());
     if (manager != null)
     {
         ResourceSet set = manager.GetResourceSet(this.language, true, false);
         if (set != null)
         {
             object obj2 = set.GetObject("$this.Localizable");
             if (obj2 is bool)
             {
                 this.defaultLocalizable = (bool) obj2;
                 this.localizable = this.defaultLocalizable;
             }
         }
     }
 }
Esempio n. 23
0
 public NormalComponent(string componentName)
 {
     _NormalComponent_Site = null;
     _componentName = componentName;
     _innerName = componentName;
     Disposed = null;
 }
Esempio n. 24
0
        /// <summary>
        /// Constructs a new pager.
        /// </summary>
        /// <param name="site">The site settings.</param>
        /// <param name="page">The page parameter.</param>
        /// <param name="pageSize">The page size parameter.</param>
        public Pager(ISite site, int? page, int? pageSize) {
            Page = (int) (page != null ? (page > 0 ? page : PageDefault) : PageDefault);
            PageSize = pageSize ?? site.PageSize;

            if (site.MaxPageSize > 0 && PageSize > site.MaxPageSize) {
                PageSize = site.MaxPageSize;
            }
        }
Esempio n. 25
0
 public static User Load(JToken json, ISite campfireSite)
 {
     return new User
         {
             Name = json.Value<string>("name"),
             ID = json.Value<int>("id")
         };
 }
Esempio n. 26
0
 public override FastBitmap GetBitmap(ISite site, bool designMode)
 {
     string resolvedFileName = FileSourceHelper.ResolveFileName(this.FileName, site, designMode);
     if (File.Exists(resolvedFileName))
         return new FastBitmap(resolvedFileName);
     else
         return null;
 }
Esempio n. 27
0
    public Room(ISite site)
    {
      this.site = site;

      Users = new List<User>();
      AllUsers = new List<User>();
      RecentUploads = new List<UploadObject>();
    }
Esempio n. 28
0
 internal Category(ICategoryRepository rep,IExtendFieldRepository extendRep,ITemplateRepository tmpRep, int id,ISite site)
 {
     this.Site = site;
     this._rep = rep;
     this.Id = id;
     this._extendRep = extendRep;
     this._tempRep = tmpRep;
 }
Esempio n. 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GridConfig"/> class.
        /// </summary>
        /// <param name="site">The site.</param>
        public GridConfig(ISite site)
        {
            m_Site = site;

            m_AppSettings = new Dictionary<int, string>();
            foreach (string item in ConfigurationManager.AppSettings)
                m_AppSettings.Add(item.GetHashCode(), ConfigurationManager.AppSettings[item]);
        }
Esempio n. 30
0
 /// <summary>
 /// Calls <see cref="IFTPComponent.LinkComponent"/> on all other 
 /// FTP components in the container of the given site.
 /// </summary>
 /// <param name="site">Site in the container whose FTP components are to be linked.</param>
 /// <param name="component">New components added to the containiner.</param>
 public static void Link(ISite site, IFTPComponent component)
 {
     if (site==null || !site.DesignMode || site.Container == null)
         return;
     foreach (object c in site.Container.Components)
         if (c!=component && c is IFTPComponent)
             ((IFTPComponent)c).LinkComponent(component);
 }
Esempio n. 31
0
        private async IAsyncEnumerable <IFile> CompileAll(IPage page, ISite site, ILocation baseLoc)
        {
            const string PAGE_FILE_NAME = "index.html";

            ILocation thisLoc;

            if (!baseLoc.IsEmpty())
            {
                thisLoc = baseLoc.Combine(new Location("", PAGE_FILE_NAME, new string[] { page.Name }));
            }
            else
            {
                thisLoc = new Location("", PAGE_FILE_NAME, Enumerable.Empty <string>());
            }

            ILocation pageLoc;

            if (!System.IO.Path.HasExtension(page.Name))
            {
                pageLoc = thisLoc;
            }
            else
            {
                pageLoc = baseLoc.Combine(new Location("", page.Name, Enumerable.Empty <string>()));
            }

            if (!(page is IPhantomPage))
            {
                yield return(await CompilePage(page, site, pageLoc));
            }

            await foreach (var asset in CompileAssets(page, page, site, thisLoc))
            {
                yield return(asset);
            }

            foreach (var child in page.SubPages)
            {
                await foreach (var subPage in CompileAll(child, site, thisLoc))
                {
                    yield return(subPage);
                }
            }
        }
Esempio n. 32
0
 public override object ConvertTo(
     ITypeDescriptorContext context,
     CultureInfo culture,
     object value,
     Type destinationType)
 {
     if ((object)destinationType == null)
     {
         throw new ArgumentNullException("Destination Type is not defined.");
     }
     if ((object)destinationType != (object)typeof(string))
     {
         return(base.ConvertTo(context, culture, value, destinationType));
     }
     if (value == null)
     {
         return((object)CommandBaseConverter.none);
     }
     if (context != null)
     {
         IReferenceService service = (IReferenceService)context.GetService(typeof(IReferenceService));
         if (service != null)
         {
             string name = service.GetName(value);
             if (name != null)
             {
                 return((object)name);
             }
         }
     }
     if (!Marshal.IsComObject(value) && value is IComponent)
     {
         ISite site = ((IComponent)value).Site;
         if (site != null)
         {
             string name = site.Name;
             if (name != null)
             {
                 return((object)name);
             }
         }
     }
     return((object)string.Empty);
 }
Esempio n. 33
0
        public void SaveCategory()
        {
            ISite             ist = this.siteRepo.GetSiteById(siteId);
            CmsCategoryEntity cat = new CmsCategoryEntity
            {
                SiteId   = siteId,
                Name     = "一级分类",
                ParentId = 0,
                Tag      = "cat1",
                Location = "http://baidu.com",
            };
            ICategory ic = ist.GetCategoryByPath("cat1");

            if (ic == null)
            {
                ic = this.repo.CreateCategory(cat);
            }
            Error err = ic.Set(cat);

            if (err == null)
            {
                TemplateBind[] arr = new TemplateBind[2];
                arr[0] = new TemplateBind(0, TemplateBindType.CategoryArchiveTemplate, "default/archive_1");
                arr[1] = new TemplateBind(0, TemplateBindType.CategoryTemplate, "default/category_1");
                err    = ic.SetTemplates(arr);
                if (err == null)
                {
                    err = ic.Save();
                }
            }
            if (err != null)
            {
                Assert.Fail(err.Message);
            }
            else
            {
                this.Println(this.Stringfy(ic.Get()));
                this.Println(this.Stringfy(ist.GetCategoryTreeWithRootNode()));
                cat.Name += "*";
                ic.Set(cat);
                ic.Save();
                this.Println(this.Stringfy(ist.GetCategoryTreeWithRootNode()));
            }
        }
Esempio n. 34
0
        public override void SetValue(object component, object value)
        {
            if (component == null)
            {
                throw new ArgumentNullException("component");
            }
            if (!(component is RuleConditionReference))
            {
                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Messages.NotARuleConditionReference, new object[] { "component" }), "component");
            }
            string key = value as string;

            if ((key == null) || (key.TrimEnd(new char[0]).Length == 0))
            {
                key = string.Empty;
            }
            ISite serviceProvider = PropertyDescriptorUtils.GetSite(base.ServiceProvider, component);

            if (serviceProvider == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Messages.MissingService, new object[] { typeof(ISite).FullName }));
            }
            RuleConditionCollection conditions  = null;
            RuleDefinitions         definitions = ConditionHelper.Load_Rules_DT(serviceProvider, Helpers.GetRootActivity(serviceProvider.Component as Activity));

            if (definitions != null)
            {
                conditions = definitions.Conditions;
            }
            if (((conditions != null) && (key.Length != 0)) && !conditions.Contains(key))
            {
                RuleExpressionCondition item = new RuleExpressionCondition {
                    Name = key
                };
                conditions.Add(item);
                ConditionHelper.Flush_Rules_DT(serviceProvider, Helpers.GetRootActivity(serviceProvider.Component as Activity));
            }
            PropertyDescriptor propertyDescriptor = TypeDescriptor.GetProperties(component)["ConditionName"];

            if (propertyDescriptor != null)
            {
                PropertyDescriptorUtils.SetPropertyValue(serviceProvider, propertyDescriptor, component, key);
            }
        }
Esempio n. 35
0
        /// <internalonly/>
        /// <summary>
        ///    <para>Converts the given value object to the reference type
        ///       using the specified context and arguments.</para>
        /// </summary>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == null)
            {
                throw new ArgumentNullException(nameof(destinationType));
            }

            if (destinationType == typeof(string))
            {
                if (value != null)
                {
                    // Try the reference service first.
                    //
                    IReferenceService refSvc = (IReferenceService)context?.GetService(typeof(IReferenceService));
                    if (refSvc != null)
                    {
                        string name = refSvc.GetName(value);
                        if (name != null)
                        {
                            return(name);
                        }
                    }

                    // Now see if this is an IComponent.
                    //
                    if (!Marshal.IsComObject(value) && value is IComponent)
                    {
                        IComponent comp = (IComponent)value;
                        ISite      site = comp.Site;
                        string     name = site?.Name;
                        if (name != null)
                        {
                            return(name);
                        }
                    }

                    // Couldn't find it.
                    return(String.Empty);
                }
                return(s_none);
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
        internal void ExtenderSetValue(IExtenderProvider provider, object component, object value, PropertyDescriptor notifyDesc)
        {
            if (provider != null)
            {
                ISite site = GetSite(component);
                IComponentChangeService changeService = null;
                object oldValue = null;

                // Announce that we are about to change this component
                if (site != null)
                {
                    changeService = (IComponentChangeService)site.GetService(typeof(IComponentChangeService));
                    Debug.Assert(!ComponentModelSwitches.CommonDesignerServices.Enabled || changeService != null, "IComponentChangeService not found");
                }

                // Make sure that it is ok to send the onchange events
                if (changeService != null)
                {
                    oldValue = ExtenderGetValue(provider, component);
                    try
                    {
                        changeService.OnComponentChanging(component, notifyDesc);
                    }
                    catch (CheckoutException coEx)
                    {
                        if (coEx == CheckoutException.Canceled)
                        {
                            return;
                        }
                        throw;
                    }
                }

                provider = (IExtenderProvider)GetInvocationTarget(_componentClass, provider);

                if (SetMethodValue != null)
                {
                    SetMethodValue.Invoke(provider, new object[] { component, value });

                    // Now notify the change service that the change was successful.
                    changeService?.OnComponentChanged(component, notifyDesc, oldValue, value);
                }
            }
        }
Esempio n. 37
0
        public int SaveArchive(int siteId, ArchiveDto archiveDto)
        {
            IContentContainer ic = this._contentRep.GetContent(siteId);
            IArchive          archive;

            if (archiveDto.Id <= 0)
            {
                archive = ic.CreateArchive(-1, archiveDto.StrId, archiveDto.Category.ID, archiveDto.Title);
            }
            else
            {
                archive = ic.GetArchiveById(archiveDto.Id);

                //修改栏目
                if (archiveDto.Category.ID != archive.Category.ID)
                {
                    ISite site = this._siteRep.GetSiteById(siteId);
                    archive.Category = site.GetCategory(archiveDto.Category.ID);
                }
            }


            archive.LastModifyDate = DateTime.Now;
            archive.Content        = archiveDto.Content;
            archive.Alias          = archiveDto.Alias;
            archive.Author         = archiveDto.Author;
            archive.Flags          = archiveDto.Flags;
            archive.Outline        = archiveDto.Outline;
            archive.Source         = archiveDto.Source;
            archive.Tags           = archiveDto.Tags;
            archive.Thumbnail      = archiveDto.Thumbnail;
            archive.Title          = archiveDto.Title;
            archive.ExtendValues   = archiveDto.ExtendValues;

            //只更新自己的模板
            if (archiveDto.IsSelfTemplate ||
                (archive.ID == -1 && !String.IsNullOrEmpty(archiveDto.TemplatePath))
                )
            {
                archive.UpdateTemplateBind(archiveDto.TemplatePath);
            }

            return(archive.Save());
        }
Esempio n. 38
0
        /// <summary>
        ///  Initializes a new instance of the <see cref='DesignerFrame'/> class.
        /// </summary>
        public DesignerFrame(ISite site)
        {
            Text            = "DesignerFrame";
            _designerSite   = site;
            _designerRegion = new OverlayControl(site);
            _uiService      = _designerSite.GetService(typeof(IUIService)) as IUIService;
            if (_uiService != null)
            {
                if (_uiService.Styles["ArtboardBackground"] is Color)
                {
                    BackColor = (Color)_uiService.Styles["ArtboardBackground"];
                }
            }

            Controls.Add(_designerRegion);
            // Now we must configure our designer to be at the correct location, and setup the autoscrolling for its container.
            _designerRegion.AutoScroll = true;
            _designerRegion.Dock       = DockStyle.Fill;
        }
Esempio n. 39
0
        public void ErrorProvider_Site_SetWithNonNullOldValue_GetReturnsExpected(ISite value)
        {
            var mockSite = new Mock <ISite>(MockBehavior.Strict);

            mockSite
            .Setup(s => s.GetService(typeof(IDesignerHost)))
            .Returns(null);
            var provider = new ErrorProvider
            {
                Site = mockSite.Object
            };

            provider.Site = value;
            Assert.Same(value, provider.Site);

            // Set same.
            provider.Site = value;
            Assert.Same(value, provider.Site);
        }
        /// <summary>
        ///  Called when a component has changed on the active designer. Here
        ///  we grab the active selection service and see if the component that
        ///  has changed is also selected.  If it is, then we raise a global
        ///  selection changed event.
        /// </summary>
        private void OnComponentChanged(object sender, ComponentChangedEventArgs ce)
        {
            if (!(ce.Component is IComponent comp))
            {
                return;
            }

            ISite site = comp.Site;

            if (site is null)
            {
                return;
            }

            if (site.GetService(typeof(ISelectionService)) is ISelectionService ss && ss.GetComponentSelected(comp))
            {
                OnSelectionChanged(this, EventArgs.Empty);
            }
        }
Esempio n. 41
0
 public ContractNexusBase(string contractNexusContractNexusCode, string contractNexusContractCode, string contractNexusContractChangeCode, string contractNexusCode, string contractNexusType, string contractNexusName, string contractNexusID, string contractNexusPerson, DateTime?contractNexusDate, string contractNexusPath, decimal?contractNexusMoney)
 {
     this.inTxn = false;
     this._contractChangeCodeSource = null;
     this._site              = null;
     this.entityData         = new ContractNexusEntityData();
     this.backupData         = null;
     this.ContractNexusCode  = contractNexusContractNexusCode;
     this.ContractCode       = contractNexusContractCode;
     this.ContractChangeCode = contractNexusContractChangeCode;
     this.Code   = contractNexusCode;
     this.Type   = contractNexusType;
     this.Name   = contractNexusName;
     this.ID     = contractNexusID;
     this.Person = contractNexusPerson;
     this.Date   = contractNexusDate;
     this.Path   = contractNexusPath;
     this.Money  = contractNexusMoney;
 }
Esempio n. 42
0
        public static string BuildColor(IComponent component, Control owner, string initialColor)
        {
            string str  = null;
            ISite  site = component.Site;

            if (site == null)
            {
                return(null);
            }
            if (site != null)
            {
                IWebFormsBuilderUIService service = (IWebFormsBuilderUIService)site.GetService(typeof(IWebFormsBuilderUIService));
                if (service != null)
                {
                    str = service.BuildColor(owner, initialColor);
                }
            }
            return(str);
        }
            /// <summary>
            ///  Broadcasts a global change, indicating that all
            ///  objects on the designer have changed.
            /// </summary>
            private void BroadcastGlobalChange(IComponent comp)
            {
                ISite site = comp.Site;

                if (site != null)
                {
                    IComponentChangeService cs = site.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
                    IContainer container       = site.GetService(typeof(IContainer)) as IContainer;

                    if (cs != null && container != null)
                    {
                        foreach (IComponent c in container.Components)
                        {
                            cs.OnComponentChanging(c, null);
                            cs.OnComponentChanged(c, null, null, null);
                        }
                    }
                }
            }
        public async Task <ContentItem> GetSettingsAsync(ISite site, ContentTypeDefinition settingsType, Action isNew = null)
        {
            JToken      property;
            ContentItem contentItem;

            if (site.Properties.TryGetValue(settingsType.Name, out property))
            {
                // Create existing content item
                contentItem = property.ToObject <ContentItem>();
            }
            else
            {
                contentItem = await _contentManager.NewAsync(settingsType.Name);

                isNew?.Invoke();
            }

            return(contentItem);
        }
Esempio n. 45
0
        // Adds a component to the container.
        /// <summary>
        ///    <para>
        ///       Adds the specified component to the <see cref='System.ComponentModel.Container'/> and assigns a name to
        ///       it.
        ///    </para>
        /// </summary>
        public virtual void Add(IComponent component, String name)
        {
            lock (_syncObj)
            {
                if (component == null)
                {
                    return;
                }

                ISite site = component.Site;

                if (site != null && site.Container == this)
                {
                    return;
                }

                if (_sites == null)
                {
                    _sites = new ISite[4];
                }
                else
                {
                    // Validate that new components
                    // have either a null name or a unique one.
                    //
                    ValidateName(component, name);

                    if (_sites.Length == _siteCount)
                    {
                        ISite[] newSites = new ISite[_siteCount * 2];
                        Array.Copy(_sites, 0, newSites, 0, _siteCount);
                        _sites = newSites;
                    }
                }

                site?.Container.Remove(component);

                ISite newSite = CreateSite(component, name);
                _sites[_siteCount++] = newSite;
                component.Site       = newSite;
                _components          = null;
            }
        }
Esempio n. 46
0
        private async Task ApplyModelToViewModel()
        {
            var provider      = App.Container.Resolve <ISiteProvider>();
            var preparedSites = provider?.Sites.Select(site =>
            {
                (site as Site).SetGeneratedPassword(GeneratePassword(site), !Settings.PasswordsVisible);
                return(site);
            });

            Sites = new ObservableItemCollection <ISite>(preparedSites);

            FilteredSites.Source           = Sites;
            FilteredSites.OrderFunction    = site => SitesOrderToPropertyName(SitesOrder, site);
            FilteredSites.IncludedFunction = site => site.SiteName?.ToLower().Contains(SearchString?.ToLower() ?? string.Empty) ?? true;

            SelectedSite = Sites.FirstOrDefault();

            await Task.CompletedTask;
        }
Esempio n. 47
0
        public virtual void OnSetComponentDefaults()
        {
            // COMPAT: The following code shipped in Everett, so we need to continue to do this. See VSWhidbey #419610 for details.
            ISite site = Component.Site;

            if (site != null)
            {
                IComponent         component = Component;
                PropertyDescriptor pd        = TypeDescriptor.GetDefaultProperty(component);
                if (pd != null && pd.PropertyType.Equals(typeof(string)))
                {
                    string current = (string)pd.GetValue(component);
                    if (current == null || current.Length == 0)
                    {
                        pd.SetValue(component, site.Name);
                    }
                }
            }
        }
Esempio n. 48
0
        private void DoDesignTimeDoubleClick(MouseEventArgs e)
        {
            RadMenuItemBase elementUnderMouse = this.elementUnderMouse;

            this.elementUnderMouse = this.ElementTree.GetElementAtPoint(e.Location) as RadMenuItemBase;
            if (this.dblClickStopWatch == null)
            {
                this.dblClickStopWatch = Stopwatch.StartNew();
            }
            else if (this.elementUnderMouse != elementUnderMouse)
            {
                if (this.dblClickStopWatch == null)
                {
                    return;
                }
                this.dblClickStopWatch.Reset();
                this.dblClickStopWatch.Start();
            }
            else if (this.dblClickStopWatch.ElapsedMilliseconds < (long)SystemInformation.DoubleClickTime)
            {
                if (this.elementUnderMouse == null)
                {
                    return;
                }
                ISite site = this.elementUnderMouse.GetSite();
                if (site == null || (IDesignerHost)site.GetService(typeof(IDesignerHost)) == null)
                {
                    return;
                }
                this.ClosePopup(RadPopupCloseReason.Mouse);
                if (this.OwnerPopup != null)
                {
                    PopupManager.Default.CloseAllToRoot(RadPopupCloseReason.Mouse, this.OwnerPopup);
                }
                this.dblClickStopWatch.Reset();
                this.elementUnderMouse = (RadMenuItemBase)null;
            }
            else
            {
                this.dblClickStopWatch.Reset();
                this.elementUnderMouse = (RadMenuItemBase)null;
            }
        }
Esempio n. 49
0
        bool stopThread    = false;  //Флаг для остановки потока

        //Конструктор
        public SitePresenter(ISite view)
        {
            //Сохраним ссылку на форму
            siteView = view;
            //Создадим экземпляр модели
            siteModel = new SiteModel();
            //Соединимся с БД
            siteModel.ConnectionDB();
            //Прочитаем данные из БД
            siteModel.GetDate();
            //Настроим источник данных для DataGridView
            siteView.DataSource = siteModel.Sites;

            //Создаем новый поток
            Thread checkThread = new Thread(new ThreadStart(CheckSite));

            //Запускаем поток
            checkThread.Start();
        }
        private void OnComponentAddedRemoved(object sender, ComponentEventArgs ce)
        {
            IComponent component = ce.Component;

            if (component != null)
            {
                ISite site = component.Site;
                if (site != null)
                {
                    IDesignerHost container = site.Container as IDesignerHost;
                    if ((container != null) && container.Loading)
                    {
                        this._deferredSelChange = true;
                        return;
                    }
                }
            }
            this.OnSelectionChanged(this, EventArgs.Empty);
        }
        /// <include file='doc\DataMemberConverter.uex' path='docs/doc[@for="DataMemberConverter.GetStandardValues"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Gets the fields present within the selected data source if information about them is available.
        ///    </para>
        /// </devdoc>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            string[] names = null;

            if (context != null)
            {
                IComponent component = context.Instance as IComponent;
                if (component is IDeviceSpecificChoiceDesigner)
                {
                    component = ((IDeviceSpecificChoiceDesigner)component).UnderlyingControl;
                }

                if (component != null)
                {
                    ISite componentSite = component.Site;
                    if (componentSite != null)
                    {
                        IDesignerHost designerHost = (IDesignerHost)componentSite.GetService(typeof(IDesignerHost));
                        if (designerHost != null)
                        {
                            IDesigner designer = designerHost.GetDesigner(component);

                            if (designer is IDataSourceProvider)
                            {
                                object dataSource = ((IDataSourceProvider)designer).GetSelectedDataSource();

                                if (dataSource != null)
                                {
                                    names = DesignTimeData.GetDataMembers(dataSource);
                                }
                            }
                        }
                    }
                }

                if (names == null)
                {
                    names = new string[0];
                }
                Array.Sort(names);
            }
            return(new StandardValuesCollection(names));
        }
Esempio n. 52
0
        private static bool IsInDesignMode(IComponent component)
        {
            bool ret = false;

            if (null != component)
            {
                ISite site = component.Site;
                if (null != site)
                {
                    ret = site.DesignMode;
                }
                else if (component is System.Windows.Forms.Control)
                {
                    IComponent parent = ((System.Windows.Forms.Control)component).Parent;
                    ret = IsInDesignMode(parent);
                }
            }
            return(ret);
        }
Esempio n. 53
0
        private OpenIdValidationSettings GetSettingsFromContainer(ISite container)
        {
            if (container.Properties.TryGetValue(nameof(OpenIdValidationSettings), out var settings))
            {
                return(settings.ToObject <OpenIdValidationSettings>());
            }

            // If the OpenID validation settings haven't been populated yet, assume the validation
            // feature will use the OpenID server registered in this tenant if it's been enabled.
            if (_shellDescriptor.Features.Any(feature => feature.Id == OpenIdConstants.Features.Server))
            {
                return(new OpenIdValidationSettings
                {
                    Tenant = _shellSettings.Name
                });
            }

            return(new OpenIdValidationSettings());
        }
        public override void Execute(XElement element, Context context,
                                     Configuration.IConfiguration configuration, ISite site = null, ISiteOwner siteOwner = null)
        {
            const string FINDBY     = "findby-";
            XAttribute   attribute  = element.Element("input").Attribute(FINDBY + "xpath");
            IWebElement  webElement = null;

            if (attribute != null)
            {
                webElement = context.Driver.FindElement(By.XPath(attribute.Value));
            }

            System.Threading.Thread.Sleep(100);

            if (webElement != null)
            {
                webElement.Click();
            }
        }
Esempio n. 55
0
            /// <summary>
            ///  Retrieves the current value of the property on component,
            ///  invoking the getXXX method.  An exception in the getXXX
            ///  method will pass through.
            /// </summary>
            public override object GetValue(object component)
            {
                ArgumentNullException.ThrowIfNull(component);

                // We must locate the sited component, because we store data on the dictionary
                // service for the component.
                ISite site = null;

                if (component is IComponent)
                {
                    site = ((IComponent)component).Site;
                }

                if (site is null)
                {
                    if (_eventService._provider.GetService(typeof(IReferenceService)) is IReferenceService rs)
                    {
                        IComponent baseComponent = rs.GetComponent(component);

                        if (baseComponent is not null)
                        {
                            site = baseComponent.Site;
                        }
                    }
                }

                if (site is null)
                {
                    // Object not sited, so we weren't able to set a value on it.  Setting a value will fail.
                    return(null);
                }

                IDictionaryService ds = (IDictionaryService)site.GetService(typeof(IDictionaryService));

                if (ds is null)
                {
                    // No dictionary service, so we weren't able to set a value on it. Setting a value will fail.
                    return(null);
                }

                return((string)ds.GetValue(new ReferenceEventClosure(component, this)));
            }
Esempio n. 56
0
        internal TemplatingOptionsDialog(MobileTemplatedControlDesigner designer,
                                         ISite site,
                                         int mergingContext)
        {
            _strCollSchemas = new StringCollection();
            _mergingContext = mergingContext;
            _designer       = designer;
            _site           = site;
            _dsd            = (IDeviceSpecificDesigner)designer;
            _dsd.SetDeviceSpecificEditor(this);

            InitializeComponent();

            this.Text            = SR.GetString(SR.TemplatingOptionsDialog_Title);
            _btnHelp.Text        = SR.GetString(SR.GenericDialog_HelpBtnCaption);
            _btnClose.Text       = SR.GetString(SR.GenericDialog_CloseBtnCaption);
            _lblSchemas.Text     = SR.GetString(SR.TemplatingOptionsDialog_SchemaCaption);
            _btnEditChoices.Text = SR.GetString(SR.TemplatingOptionsDialog_EditBtnCaption);
            _lblChoices.Text     = SR.GetString(SR.TemplatingOptionsDialog_FilterCaption);
            _schemasFriendly     = new String[] { SR.GetString(SR.TemplatingOptionsDialog_HTMLSchemaFriendly),
                                                  SR.GetString(SR.TemplatingOptionsDialog_CHTMLSchemaFriendly) };
            _schemasUrl = new String[] { SR.GetString(SR.MarkupSchema_HTML32),
                                         SR.GetString(SR.MarkupSchema_cHTML10) };

            int tabOffset = GenericUI.InitDialog(
                this,
                _dsd,
                _mergingContext
                );

            SetTabIndexes(tabOffset);
            _dsd.RefreshHeader(_mergingContext);
            String currentDeviceSpecificID = _dsd.CurrentDeviceSpecificID;

            if (null != currentDeviceSpecificID && currentDeviceSpecificID.Length > 0)
            {
                DeviceSpecific ds;
                _dsd.GetDeviceSpecific(currentDeviceSpecificID, out ds);
                ((IRefreshableDeviceSpecificEditor)this).Refresh(currentDeviceSpecificID, ds);
            }
            UpdateControlEnabling();
        }
Esempio n. 57
0
        public int CreateSite(ISite site)
        {
            int row = base.ExecuteNonQuery(
                SqlQueryHelper.Format(SP.Site_CreateSite,
                                      new object[, ] {
                { "@name", site.Name },
                { "@dirname", site.DirName },
                { "@domain", site.Domain },
                { "@tpl", site.Tpl },
                { "@language", site.Language },
                { "@note", site.Note },
                { "@seotitle", site.SeoTitle },
                { "@seokeywords", site.SeoKeywords },
                { "@seodescription", site.SeoDescription },
                { "@state", site.State },
                { "@protel", site.Tel },
                { "@prophone", site.Phone },
                { "@profax", site.Fax },
                { "@proaddress", site.Address },
                { "@proemail", site.Email },
                { "@im", site.Im },
                { "@postcode", site.PostCode },
                { "@pronotice", site.Notice },
                { "@proslogan", site.Slogan }
            }),
                //初始化Root数据
                SqlQueryHelper.Format(@"INSERT INTO $PREFIX_categories 
                                        (siteid,pagetitle,moduleid,tag,name,keywords,description,lft,rgt,orderindex)
                                        VALUES((SELECT MAX(siteid) FROM $PREFIX_sites),
                                         'ROOT',1,'root','根栏目','','',1,2,1)
                                        ")
                );



            if (row != 2)
            {
                return(-1);
            }

            return(int.Parse(base.ExecuteScalar(SqlQueryHelper.Format("SELECT MAX(siteid) FROM $PREFIX_sites")).ToString()));
        }
Esempio n. 58
0
            public override void Add(Control value)
            {
                TabPanel tabPanel = value as TabPanel;

                if (tabPanel == null)
                {
                    throw new ArgumentException("Collection may contain only TabPanel instances.");
                }

                //lock subsequent updates
                this.owner.SuspendStripNotifications(true, true);

                if (!this.owner.tabPanels.Contains(tabPanel) && this.owner.tabStripElement != null)
                {
                    tabPanel.TabStripItem = new TabStripItem(tabPanel);
                    tabPanel.TabStripItem.ShowCloseButton = this.owner.showItemCloseButton;
                    this.owner.tabStripElement.AddItem(tabPanel.TabStripItem);
                    tabPanel.TabStripItem.UpdateCloseButton(this.owner);
                }

                base.Add(tabPanel);

                tabPanel.Visible = false;

                ISite site = this.owner.Site;

                if ((site != null) && (tabPanel.Site == null))
                {
                    IContainer container = site.Container;
                    if (container != null)
                    {
                        container.Add(tabPanel);
                    }
                }

                if (this.owner.IsHandleCreated && !TabStripPanel.DisableSelection)
                {
                    this.owner.selectedIndex = this.IndexOf(tabPanel);
                    this.owner.UpdateTabSelection(true);
                }
                this.owner.ResumeStripNotifications(true, true);
            }
Esempio n. 59
0
 protected static object GetInvokee(Type componentClass, object component)
 {
     if (component is IComponent)
     {
         ISite site = ((IComponent)component).Site;
         if (site != null && site.DesignMode)
         {
             IDesignerHost host = site.GetService(typeof(IDesignerHost)) as IDesignerHost;
             if (host != null)
             {
                 IDesigner designer = host.GetDesigner((IComponent)component);
                 if (designer != null && componentClass.IsInstanceOfType(designer))
                 {
                     component = designer;
                 }
             }
         }
     }
     return(component);
 }
Esempio n. 60
0
        public void TwoSites_Users_WonAuctions()
        {
            OtherSite = CreateAndLoadEmptySite(Timezone, OtherSiteName, 360, 7, out OtherAlarmClock);
            User      = CreateAndLogUser(UserName, out UserSession, OtherSite);
            Bidder1   = CreateAndLogUser("bidder1", out Bidder1Session, OtherSite);

            Bidder2 = CreateAndLogUser("bidder2", out Bidder2Session, Site);
            TheAuction.BidOnAuction(Bidder2Session, 8);

            var otherAuction = UserSession.CreateAuction("lidl socks", AlarmClock.Object.Now.AddDays(3), 2);

            otherAuction.BidOnAuction(Bidder1Session, 8);
            SetNowToFutureTime(86400 * 8, AlarmClock);
            SetNowToFutureTime(86400 * 8, OtherAlarmClock);
            Assert.Multiple(() =>
            {
                Assert.That(Bidder1.WonAuctions().Count() == 1);
                Assert.That(Bidder2.WonAuctions().Count() == 1);
            });
        }