Example #1
0
    public void OnSaveData()
    {
        GameControl.Instance.game_data.editor_mode = true;
        GameControl.Instance.game_data.isGamePlay  = true;
        image_datas.Clear();
        ImageControl first_image = null;

        for (int i = 0; i < GameScene.Instance.Operational_Figure_Control.imageList.Count; i++)
        {
            imagedata    data         = new imagedata();
            ImageControl imageControl = GameScene.Instance.Operational_Figure_Control.imageList[i];
            if (first_image == null)
            {
                first_image = imageControl;
            }

            data.index = imageControl.imageIndex;
            //var pos = GameScene.Instance.Operational_Figure_Control.showTextureGo.transform.localPosition - first_image.transform.localPosition;
            //data.pos = imageControl.transform.localPosition + pos;
            data.pos = imageControl.transform.localPosition;
            image_datas.Add(imageControl, data);
        }
        LevelData        level_data = new LevelData();
        List <ImageData> list       = new List <ImageData>();

        foreach (var item in image_datas)
        {
            ImageData data = new ImageData();
            data.ImageType     = (ImageType)item.Value.index;
            data.ImagePosition = item.Value.pos;
            list.Add(data);
        }
        level_data.ImageDatas = list;
        GameScene.Instance.CreateImageOnShiLiPan(level_data);
    }
    private IEnumerator ReDoDragEnd(ImageControl ic)
    {
        yield return(new WaitForSeconds(0.2f));

        this.DoDragEnd(ic, false);
        this.reDoDragEndCoroutine = null;
    }
        public async void GetImagens(StorageFolder picturesFolder)
        {
            ImageControl fileControl = new ImageControl();

            imagens.Clear();
            // s_local = false = local ,,, true = nuvem
            if (!s_local)
            {
                imagens = await fileControl.GetDiskImagesAsync(picturesFolder);
            }
            else
            {
                ProdutosDao dao = new ProdutosDao();
                produtos = await dao.getListAsync();

                List <string> prod_name = new List <string>();
                if (produtos != null)
                {
                    foreach (Produtos prod in produtos)
                    {
                        prod_name.Add(prod.PictureMap);
                    }
                }
                imagens = await fileControl.GetImageWebAsync("http://julianoblanco-001-site3.ctempurl.com/Images/MapsAR/", prod_name);
            }
        }
Example #4
0
        private ImageControl PackageBitmapSourceToControl(BitmapSource imageSource, bool autoAdjust)
        {
            var animatedImage = new AnimatedGif {
                Source = imageSource, Stretch = Stretch.Fill
            };
            var imageControl = new ImageControl(_controlManager)
            {
                IsLockAspect = false,
                Width        = Math.Round(imageSource.Width),
                Height       = Math.Round(imageSource.Height),
                Content      = animatedImage,
                Template     = (ControlTemplate)Resources["MoveResizeRotateTemplate"],
            };

            var transformGroup = new TransformGroup();

            transformGroup.Children.Add(new ScaleTransform(1, 1));
            transformGroup.Children.Add(new RotateTransform(0));

            if (autoAdjust)
            {
                Win32.GetCursorPos(out _curPosition);
                transformGroup.Children.Add(new TranslateTransform(Math.Round(_curPosition.X - imageControl.Width / 2), Math.Round(_curPosition.Y - imageControl.Height / 2)));
            }
            else
            {
                transformGroup.Children.Add(new TranslateTransform(Math.Round((SystemParameters.VirtualScreenWidth - imageControl.Width) / 2), Math.Round((SystemParameters.VirtualScreenHeight - imageControl.Height) / 2)));
            }

            imageControl.RenderTransform = transformGroup;

            return(imageControl);
        }
Example #5
0
        private ImageControl PackageImageToControl(AnimatedGif gif, Point translate)
        {
            var imageControl = new ImageControl(_controlManager);

            var width  = imageControl.Width = ((BitmapSource)gif.Source).Width;
            var height = imageControl.Height = ((BitmapSource)gif.Source).Height;

            imageControl.Content  = gif;
            imageControl.Template = (ControlTemplate)Resources["MoveResizeRotateTemplate"];

            //调整大小
            var initMaxImgSize = _userConfigution.ImageSetting.InitMaxImgSize;

            if (width > height && width > initMaxImgSize)
            {
                imageControl.Height = initMaxImgSize * height / width;
                imageControl.Width  = initMaxImgSize;
            }
            else if (height > width && height > initMaxImgSize)
            {
                imageControl.Height = initMaxImgSize;
                imageControl.Width  = initMaxImgSize * width / height;
            }

            var transformGroup = new TransformGroup();

            transformGroup.Children.Add(new ScaleTransform(1, 1));
            transformGroup.Children.Add(new RotateTransform(0));
            transformGroup.Children.Add(new TranslateTransform(Math.Round((SystemParameters.VirtualScreenWidth - imageControl.Width) / 2 + translate.X), Math.Round((SystemParameters.VirtualScreenHeight - imageControl.Height) / 2 + translate.Y)));
            imageControl.RenderTransform = transformGroup;

            return(imageControl);
        }
Example #6
0
    public QuestionView(Desktop questionDesktop)
    {
        questionDesktop.Dock = DockStyle.Fill;
        Controls.Add(questionDesktop);

        _feedbackQuestion   = (Label)GetControl("FeedbackQuestion");
        _feedbackFrame      = (Frame)GetControl("Feedback");
        _feedbackLabel      = (Label)GetControl("FeedbackLabel");
        _feedbackBackButton = (Button)GetControl("FeedbackBack");

        _exitButton               = (Button)GetControl("ExitButton");
        _questionBody             = (TextArea)GetControl("QuestionBody");
        _answerFrame              = (Frame)GetControl("Answers");
        _supplementalImageFrame   = (Frame)GetControl("SupplementalImageFrame");
        _supplementalImageControl = (ImageControl)GetControl("SupplementalImage");

        _supplementalImageFrame.Visible = false;

        _answerFrame.Controls.Clear();

        _exitButton.MouseClick += new MouseEvent(_exitButton_MouseClick);

        _feedbackBackButton.MouseClick += (s, a) =>
        {
            _feedbackFrame.Visible = false;
            _answerFrame.Visible   = true;
        };
    }
Example #7
0
        protected SandboxMenuComponent(D3DEngine engine, MainScreen screen, SandboxCommonResources commonResources)
        {
            _engine                     = engine;
            _screen                     = screen;
            _commonResources            = commonResources;
            _engine.ScreenSize_Updated += EngineViewPortUpdated;

            _linen = new ImageControl {
                Image = _commonResources.StLinenPattern
            };
            _cubes = new ImageControl {
                Image = _commonResources.StCubesPattern
            };
            _shadow = new ImageControl {
                Image = _commonResources.StShadow
            };
            _logo = new ImageControl {
                Image = _commonResources.StLogo
            };
            _version = new ImageControl {
                Image = _commonResources.StGameName
            };


            DrawOrders.UpdateIndex(0, int.MaxValue - 1);
        }
Example #8
0
        public override void MapFromTableRow(DataRow row)
        {
            var imageControl = new ImageControl();

            try
            {
                var newJsWidget = new UserJustShareWidget()
                {
                    Title      = row["Title"].ToString(),
                    Id         = row["Id"].ToString(),
                    Image      = imageControl.RetrieveImage("classifieds", row["Image"].ToString()),
                    Type       = row["Type"].ToString(),
                    CreateDate = (DateTime)row["CreateDate"],
                    Text       = row["Text"].ToString(),
                    Category   = new ClsGrpSimple(row["Category"].ToString()),
                };
                newJsWidget.LoadMessages(this.UserId);
                newJsWidget.TotalMessages = newJsWidget.Messages.Count();
                this.UserJustShare.Add(newJsWidget);
            }
            catch (Exception e)
            {
                //throw;
                this.isValid = false;
                this.sMsgError.Add("Error:  WidgetUserJustShare.MapFromTableRow.");
                this.sMsgError.Add(e.Message);
                return;
            }
        }
Example #9
0
        private void LoadImage(string picName, StackPanel panel)
        {
            UIElement imageElement = null;

            if (picName.Contains(".gif"))
            {
                imageElement = CreateGif(picName);
            }
            else
            {
                imageElement = CreateOther(picName);
                ImageControl imageControl = new ImageControl();
                imageControl.Control   = imageElement as Image;
                imageControl.BaseWidth = imageControl.Control.Width;
                _ImageList.Add(imageControl);
            }

            panel.Children.Clear();
            if (imageElement == null)
            {
                TextBlock textBlock = new TextBlock();
                textBlock.Text = "加载失败";
                panel.Children.Add(textBlock);
            }
            else
            {
                panel.Width  = double.NaN;
                panel.Height = double.NaN;
                panel.Children.Add(imageElement);
            }
        }
Example #10
0
        protected override void AddItems(string path, ItemType it, CarouselPanel carousel)
        {
            var items = CreateItems(path, it);

            string[] links = new string[] {
                "http://tv.devexpress.com//Content//ASPxGridView//ASPxBinaryImageIntro//ASPxBinaryImageIntro.flv",
                "http://tv.devexpress.com//Content//XtraBars/Lesson4//XtraBars04.flv",
                "http://tv.devexpress.com//Content//AgLayoutControl//AgLayoutPromo1//AgLayoutPromo1.flv",
                "http://tv.devexpress.com//Content//SkinningLibrary//SkinsPromo1//SkinsPromo1.flv",
                "http://tv.devexpress.com//Content//ASPxperience//Lesson1//ASPxperience01.flv",
                "http://tv.devexpress.com//Content//Mehul//AGVFilterControl//AGVFilterControl.flv",
                "http://tv.devexpress.com//Content//ASPxGridView/AGVInitNewRows//AGVInitNewRows.flv",
                "http://tv.devexpress.com//Content//XtraSpellChecker//ASPxSpellChecker01//ASPxSpellChecker01.flv",
                "http://tv.devexpress.com//Content//ASPxGridView//AGVBindArrayList//AGVBindArrayList.flv",
                "http://tv.devexpress.com//Content//Mehul//FreeSilverLight//FreeSilverLightQuestions.flv"
            };
            ImageControl imageControl;
            int          i = 0;

            foreach (var item in items)
            {
                var border = new Border();
                imageControl          = new ImageControl();
                imageControl.Width    = 70;
                imageControl.Height   = 70;
                imageControl.Source   = ((Image)item).Source;
                imageControl.Template = (ControlTemplate)TryFindResource("imageControlTemplate");
                SetMediaPath(imageControl, links[i++]);
                carousel.Children.Add(imageControl);
            }
        }
Example #11
0
    public BiologView(Desktop biologDesktop, IBiologProgress biologData)
    {
        biologDesktop.Dock = DockStyle.Fill;
        Controls.Add(biologDesktop);

        _biologProgress = biologData;
        _biologProgress.BiologEntryScanned += _biologProgress_BiologEntryUnlocked;

        _backgroundTintFrame = (Frame)GetControl("TintFrame");

        // Animation stuff
        _leftSlideFrame      = (Frame)GetControl("LeftSlideFrame");
        _rightSlideFrame     = (Frame)GetControl("RightSlideFrame");
        _centerSlideFrame    = (Frame)GetControl("CenterSlideFrame");
        _topSlideFrame       = (Frame)GetControl("TopSlideFrame");
        _bottomSlideFrame    = (Frame)GetControl("BottomSlideFrame");
        _separatorSlideFrame = (Frame)GetControl("SeparatorSlideFrame");

        // Database stuff
        _databaseList = (FlowLayoutFrame)GetControl("Database List");
        _databaseList.Controls.Clear();
        _databaseList.ForceFlowLayout();
        _databaseScrollFrame         = (Frame)GetControl("DatabaseScrollFrame");
        _databaseScrollFrame.Update += _databaseList_Update;
        _databaseSlider              = (Slider)GetControl("DatabaseSlider");

        // Center content pane stuff
        _centerSlider              = (Slider)GetControl("CenterSlider");
        _centerSlider.Ease         = true;
        _centerScrollFrame         = (Frame)GetControl("Scroll Page");
        _centerContentPage         = (Frame)GetControl("CenterContent");
        _centerScrollFrame.Update += new VoidEvent(_centerScrollPage_Update);

        _summaryTitle = (Label)GetControl("SummaryHeader");
        _summaryLabel = (TextArea)GetControl("SummaryInfo");
        _detailLabel  = (Label)GetControl("DetailInfo");

        // Tags stuff
        _tagsList = (FlowLayoutFrame)GetControl("Tags");
        _tagsList.Controls.Clear();

        _scaleLabel = (Label)GetControl("Scale Number");
        _scaleFrame = (Frame)GetControl("Scalebar");


        // Gallery stuff
        _galleryImage          = (ImageControl)GetControl("Entry");
        _navigatorPreviewFrame = (Frame)GetControl("NavigatorPreviewFrame");
        _navigatorPreviewFrame.Controls.Clear();

        (GetControl("Exit") as Button).MouseClick += (c, s) => { if (ExitButtonPressed != null)
                                                                 {
                                                                     ExitButtonPressed();
                                                                 }
        };

        _3dPreviewTexture = ResourcesExt.Load <RenderTexture>("Biolog/3DPreviews/Biolog3DPreview");

        Initialize();
    }
Example #12
0
 protected void LoadImage()
 {
     if (!ImageSource.Loading)
     {
         try
         {
             ImageSource.LoadImage();
             if (ImageSource.Stream != null)
             {
                 using (DAE.Runtime.Data.Scalar newValue = new DAE.Runtime.Data.Scalar(ImageControl.Source.DataSet.Process.ValueManager, ImageControl.Source.DataSet.Process.DataTypes.SystemGraphic))
                 {
                     using (Stream stream = newValue.OpenStream())
                     {
                         using (ImageSource.Stream)
                         {
                             ImageSource.Stream.Position = 0;
                             StreamUtility.CopyStream(ImageSource.Stream, stream);
                             ImageControl.DataField.Value = newValue;
                             ImageControl.LoadImage();
                         }
                     }
                 }
             }
         }
         finally
         {
             if (ImageSource.GetType() == typeof(ImageCaptureForm))
             {
                 ImageSource = null;
             }
         }
     }
 }
Example #13
0
		private void Build()
		{
			_image = new ImageControl();
			_image.Aspect = ImageAspect.AspectFill;

			Add(_image);
			Add(_widget);
		}
Example #14
0
        /// <summary>
        /// Called when a item is selected.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="eventArgs">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void OnItemSelect(object sender, EventArgs eventArgs)
        {
            this.dropDownButton.Toggle(this, new ButtonStateEventArgs(ButtonState.Off));
            this.DropDownList.Config.Visible = false;
            this.Manager.ForegroundSceneNodes.Children.Remove(this.DropDownList);

            if (this.dropDownListShown)
            {
                this.dropDownListShown = false;
            }

            if (this.OnShowHide != null)
            {
                this.OnShowHide(this, new BooleanEventArgs(false));
            }

            var index = this.DropDownList.SelectedIndex;

            if (index > -1 && index < this.DropDownList.ListBoxItems.Count)
            {
                this.textValue.ConfigText = this.DropDownList.ListBoxItems[index].Text;
                this.ImagePath            = this.DropDownList.ListBoxItems[index].ImagePath;
                this.SetText(this.textValue.ConfigText);

                if (this.OnSelectedItemChanged != null)
                {
                    this.OnSelectedItemChanged(this, new StringEventArgs(this.textValue.ConfigText));
                }

                // Also set our image value if we can
                if (this.imageControlBoxForValue != null)
                {
                    this.Children.Remove(this.imageControlBoxForValue);
                }

                this.imageControlBoxForValue = new ImageControl(this.Name + "-ImageBoxForValue")
                {
                    Config =
                    {
                        PositionX =                           3,
                        PositionY =                           3,
                        Width     = (int)(this.State.Width - 6),
                        Height    = (int)(this.State.Height - 6)
                    },
                    ImagePath = this.ImagePath
                };
                this.Children.Add(this.imageControlBoxForValue);

                // Shift text over
                const float Tolerance = 0.001f;
                if (this.ImagePath != null && Math.Abs(this.textValue.State.DrawPosition.X - 5f) < Tolerance)
                {
                    this.textValue.State.DrawPosition = new DVector2(this.imageControlBoxForValue.State.DrawPosition.X + this.imageControlBoxForValue.State.Width + 5f, this.textValue.State.DrawPosition.Y);
                }
            }

            this.Manager.SetFocusedControl(this.dropDownButton);
        }
Example #15
0
 private void InitLoadImage()
 {
     System.Drawing.Bitmap bitmap = gdalReader.GetBitmap(0, 0, imageInfo.ImageWidth, imageInfo.ImageHeight, 2);
     mapImage = new Image()
     {
         Source  = ImageControl.Bitmap2BitmapImage(bitmap, imageInfo.ImageFormat),
         Stretch = Stretch.Fill
     };
 }
 public ImageSettingWindow(ImageControl imageControl)
 {
     InitializeComponent();
     _imageControl       = imageControl;
     _rotateTransform    = imageControl.GetTransform <RotateTransform>();
     _translateTransform = imageControl.GetTransform <TranslateTransform>();
     _scaleTransform     = imageControl.GetTransform <ScaleTransform>();
     _selectedPixelRbn   = true;
     _textChanged        = false;
 }
Example #17
0
        void OnTapped(object sender, ItemTappedEventArgs e)
        {
            Data.Image   Item = e.Item as Data.Image;
            ImageControl IC   = new ImageControl(Item, manage.GetServerConnector());

            Navigation.PushAsync(new ImageDetail
            {
                BindingContext = IC
            });
        }
Example #18
0
        private ImageControl PackageBaseInfoToControl(ImageControlBaseInfo baseInfo, bool isMove)
        {
            //内存优化
            //var existedImageControl = ImageCanvas.Children.Cast<ImageControl>().FirstOrDefault(m => m.Guid == baseInfo.Guid);
            //AnimatedGif animatedGif;
            //Guid guid;
            //if (existedImageControl == null)
            //{
            //    animatedGif =  new AnimatedGif { Source = baseInfo.ImageSource, Stretch = Stretch.Fill };
            //    guid = Guid.Parse(baseInfo.Guid);
            //}
            //else
            //{
            //    animatedGif = new AnimatedGif
            //    {
            //        Source = (existedImageControl.Content as AnimatedGif)?.Source,
            //        Stretch = Stretch.Fill
            //    };
            //    guid = Guid.NewGuid();
            //}

            //var imageControl = new ImageControl(_controlManager, guid)
            //{
            //    IsLockAspect = baseInfo.IsLockAspect,
            //    Width = baseInfo.Width,
            //    Height = baseInfo.Height,
            //    Content = animatedGif,
            //    Template = (ControlTemplate) Resources["MoveResizeRotateTemplate"],
            //    RenderTransform = baseInfo.RenderTransform,
            //};

            var imageControl = new ImageControl(_controlManager)
            {
                IsLockAspect = baseInfo.IsLockAspect,
                Width        = baseInfo.Width,
                Height       = baseInfo.Height,
                Content      = new AnimatedGif {
                    Source = baseInfo.ImageSource, Stretch = Stretch.Fill
                },
                Template        = (ControlTemplate)Resources["MoveResizeRotateTemplate"],
                RenderTransform = baseInfo.RenderTransform,
            };

            var translateTransform = imageControl.GetTransform <TranslateTransform>();

            if (isMove)
            {
                translateTransform.X += _userConfigution.ImageSetting.PasteMoveUnitDistace * _controlManager.ContinuedAddCount;
                translateTransform.Y += _userConfigution.ImageSetting.PasteMoveUnitDistace * _controlManager.ContinuedAddCount;
            }
            translateTransform.X = Math.Round(translateTransform.X);
            translateTransform.Y = Math.Round(translateTransform.Y);

            return(imageControl);
        }
        /// <summary>
        /// Cargar imagenes del directorio especificado
        /// </summary>
        public void loadImages(string folderPath)
        {
            textBoxFolderPath.Text = browseDialog.SelectedPath;
            panelImages.Controls.Clear();

            if (Directory.Exists(folderPath))
            {
                //Cargar carpetas del directorio
                if (showFolders)
                {
                    //Obtener subdirectorios
                    string[] allDirs = Directory.GetDirectories(folderPath);

                    //Excluir subdirectorios innecesarios
                    List <string> dirs = new List <string>();
                    for (int i = 0; i < allDirs.Length; i++)
                    {
                        if (!allDirs[i].Contains(".svn"))
                        {
                            dirs.Add(allDirs[i]);
                        }
                    }

                    //Crear control para cada directorio
                    foreach (string dir in dirs)
                    {
                        ImageControl imageControl = new ImageControl(dir, this, true);
                        panelImages.Controls.Add(imageControl);
                    }
                }

                //Cargar imagenes del directorio
                List <string> imageFiles = new List <string>();
                for (int i = 0; i < FILE_EXT_SEARCH.Length; i++)
                {
                    imageFiles.AddRange(Directory.GetFiles(folderPath, FILE_EXT_SEARCH[i], SearchOption.TopDirectoryOnly));
                }
                imageFiles.Sort();

                //Crear control para cada imagen
                for (int i = 0; i < imageFiles.Count; i++)
                {
                    string imageFile = imageFiles[i];

                    ImageControl imageControl = new ImageControl(imageFile, this, false);
                    panelImages.Controls.Add(imageControl);
                }

                //Seleccionar primer elemento
                if (panelImages.Controls.Count > 0)
                {
                    ((ImageControl)panelImages.Controls[0]).selectImage();
                }
            }
        }
Example #20
0
        public async Task <IHttpActionResult> UpdateJustshareImage()
        {
            string          captcha    = "";
            var             avatarFile = new byte[0];
            var             provider   = new MultipartMemoryStreamProvider();
            ImageFile       imageFile  = new ImageFile("classifieds", "", 0, "");
            ImageControl    ImgCtrl    = new ImageControl();
            ClaimsPrincipal oPrincipal = (ClaimsPrincipal)Request.GetRequestContext().Principal;

            var userId = oPrincipal.Identity.GetUserId();

            if (userId == null)
            {
                return(BadRequest());
            }

            await Request.Content.ReadAsMultipartAsync(provider);

            foreach (var item in provider.Contents)
            {
                switch (item.Headers.ContentDisposition.Name.Replace("\"", ""))
                {
                case "Id":
                    imageFile.FileName = await item.ReadAsStringAsync();

                    break;

                case "Captcha":
                    captcha = await item.ReadAsStringAsync();

                    break;

                case "ImageFile":
                    imageFile.FileData = await item.ReadAsByteArrayAsync();

                    imageFile.ContentType = item.Headers.ContentType.ToString();
                    break;

                default:
                    break;
                }
            }

            imageFile.FileSize = imageFile.FileData.Length;

            if (Captcha.VerifyResponse(captcha) && imageFile.FileData.Length > 0)
            {
                if (ImgCtrl.UploadImage(imageFile))
                {
                    Ok();
                }
            }

            return(BadRequest());
        }
Example #21
0
 private void RotateThumb_DragStarted(object sender, DragStartedEventArgs e)
 {
     _imageControl = DataContext as ImageControl;
     if (_imageControl == null)
     {
         return;
     }
     _angle       = 0.0;
     _centerPoint = _imageControl.TranslatePoint(new Point(_imageControl.Width / 2, _imageControl.Height / 2), null);
     _startVector = Point.Subtract(Mouse.GetPosition(null), _centerPoint);
 }
Example #22
0
        public static async Task SetControl(this UIKit.UIImageView imageView, ImageControl control)
        {
            imageView.SetBaseControl(control);

            if (control == null)
            {
                return;
            }

            imageView.Image = await GetImage(control.Image);
        }
Example #23
0
    public ContextMessageView(Frame contextMessageFrame)
    {
        _contextMessageFrame                 = contextMessageFrame;
        _contextMessageBackground            = (ImageControl)contextMessageFrame.GetControl("ContextMessageBackground");
        _contextMessageTextArea              = (TextArea)contextMessageFrame.GetControl("ContextMessageLabel");
        _contextMessageTextArea.UseTextColor = false;

        _defaultBackgroundColor = _contextMessageBackground.Color;

        _contextMessageFrame.Animation.Custom(ColorFadeAnimation());
    }
Example #24
0
 private void MoveThumb_DragStarted(object sender, DragStartedEventArgs e)
 {
     _imageControl = DataContext as ImageControl;
     if (_imageControl == null)
     {
         return;
     }
     _moveX         = 0.0;
     _moveY         = 0.0;
     _mousePosition = Mouse.GetPosition(null);
 }
Example #25
0
 public CategoryButton()
 {
     Image = new ImageControl();
     Image.NoEvents = true;
     Image.Size = new Point(14, 14);
     Image.Dock = DockStyle.Right;
     Image.Margin = new Margin(0,3,0,3);
     Image.Texture = "ArrowHead-Down";
     //Image.Opacity = 0.25f;
     Elements.Add(Image);
 }
Example #26
0
        private void SetupControls()
        {
            Children.Add(new BorderControl(BlankTexture, 2, Color.LightGray)
            {
                Bounds = new UniRectangle(10, 36, MinimapTexture.Width, MinimapTexture.Height)
            });

            Children.Add(Minimap = new ImageControl(MinimapTexture)
            {
                Bounds = new UniRectangle(new UniScalar(0, 10), new UniScalar(0, 36), MinimapTexture.Width, MinimapTexture.Height)
            });
        }
Example #27
0
        private static void DicomToThumb(DicomData dcm, out byte[] thumb)
        {
            thumb = null;

            if (dcm.Images.Load())
            {
                var ctrl = dcm.Images.CreateImageControl(0);
                if (ctrl != null)
                {
                    int width  = AppUtil.THUMB_SIZE * 2;
                    int height = AppUtil.THUMB_SIZE * 2;

                    if (ctrl.Width > width || ctrl.Height > height)
                    {
                        if (ctrl.Width <= ctrl.Height)
                        {
                            width = width * ctrl.Width / ctrl.Height;
                        }
                        else
                        {
                            height = height * ctrl.Height / ctrl.Width;
                        }
                        ctrl = new ImageControl(ctrl, new Rectangle(0, 0, ctrl.Width, ctrl.Height), width, height, true);
                    }

                    width  = AppUtil.THUMB_SIZE;
                    height = AppUtil.THUMB_SIZE;

                    if (ctrl.Width <= ctrl.Height)
                    {
                        width = width * ctrl.Width / ctrl.Height;
                    }
                    else
                    {
                        height = height * ctrl.Height / ctrl.Width;
                    }

                    ctrl = new ImageControl(ctrl, new Rectangle(0, 0, ctrl.Width, ctrl.Height), width, height, false);

                    using (var img = ctrl.CreateImage())
                        using (var ms = new MemoryStream())
                            using (var bmp = new Bitmap(AppUtil.THUMB_SIZE, AppUtil.THUMB_SIZE))
                                using (var g = Graphics.FromImage(bmp))
                                {
                                    g.Clear(Color.FromArgb(0, Color.Black));
                                    g.DrawImage(img, (AppUtil.THUMB_SIZE - img.Width) / 2, (AppUtil.THUMB_SIZE - img.Height) / 2);

                                    bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                                    thumb = ms.GetBuffer();
                                }
                }
            }
        }
Example #28
0
 public Task <IRenderedImage> PrepareImage(
     IImageData data,
     PrepareImageParameters parameters,
     CancellationToken cancelToken)
 {
     _imageProcessingTask = Task.Run(async() => {
         var processedData = await ImageControl.PrepareImage(data, parameters, cancelToken);
         await ImgStatisticsVM.UpdateStatistics(data);
         return(processedData);
     }, cancelToken);
     return(_imageProcessingTask);
 }
        private void InitializeComponentInternal()
        {
            _stMenuButton    = ToDispose(new SpriteTexture(_engine.Device, @"Images\MainMenu\menu_button.png", new Vector2I()));
            _stMenuHover     = ToDispose(new SpriteTexture(_engine.Device, @"Images\MainMenu\menu_button_hover.png", new Vector2I()));
            _stMenuDown      = ToDispose(new SpriteTexture(_engine.Device, @"Images\MainMenu\menu_button_down.png", new Vector2I()));
            _stMenuBackLabel = ToDispose(new SpriteTexture(_engine.Device, @"Images\back_label.png", new Vector2I()));

            _form = new Control();

            _windowLabel = new LabelControl()
            {
                Text       = "??????",
                Color      = new ByteColor(198, 0, 75),
                CustomFont = CommonResources.FontBebasNeue35,
                CustomHorizontalPlacement = FlatGuiGraphics.Frame.HorizontalTextAlignment.Center,
                CustomVerticalPlacement   = FlatGuiGraphics.Frame.VerticalTextAlignment.Center
            };

            _leftMenuPanel = new PanelControl()
            {
                Color = Color.WhiteSmoke
            };
            _cubesPatern = new ImageControl()
            {
                Image = CommonResources.StCubesPattern
            };
            _linenPatern = new ImageControl()
            {
                Image = CommonResources.StLinenPattern
            };
            _shadow = new ImageControl()
            {
                Image = CommonResources.StShadow
            };
            _backPanel = new ImageControl()
            {
                Image = CommonResources.StLinenPattern
            };

            _btBack = new ButtonControl
            {
                CustomImage      = _stMenuButton,
                CustomImageDown  = _stMenuDown,
                CustomImageHover = _stMenuHover,
                CusomImageLabel  = _stMenuBackLabel,
                TextFontId       = 1,
                Text             = "Back",
                Color            = new ByteColor(200, 200, 200, 255)
            };
            _btBack.Pressed += delegate { btBackPressed(); };

            InitializeComponent();
        }
Example #30
0
    protected override void Awake()
    {
        base.Awake();

        _renderer = GuiHost.Renderer as UnityRenderer;


        _renderer.InsertTexture(BiologRenderTexture, "biolog3DPreview");
        _biolog3DPreview = (ImageControl)Desktop.GetControl("3DPreview");

        _biolog3DPreview.Texture     = "biolog3DPreview";
        _biolog3DPreview.TextureRect = new Rectangle(0, 0, BiologRenderTexture.width, BiologRenderTexture.height);
    }
Example #31
0
        void button_MouseDrag(Control sender, MouseEventArgs args)
        {
            ActionButton slot = sender as ActionButton;

            ImageControl image = new ImageControl();
            image.Texture = slot.Item.Icon.Texture;
            image.TextureRect = slot.Item.Icon.Rect;
            image.Size = new Point(40, 40);
            image.Position = sender.Location;
            image.Tag = slot.Item;

            DoDragDrop(image);
        }
Example #32
0
 private void MoveThumb_DragCompleted(object sender, DragCompletedEventArgs e)
 {
     if (_imageControl == null)
     {
         return;
     }
     if (_isMove)
     {
         _isMove = false;
         _imageControl.ControlManager.DragMoveSelected(_moveX, _moveY, true);
     }
     _imageControl = null;
 }
Example #33
0
        public CharacterSheet()
        {
            Resizable = true;
            Size = new Point(400, 300);
            Position = new Point(100, 100);
            Titlebar.Text = "Character";

            split = new SplitContainer();
            split.Dock = DockStyle.Fill;
            Controls.Add(split);

            stats = new ScrollView();
            stats.Dock = DockStyle.Fill;
            split.SplitFrame1.Controls.Add(stats);

            paperdoll = new Frame();
            paperdoll.Dock = DockStyle.Fill;
            split.SplitFrame2.Controls.Add(paperdoll);

            ImageControl image = new ImageControl { Texture = "paperdoll.jpg" };
            image.Dock = DockStyle.Fill;
            paperdoll.Controls.Add(image);

            //top = new Frame { Size = new Point(44, 44), Dock = DockStyle.Top }; paperdoll.Controls.Add(top);
            //bottom = new Frame { Size = new Point(44, 44), Dock = DockStyle.Bottom }; paperdoll.Controls.Add(bottom);
            left = new Frame { Size = new Point(44, 44), Dock = DockStyle.Left }; paperdoll.Controls.Add(left);
            right = new Frame { Size = new Point(44, 44), Dock = DockStyle.Right }; paperdoll.Controls.Add(right);

            int i = 0;
            foreach (KeyValuePair<ItemSlotType, ItemSlot> pair in GameLogic.Player.ItemSlots)
            {
                ActionButton button = new ActionButton();
                button.Size = new Point(40, 40);
                button.Style = "button";
                button.Dock = DockStyle.Top;
                button.Margin = new Squid.Margin(2);
                button.AllowDrop = true;
                button.DragDrop += button_DragDrop;
                button.Tooltip = pair.Key.ToString();
                button.Tag = pair.Value;

                if (i < 6)
                    left.Controls.Add(button);
                else
                    right.Controls.Add(button);

                i++;
            }
        }
Example #34
0
        public ColorButton()
        {
            _image = new ImageControl();
            _image.Dock = DockStyle.Fill;
            _image.NoEvents = true;
            _image.Texture = "white";
            Elements.Add(_image);

            _button = new Button();
            _button.Dock = DockStyle.Fill;
            _button.Style = "border";
            Elements.Add(_button);

            _button.MouseClick += Button_MouseClick;
        }
        public void GetImages(string id)
        {
            var request = new GetImagesOfAnimeRequest(id);
            request.ProcessSuccessfully += (data) =>
            {
                var images = (ImagesJson)data;
                if (data == null || images == null) return;
                Deployment.Current.Dispatcher.BeginInvoke(() =>
                {
                    for (int i = 0; i <10; i ++)
                    {
                        var lControl = new ImageControl(images._content[i]);
                        _listImages.Add(lControl);
                    }
                    //Loading.Visibility = Visibility.Collapsed;
                });

            };
            GlobalVariables.WorkerRequest.AddRequest(request);
        }
Example #36
0
        public ActionButton()
        {
            image = new ImageControl();
            image.Dock = DockStyle.Fill;
            image.NoEvents = true;
            image.Texture = "border.dds";
            image.TextureRect = new Rectangle(0, 0, 64, 64);
            Elements.Add(image);

            button = new Button();
            button.Dock = DockStyle.Fill;
            button.Style = "border";
            button.NoEvents = true;
            Elements.Add(button);

            counter = new Label();
            counter.Dock = DockStyle.Top;
            counter.Size = new Point(16, 16);
            counter.TextAlign = Alignment.MiddleRight;
            counter.NoEvents = true;
            Elements.Add(counter);
        }
Example #37
0
		/// <summary>
		/// Creates the UI automation controls for both images and edit boxes.
		/// </summary>
		/// <param name="rawElementProviderRoot">The raw element provider root.</param>
		/// <param name="rootBox">The root box.</param>
		/// <returns></returns>
		public static IList<IRawElementProviderFragment> CreateUIAutomationControls(IChildControlNavigation rawElementProviderRoot,
			IVwRootBox rootBox)
		{
			var controls = new List<IRawElementProviderFragment>();
			foreach (var selection in CollectorEnvServices.CollectPictureAndEditSelectionPoints(rootBox))
			{
				IRawElementProviderFragment control = null;
				if (selection.SelType == VwSelType.kstPicture)
				{
					control = new ImageControl(rawElementProviderRoot,
														rootBox.Site as SimpleRootSite, selection);
				}
				else if (selection.SelType == VwSelType.kstText && selection.IsEditable)
				{
					control = CreateEditControl(rawElementProviderRoot, rootBox, selection);
				}

				if (control != null)
					controls.Add(control);
			}
			return controls;
		}
Example #38
0
		/// <summary>
		/// Creates the UI automation image controls.
		/// </summary>
		/// <param name="rawElementProviderRoot">The raw element provider root.</param>
		/// <param name="rootBox">The root box.</param>
		/// <returns></returns>
		public static IList<IRawElementProviderFragment> CreateUIAutomationImageControls(IChildControlNavigation rawElementProviderRoot,
			IVwRootBox rootBox)
		{
			var imageControls = new List<IRawElementProviderFragment>();
			foreach (var selection in CollectorEnvServices.CollectPictureSelectionPoints(rootBox))
			{
				var imageControl = new ImageControl(rawElementProviderRoot,
					rootBox.Site as SimpleRootSite, selection);
				imageControls.Add(imageControl);
			}
			return imageControls;
		}
        private void CreateEducationThemeAndTemplate()
        {
            SampleUtilities.RegisterTheme(SampleConstants.EducationThemeName, SampleConstants.EducationThemePath);
            SampleUtilities.RegisterTheme(SampleConstants.EducationInGermanThemeName, SampleConstants.EducationInGermanThemePath);

            SampleUtilities.RegisterTemplate(new Guid(SampleConstants.EducationTemplateId), SampleConstants.EducationTemplateName, SampleConstants.EducationTemplateName, SampleConstants.EducationTemplateMasterPage, SampleConstants.EducationThemeName, CultureInfo.GetCultureInfo("en"));
            var result = SampleUtilities.RegisterTemplate(new Guid(SampleConstants.EducationTemplateId), SampleConstants.EducationInGermanTemplateName, SampleConstants.EducationInGermanTemplateName, SampleConstants.EducationTemplateMasterPage, SampleConstants.EducationInGermanThemeName, CultureInfo.GetCultureInfo("de"));

            if (result)
            {
                // Main layout
                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 50),
                    ColumnWidthPercentage = 70,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnWidthPercentage = 30,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);
                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Header";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), mainLayoutControl, "headerInfo", "Header");

                // Logo
                var logoBlock = new ContentBlock();
                logoBlock.Html = string.Format(@"<h1><a href=""[pages]{0}"">Telerik International University</a></h1> <h3>established 2005, Sofia</h3>", SampleConstants.HomePageId);
                logoBlock.CssClass = "sfContentBlock";
                string logoId = SampleUtilities.AddLocalizedControlToTemplate(new Guid(SampleConstants.EducationTemplateId), logoBlock, "Header_Left", "Content block", "en");

                Dictionary<string, object> logoProperties = new Dictionary<string, object>();

                logoProperties.Add("Html", string.Format(@"<h1><a href=""[pages]{0}"">Internationale Universit&auml;t Telerik</a></h1> <h3>gegr&uuml;ndet im 2005, in Sofia</h3>", SampleConstants.HomePageId));
                SampleUtilities.UpdateLocalizedControlInTemplate(logoId, new Guid(SampleConstants.EducationTemplateId), logoProperties, "de");

                // Language/search layout
                var languagesSearchLayoutControl = new LayoutControl();
                List<ColumnDetails> languagesSearchLayoutColumns = new List<ColumnDetails>();
                ColumnDetails languagesSearchLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 46,
                    PlaceholderId = "Left"
                };
                languagesSearchLayoutColumns.Add(languagesSearchLayoutColumn1);
                ColumnDetails languagesSearchLayoutColumn2 = new ColumnDetails()
                {
                    ColumnWidthPercentage = 54,
                    PlaceholderId = "Right"
                };
                languagesSearchLayoutColumns.Add(languagesSearchLayoutColumn2);
                languagesSearchLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(languagesSearchLayoutColumns, string.Empty);
                languagesSearchLayoutControl.ID = "LanguageSearch";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), languagesSearchLayoutControl, "Header_Right", "Language and Search");

                // Language
                var languages = new LanguageSelectorControl();
                languages.SelectorType = LanguageSelectorType.Vertical;
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), languages, "LanguageSearch_Right", "Language selector");

                // Login layout
                //var loginLayoutControl = new LayoutControl();
                //List<ColumnDetails> loginLayoutColumns = new List<ColumnDetails>();
                //ColumnDetails loginLayoutColumn1 = new ColumnDetails()
                //{
                //    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                //    PlaceholderId = "Center"
                //};
                //loginLayoutColumns.Add(loginLayoutColumn1);
                //loginLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(loginLayoutColumns, "login-status");
                //loginLayoutControl.ID = "Login";
                //SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), loginLayoutControl, "Header_Right", "Login");

                //// Login name
                //LoginNameControl loginNameControl = new LoginNameControl();
                //SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), loginNameControl, "Login_Center", "Login name");

                //// Login status
                //LoginStatusControl loginStatusControl = new LoginStatusControl();
                //SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), loginStatusControl, "Login_Center", "Login status");

                // Image
                ImageControl headerImage = new ImageControl();
                headerImage.ImageId = SampleUtilities.GetLocalizedImageId("the_building", "en");
                headerImage.CssClass = "headerImage";
                string controlId = SampleUtilities.AddLocalizedControlToTemplate(new Guid(SampleConstants.EducationTemplateId), headerImage, "image", "Image", "en");

                Dictionary<string, object> properties = new Dictionary<string, object>();
                properties.Add("ImageId", SampleUtilities.GetLocalizedImageId("headerspring1", "de"));
                SampleUtilities.UpdateLocalizedControlInTemplate(controlId, new Guid(SampleConstants.EducationTemplateId), properties, "de");

                // Explore your potentials
                ContentBlockBase exploreContentBlock = new ContentBlockBase();
                exploreContentBlock.Html = @"<h4>Explore your potentials</h4> <p>Share your voice and unlock your potentials while we will equip you with the skills you need for the future!</p>";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), exploreContentBlock, "tagline", "Content block");

                // Header navigation
                var headerNavigationControl = new NavigationControl();
                headerNavigationControl.NavigationMode = NavigationModes.HorizontalSimple;
                headerNavigationControl.SelectionMode = PageSelectionModes.TopLevelPages;
                headerNavigationControl.Skin = "education";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), headerNavigationControl, "header", "Navigation");

                // Footer navigation
                var footerNavigationControl = new NavigationControl();
                footerNavigationControl.NavigationMode = NavigationModes.SiteMapInColumns;
                footerNavigationControl.SelectionMode = PageSelectionModes.TopLevelPages;
                footerNavigationControl.Skin = "footer";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.EducationTemplateId), footerNavigationControl, "footernavigation", "Navigation");
            }
        }
        private void CreateFacebookThemeAndTemplate()
        {
            SampleUtilities.RegisterTheme(SampleConstants.FacebookThemeName, SampleConstants.FacebookThemePath);

            var result = SampleUtilities.RegisterTemplate(new Guid(SampleConstants.FacebookTemplateId), SampleConstants.FacebookTemplateName, SampleConstants.FacebookTemplateName,
                SampleConstants.FacebookTemplateMasterPage, SampleConstants.FacebookThemeName, CultureInfo.GetCultureInfo("en"));

            if (result)
            {
                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 100,
                    PlaceholderId = "Center"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, "header");
                mainLayoutControl.ID = "Header";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), mainLayoutControl, "content_inside", "100% (custom)");

                // Logo
                var logoBlock = new ContentBlock();
                logoBlock.Html = @"<h1>Telerik International University</h1>";
                logoBlock.CssClass = "sfContentBlock";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), logoBlock, "Header_Center", "Content block");

                // Image
                ImageControl universityImage = new ImageControl();
                universityImage.ImageId = SampleUtilities.GetLocalizedImageId("university_520", "en");
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), universityImage, "Header_Center", "Image");

                var contentLayoutControl = new LayoutControl();
                List<ColumnDetails> contentLayoutColumns = new List<ColumnDetails>();
                ColumnDetails contentLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 100,
                    PlaceholderId = "Center"
                };
                contentLayoutColumns.Add(contentLayoutColumn1);
                contentLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(contentLayoutColumns, "content");
                contentLayoutControl.ID = "Content";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), contentLayoutControl, "Header_Center", "100% (custom)");

                var footerLayoutControl = new LayoutControl();
                List<ColumnDetails> footerLayoutColumns = new List<ColumnDetails>();
                ColumnDetails footerLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 50,
                    PlaceholderId = "Left"
                };
                footerLayoutColumns.Add(footerLayoutColumn1);
                ColumnDetails footerLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 50,
                    PlaceholderId = "Right"
                };
                footerLayoutColumns.Add(footerLayoutColumn2);
                footerLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(footerLayoutColumns, "footer");
                footerLayoutControl.ID = "Footer";
                SampleUtilities.AddControlToTemplate(new Guid(SampleConstants.FacebookTemplateId), footerLayoutControl, "Header_Center", "50% + 50% (custom)");
            }
        }
Example #41
0
 public static ImageControl AddImage(this Control parent, string textureName, int x, int y, int width, int height)
 {
     var image = new ImageControl();
     image.Parent = parent;
     image.Position = new Point(x, y);
     image.Size = new Point(width, height);
     image.Texture = textureName;
     return image;
 }
        private void CreateCampusMapPage()
        {
            var result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.CampusMapPageId), "Campus map", new Guid(SampleConstants.CampusLifePageId), "en");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), new Guid(SampleConstants.EducationTemplateId), "en");

                ContentBlockBase campusMapBlock = new ContentBlockBase();
                campusMapBlock.Html = @"<h2>Campus map</h2>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), campusMapBlock, "content", "Content block", "en");

                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 25,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 75,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), mainLayoutControl, "content", "25% + 75%", "en");

                var navigationControl = new NavigationControl();
                navigationControl.NavigationMode = NavigationModes.VerticalSimple;
                navigationControl.SelectionMode = PageSelectionModes.CurrentPageSiblings;
                navigationControl.Skin = "left";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), navigationControl, "Main_Left", "Navigation", "en");

                ImageControl campusMapImage = new ImageControl();
                campusMapImage.ImageId = SampleUtilities.GetLocalizedImageId("campus", "en");
                campusMapImage.Width = 676;
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), campusMapImage, "Main_Right", "Image", "en");

                var legendHeaderLayoutControl = new LayoutControl();
                List<ColumnDetails> legendHeaderLayoutColumns = new List<ColumnDetails>();
                ColumnDetails legendHeaderLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 100,
                    PlaceholderId = "Center"
                };
                legendHeaderLayoutColumns.Add(legendHeaderLayoutColumn1);

                legendHeaderLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(legendHeaderLayoutColumns, string.Empty);
                legendHeaderLayoutControl.ID = "LegendHeader";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendHeaderLayoutControl, "Main_Right", "100%", "en");

                ContentBlock legendBlock = new ContentBlock();
                legendBlock.Html = @"<h3>Legend</h3>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendBlock, "LegendHeader_Center", "Content block", "en");

                var legendLayoutControl = new LayoutControl();
                List<ColumnDetails> legendLayoutColumns = new List<ColumnDetails>();
                ColumnDetails legendLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Left33"
                };
                legendLayoutColumns.Add(legendLayoutColumn1);
                ColumnDetails legendLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 34,
                    PlaceholderId = "Middle34"
                };
                legendLayoutColumns.Add(legendLayoutColumn2);
                ColumnDetails legendLayoutColumn3 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Right33"
                };
                legendLayoutColumns.Add(legendLayoutColumn3);

                legendLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(legendLayoutColumns, string.Empty);
                legendLayoutControl.ID = "Legend";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendLayoutControl, "Main_Right", "33% + 34% + 33%", "en");

                ContentBlockBase contentBlockLeft = new ContentBlockBase();
                contentBlockLeft.Html = @"1. Dorm A (Ryan Mcguire)<br /> 2. Fine Arts building<br /> 3. Computing center<br /> 4. Dorm B (Tomas Newman)";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockLeft, "Legend_Left33", "Content block", "en");

                ContentBlockBase contentBlockMiddle = new ContentBlockBase();
                contentBlockMiddle.Html = @"5. Biology faculty<br /> 6. Chemistry building<br /> 7. Dorm C (Micheal Burgess)<br /> 8. Administration center";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockMiddle, "Legend_Middle34", "Content block", "en");

                ContentBlockBase contentBlockRight = new ContentBlockBase();
                contentBlockRight.Html = @"9. Athletics facilities<br /> 10.Main Building<br /> 11.Liberal arts building<br /> 12. Dorm D (Melvin Richards)";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockRight, "Legend_Right33", "Content block", "en");
            }

            result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.CampusMapPageId), "Campus-Karte", "de");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), new Guid(SampleConstants.EducationTemplateId), "de");

                ContentBlockBase campusMapBlockDE = new ContentBlockBase();
                campusMapBlockDE.Html = @"<h2>Campus-Karte</h2>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), campusMapBlockDE, "content", "Content block", "de");

                var mainLayoutControlDE = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 25,
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 75,
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControlDE.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControlDE.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), mainLayoutControlDE, "content", "25% + 75%", "de");

                var navigationControlDE = new NavigationControl();
                navigationControlDE.NavigationMode = NavigationModes.VerticalSimple;
                navigationControlDE.SelectionMode = PageSelectionModes.CurrentPageSiblings;
                navigationControlDE.Skin = "left";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), navigationControlDE, "Main_Left", "Navigation", "de");

                ImageControl campusMapImageDE = new ImageControl();
                campusMapImageDE.ImageId = SampleUtilities.GetLocalizedImageId("campus", "de");
                campusMapImageDE.Width = 676;
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), campusMapImageDE, "Main_Right", "Image", "de");

                var legendHeaderLayoutControlDE = new LayoutControl();
                List<ColumnDetails> legendHeaderLayoutColumns = new List<ColumnDetails>();
                ColumnDetails legendHeaderLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 100,
                    PlaceholderId = "Center"
                };
                legendHeaderLayoutColumns.Add(legendHeaderLayoutColumn1);

                legendHeaderLayoutControlDE.Layout = SampleUtilities.GenerateLayoutTemplate(legendHeaderLayoutColumns, string.Empty);
                legendHeaderLayoutControlDE.ID = "LegendHeader";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendHeaderLayoutControlDE, "Main_Right", "100%", "de");

                ContentBlock legendBlockDE = new ContentBlock();
                legendBlockDE.Html = @"<h3>Legend</h3>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendBlockDE, "LegendHeader_Center", "Content block", "de");

                var legendLayoutControlDE = new LayoutControl();
                List<ColumnDetails> legendLayoutColumns = new List<ColumnDetails>();
                ColumnDetails legendLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Left33"
                };
                legendLayoutColumns.Add(legendLayoutColumn1);
                ColumnDetails legendLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 34,
                    PlaceholderId = "Middle34"
                };
                legendLayoutColumns.Add(legendLayoutColumn2);
                ColumnDetails legendLayoutColumn3 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Right33"
                };
                legendLayoutColumns.Add(legendLayoutColumn3);

                legendLayoutControlDE.Layout = SampleUtilities.GenerateLayoutTemplate(legendLayoutColumns, string.Empty);
                legendLayoutControlDE.ID = "Legend";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), legendLayoutControlDE, "Main_Right", "33% + 34% + 33%", "de");

                ContentBlockBase contentBlockLeftDE = new ContentBlockBase();
                contentBlockLeftDE.Html = @"1. Dorm A (Ryan Mcguire)<br /> 2. Fine Arts building<br /> 3. Computing center<br /> 4. Dorm B (Tomas Newman)";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockLeftDE, "Legend_Left33", "Content block", "de");

                ContentBlockBase contentBlockMiddleDE = new ContentBlockBase();
                contentBlockMiddleDE.Html = @"5. Biology faculty<br /> 6. Chemistry building<br /> 7. Dorm C (Micheal Burgess)<br /> 8. Administration center";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockMiddleDE, "Legend_Middle34", "Content block", "de");

                ContentBlockBase contentBlockRightDE = new ContentBlockBase();
                contentBlockRightDE.Html = @"9. Athletics facilities<br /> 10.Main Building<br /> 11.Liberal arts building<br /> 12. Dorm D (Melvin Richards)";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.CampusMapPageId), contentBlockRightDE, "Legend_Right33", "Content block", "de");
            }
        }
        private void CreateTIUFacebookPage()
        {
            var result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), "TIU Facebook", new Guid(SampleConstants.FacebookFanPagesGroupPageId), "en");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), new Guid(SampleConstants.FacebookTemplateId), "en");

                ImageControl fansImage = new ImageControl();
                fansImage.ImageId = SampleUtilities.GetLocalizedImageId("fans", "en");
                fansImage.CssClass = "sfimageWrp";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), fansImage, "Content_Center", "Image", "en");

                ContentBlockBase welcomeBlock = new ContentBlockBase();
                welcomeBlock.Html = @"<h1>Welcome to TIU</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), welcomeBlock, "Content_Center", "Content block", "en");

                var mainLayoutControl = new LayoutControl();
                List<ColumnDetails> mainLayoutColumns = new List<ColumnDetails>();
                ColumnDetails mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 10),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Left33"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);
                ColumnDetails mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 12),
                    ColumnWidthPercentage = 34,
                    PlaceholderId = "Middle34"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);
                ColumnDetails mainLayoutColumn3 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 10, 0, 12),
                    ColumnWidthPercentage = 33,
                    PlaceholderId = "Right33"
                };
                mainLayoutColumns.Add(mainLayoutColumn3);
                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), mainLayoutControl, "Content_Center", "33% + 34% + 33% (custom)", "en");

                ContentBlockBase leftHeaderBlock = new ContentBlockBase();
                leftHeaderBlock.Html = @"<h3>The Campus</h3>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), leftHeaderBlock, "Main_Left33", "Content block", "en");

                ContentBlockBase middleHeaderBlock = new ContentBlockBase();
                middleHeaderBlock.Html = @"<h3>The University</h3>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), middleHeaderBlock, "Main_Middle34", "Content block", "en");

                ContentBlockBase rightHeaderBlock = new ContentBlockBase();
                rightHeaderBlock.Html = @"<h3>Sofia</h3>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), rightHeaderBlock, "Main_Right33", "Content block", "en");

                ImageControl leftImage = new ImageControl();
                leftImage.ImageId = SampleUtilities.GetLocalizedImageId("campus_small", "en");
                leftImage.CssClass = "sfimageWrp";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), leftImage, "Main_Left33", "Image", "en");

                ImageControl middleImage = new ImageControl();
                middleImage.ImageId = SampleUtilities.GetLocalizedImageId("uni_small", "en");
                middleImage.CssClass = "sfimageWrp";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), middleImage, "Main_Middle34", "Image", "en");

                ImageControl rightImage = new ImageControl();
                rightImage.ImageId = SampleUtilities.GetLocalizedImageId("sofia1_small", "en");
                rightImage.CssClass = "sfimageWrp";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), rightImage, "Main_Right33", "Image", "en");

                ContentBlockBase leftBlock = new ContentBlockBase();
                leftBlock.Html = @"<p>The Telerik International University campus is one of the most congenial places to study. Situated near the city centre of Sofia, the campus is spacious without being overwhelming.</p>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), leftBlock, "Main_Left33", "Content block", "en");

                ContentBlockBase middleBlock = new ContentBlockBase();
                middleBlock.Html = @"<p>The Telerik International University was founded in 2008. It is one of the new, modern universities in Bulgaria, and with approximately 1,500 students it is of a manageable size.</p>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), middleBlock, "Main_Middle34", "Content block", "en");

                ContentBlockBase rightBlock = new ContentBlockBase();
                rightBlock.Html = @"<p>Sofia is one of the oldest cities in Europe. The Romans founded the city in 29 B.C. In the late Middle Ages and the Renaissance, the city developed into a trade and finance metropolis.</p>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.TIUFacebookPageId), rightBlock, "Main_Right33", "Content block", "en");
            }
        }
        private void LoadImage(string picName, StackPanel panel)
        {
            UIElement imageElement = null;
            if (picName.Contains(".gif"))
            {
                imageElement = CreateGif(picName);
            }
            else
            {
                imageElement = CreateOther(picName);
                ImageControl imageControl = new ImageControl();
                imageControl.Control = imageElement as Image;
                imageControl.BaseWidth = imageControl.Control.Width;
                _ImageList.Add(imageControl);
            }

            panel.Children.Clear();
            if (imageElement == null)
            {
                TextBlock textBlock = new TextBlock();
                textBlock.Text = "加载失败";
                panel.Children.Add(textBlock);
            }
            else
            {
                panel.Width = double.NaN;
                panel.Height = double.NaN;
                panel.Children.Add(imageElement);
            }
        }
        /// <summary>
        /// Registers the template.
        /// </summary>
        private void RegisterTemplate()
        {

            var present = this.pageManager.CreatePresentationItem<TemplatePresentation>();
            present.DataType = Presentation.HtmlDocument;
            present.Name = "master";
            var resName = "Telerik.Sitefinity.Resources.Pages.Frontend.aspx";
            present.Data = ControlUtilities.GetTextResource(resName, Config.Get<ControlsConfig>().ResourcesAssemblyInfo);

            pageTemplate.MasterPage = string.Concat("~/App_Data/Sitefinity/WebsiteTemplates/", pageTemplate.Name, "/App_Master/page.master");


            var sibling = new Guid();

            for (int i = 0; i < templateobject.layout.placeholders.Length; i++)
            {
                var placeholder = templateobject.layout.placeholders[i];

                //var layout = new LayoutControl();

                //var ctrlData = this.pageManager.CreateControl<TemplateControl>();


                //if (placeholder.layoutwidget != null)
                //{
                //    layout.Layout = createPlaceholderLayout(placeholder.layoutwidget.columns, placeholder.id);

                //}

                //ctrlData.ObjectType = layout.GetType().FullName;
                //ctrlData.PlaceHolder = "Body";
                //ctrlData.SiblingId = sibling;
                //sibling = ctrlData.Id;
                //ctrlData.Caption = placeholder.id;

                //this.pageManager.ReadProperties(layout, ctrlData);
                //this.pageManager.SetControlId(pageTemplate, ctrlData);


                for (int j = 0; j < placeholder.layoutwidget.columns.Length; j++)
                {

                    var column = placeholder.layoutwidget.columns[j];

                    var widget = column.widget;
                    if (widget.type != null)
                    {
                        ControlData ctrlData = null;
                        if (widget.type.ToLower() == "content block")
                        {
                            ContentBlockBase newContentBlock = new ContentBlockBase();
                            newContentBlock.Html = widget.properties.text;
                            newContentBlock.CssClass = widget.cssclass;
                            newContentBlock.LayoutTemplatePath = "~/SFRes/Telerik.Sitefinity.Resources.Templates.Backend.GenericContent.ContentBlock.ascx";

                            var templateContentBlock = pageManager.CreateControl<Telerik.Sitefinity.Pages.Model.TemplateControl>(newContentBlock, widget.sfID);
                            templateContentBlock.Caption = "Content Block";

                            pageTemplate.Controls.Add(templateContentBlock);
                            ctrlData = templateContentBlock;
                        }
                        else if (widget.type.ToLower() == "image")
                        {
                            ImageControl newImage = new ImageControl();
                            newImage.LayoutTemplatePath = "~/SFRes/Telerik.Sitefinity.Resources.Templates.PublicControls.ImageControl.ascx";
                            newImage.CssClass = widget.cssclass;
                            newImage.ImageId = GetImageId(widget.properties.filename, pageTemplate.Name);

                            var templateImageControl = pageManager.CreateControl<Telerik.Sitefinity.Pages.Model.TemplateControl>(newImage, widget.sfID);
                            templateImageControl.Caption = "Image";

                            pageTemplate.Controls.Add(templateImageControl);
                            ctrlData = templateImageControl;

                        }
                        else if (widget.type.ToLower() == "navigation")
                        {

                            string type = widget.properties.navigationtype;
                            NavigationControl navigation = new NavigationControl();

                            navigation.SelectionMode = PageSelectionModes.TopLevelPages;
                            NavigationModes navigationMode;

                            switch (type)
                            {
                                case "horizontalcontrol": navigationMode = NavigationModes.HorizontalSimple;
                                    break;

                                case "horizontal2levelscontrol": navigationMode = NavigationModes.HorizontalDropDownMenu;
                                    break;

                                case "tabscontrol": navigationMode = NavigationModes.HorizontalTabs;
                                    break;

                                case "verticalcontrol": navigationMode = NavigationModes.VerticalSimple;
                                    break;

                                case "treeviewcontrol": navigationMode = NavigationModes.VerticalTree;
                                    break;

                                case "sitemapcontrol": navigationMode = NavigationModes.SiteMapInColumns;
                                    break;

                                default: navigationMode = NavigationModes.HorizontalSimple;
                                    break;
                            }

                            navigation.NavigationMode = navigationMode;
                            navigation.Skin = widget.cssclass;

                            var templateNavigationControl = pageManager.CreateControl<Telerik.Sitefinity.Pages.Model.TemplateControl>(navigation, widget.sfID);
                            templateNavigationControl.Caption = "Navigation";

                            pageTemplate.Controls.Add(templateNavigationControl);
                            ctrlData = templateNavigationControl;

                        }

                        var widgetCulture = this.GetCurrentLanguage();
                        pageManager.SetControlId(pageTemplate, ctrlData, widgetCulture);
                    }
                }

                //pageTemplate.Controls.Add(ctrlData);
            }

            pageTemplate.Category = Telerik.Sitefinity.Abstractions.SiteInitializer.CustomTemplatesCategoryId;
            pageManager.SaveChanges();

            // publish the template
            var draft = pageManager.EditTemplate(pageTemplate.Id);
            var master = pageManager.TemplatesLifecycle.CheckOut(draft);
            master = pageManager.TemplatesLifecycle.CheckIn(master);
            pageManager.TemplatesLifecycle.Publish(master);
            pageManager.SaveChanges();

        }
Example #46
0
 public static ImageControl AddImage(this Control parent, string textureName ,int width, int height, DockStyle dockStyle)
 {
     var image = new ImageControl();
     image.Parent = parent;
     image.Dock = dockStyle;
     image.Size = new Point(width, height);
     image.Texture = textureName;
     return image;
 }
 private void CBNewImage_CheckedChanged(object sender, EventArgs e)
 {
     if (CBNewImage.Checked)
     {
         UncheckOtherCheckboxes(sender);
         ImageControl control = new ImageControl(graphicsControl1, graphicsControl1.MainDialog, data);
         graphicsControl1.Create(control);
     }
     else
         CancelIfNoneChecked();
 }
        // PAGES:

        private void CreateHomePage()
        {
            var result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.HomePageId), "Home", true, false, "en");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.HomePageId), new Guid(SampleConstants.EducationTemplateId), "en");

                var mainLayoutControl = new LayoutControl();
                var mainLayoutColumns = new List<ColumnDetails>();

                var mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 15, 0, 0),
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);

                var mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 15),
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), mainLayoutControl, "content", "50% + 50% (custom)", "en");

                //Left content

                #region Latest News Content Block

                var latestNewsBlockLayout = new LayoutControl();
                var latestNewsBlockLayoutColumns = new List<ColumnDetails>();

                var latestNewsBlockLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                latestNewsBlockLayoutColumns.Add(latestNewsBlockLayoutColumn1);

                latestNewsBlockLayout.Layout = SampleUtilities.GenerateLayoutTemplate(latestNewsBlockLayoutColumns, string.Empty);
                latestNewsBlockLayout.ID = "LatestNewsBlockLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), latestNewsBlockLayout, "Main_Left", "100%", "en");

                ContentBlockBase latestNewsBlock = new ContentBlockBase();
                latestNewsBlock.Html = @"<h1>Latest university news</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), latestNewsBlock, "LatestNewsBlockLayout_Content", "Content block", "en");

                #endregion

                #region Latest News View

                var latestNewsViewLayout = new LayoutControl();
                var latestNewsViewLayoutColumns = new List<ColumnDetails>();

                var latestNewsViewLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                latestNewsViewLayoutColumns.Add(latestNewsViewLayoutColumn1);

                latestNewsViewLayout.Layout = SampleUtilities.GenerateLayoutTemplate(latestNewsViewLayoutColumns, string.Empty);
                latestNewsViewLayout.ID = "LatestNewsViewLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), latestNewsViewLayout, "Main_Left", "100%", "en");

                NewsView latestNews = new NewsView();
                latestNews.MasterViewName = SampleConstants.EducationNewsSummaryContentViewName;
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), latestNews, "LatestNewsViewLayout_Content", "News", "en");

                #endregion

                #region Videos Content Block

                var videosBlockLayout = new LayoutControl();
                var videosBlockLayoutColumns = new List<ColumnDetails>();

                var videosBlockLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                videosBlockLayoutColumns.Add(videosBlockLayoutColumn1);

                videosBlockLayout.Layout = SampleUtilities.GenerateLayoutTemplate(videosBlockLayoutColumns, string.Empty);
                videosBlockLayout.ID = "VideosBlockLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), videosBlockLayout, "Main_Left", "100%", "en");

                ContentBlockBase videosBlock = new ContentBlockBase();
                videosBlock.Html = @"<h1>Videos</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), videosBlock, "VideosBlockLayout_Content", "Content block", "en");

                #endregion

                #region Videos view

                var videosViewLayout = new LayoutControl();
                var videosViewLayoutColumns = new List<ColumnDetails>();

                var videosViewLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                videosViewLayoutColumns.Add(videosViewLayoutColumn1);

                videosViewLayout.Layout = SampleUtilities.GenerateLayoutTemplate(videosViewLayoutColumns, string.Empty);
                videosViewLayout.ID = "VideosViewLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), videosViewLayout, "Main_Left", "100%", "en");

                VideosView videoGallery = new VideosView();
                videoGallery.MasterViewName = SampleConstants.VideosEducationFrontendLightBoxViewName;
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), videoGallery, "VideosViewLayout_Content", "Video gallery", "en");

                #endregion

                #region Meet us Image

                var meetUsImageLayout = new LayoutControl();
                var meetUsImageLayoutColumns = new List<ColumnDetails>();

                var meetUsImageLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                meetUsImageLayoutColumns.Add(meetUsImageLayoutColumn1);

                meetUsImageLayout.Layout = SampleUtilities.GenerateLayoutTemplate(meetUsImageLayoutColumns, string.Empty);
                meetUsImageLayout.ID = "MeetUsImageLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), meetUsImageLayout, "Main_Left", "100%", "en");

                ImageControl meetUsImage = new ImageControl();
                meetUsImage.CssClass = "sfimageWrp bottomImage";
                meetUsImage.ImageId = SampleUtilities.GetLocalizedImageId("1meet_us", "en");
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), meetUsImage, "MeetUsImageLayout_Content", "Image", "en");

                #endregion

                //Right content

                #region Upcoming events block

                var upcomingEventsBlockLayout = new LayoutControl();
                var upcomingEventsBlockLayoutColumns = new List<ColumnDetails>();

                var upcomingEventsBlockLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                upcomingEventsBlockLayoutColumns.Add(upcomingEventsBlockLayoutColumn1);

                upcomingEventsBlockLayout.Layout = SampleUtilities.GenerateLayoutTemplate(upcomingEventsBlockLayoutColumns, string.Empty);
                upcomingEventsBlockLayout.ID = "UpcomingEventsBlockLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), upcomingEventsBlockLayout, "Main_Right", "100%", "en");

                ContentBlockBase upcomingEventsBlock = new ContentBlockBase();
                upcomingEventsBlock.Html = @"<h1>Upcoming events</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), upcomingEventsBlock, "UpcomingEventsBlockLayout_Content", "Content block", "en");

                #endregion

                #region Upcoming events image

                var upcomingEventsImageLayout = new LayoutControl();
                var upcomingEventsImageLayoutColumns = new List<ColumnDetails>();

                var upcomingEventsImageLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                upcomingEventsImageLayoutColumns.Add(upcomingEventsImageLayoutColumn1);

                upcomingEventsImageLayout.Layout = SampleUtilities.GenerateLayoutTemplate(upcomingEventsImageLayoutColumns, string.Empty);
                upcomingEventsImageLayout.ID = "UpcomingEventsImageLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), upcomingEventsImageLayout, "Main_Right", "100%", "en");

                ImageControl upcomingEventsImage = new ImageControl();
                upcomingEventsImage.ImageId = SampleUtilities.GetLocalizedImageId("event", "en");
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), upcomingEventsImage, "UpcomingEventsImageLayout_Content", "Image", "en");

                #endregion

                #region Welcome block

                var welcomeBlockLayout = new LayoutControl();
                var welcomeBlockLayoutColumns = new List<ColumnDetails>();

                var welcomeBlockLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                welcomeBlockLayoutColumns.Add(welcomeBlockLayoutColumn1);

                welcomeBlockLayout.Layout = SampleUtilities.GenerateLayoutTemplate(welcomeBlockLayoutColumns, string.Empty);
                welcomeBlockLayout.ID = "WelcomeBlockLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), welcomeBlockLayout, "Main_Right", "100%", "en");

                ContentBlockBase welcomeBlock = new ContentBlockBase();
                Guid deanImageId = SampleUtilities.GetLocalizedImageId("dadean", "en");
                //string deanImageUrl = SampleUtilities.GetLocalizedImageDefaultUrl("dadean", "en");

                welcomeBlock.Html = string.Format(@"<h1>Welcome from the dean</h1> <p><img alt="""" src=""[images]{0}"" /><em>Welcome to Telerik International University. As dean of the university, I am proud of what we have to offer, and I am delighted that you are interested in learning more about us. Our region has a fascinating history, a creative arts community and fantastic recreational opportunities.</em><br /> <br /> </p>", deanImageId);
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), welcomeBlock, "WelcomeBlockLayout_Content", "Content block", "en");

                #endregion

                #region Photos block

                var photosBlockLayout = new LayoutControl();
                var photosBlockLayoutColumns = new List<ColumnDetails>();

                var photosBlockLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                photosBlockLayoutColumns.Add(photosBlockLayoutColumn1);

                photosBlockLayout.Layout = SampleUtilities.GenerateLayoutTemplate(photosBlockLayoutColumns, string.Empty);
                photosBlockLayout.ID = "PhotosBlockLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), photosBlockLayout, "Main_Right", "100%", "en");

                ContentBlockBase photosBlock = new ContentBlockBase();
                photosBlock.Html = @"<h1>Photos</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), photosBlock, "PhotosBlockLayout_Content", "Content block", "en");

                #endregion

                #region Images view

                var photosGalleryLayout = new LayoutControl();
                var photosGalleryLayoutColumns = new List<ColumnDetails>();

                var photosGalleryLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                photosGalleryLayoutColumns.Add(photosGalleryLayoutColumn1);

                photosGalleryLayout.Layout = SampleUtilities.GenerateLayoutTemplate(photosGalleryLayoutColumns, string.Empty);
                photosGalleryLayout.ID = "PhotosGalleryLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), photosGalleryLayout, "Main_Right", "100%", "en");

                ImagesView gallery = new ImagesView();
                gallery.MasterViewName = "ImagesFrontendEducationThumbnailsListLightBox";

                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), gallery, "PhotosGalleryLayout_Content", "Images gallery", "en");

                #endregion

                #region Announcements list

                var announcementsListLayout = new LayoutControl();
                var announcementsListLayoutColumns = new List<ColumnDetails>();

                var announcementsListLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 0),
                    PlaceholderId = "Content"
                };
                announcementsListLayoutColumns.Add(announcementsListLayoutColumn1);

                announcementsListLayout.Layout = SampleUtilities.GenerateLayoutTemplate(announcementsListLayoutColumns, string.Empty);
                announcementsListLayout.ID = "AnnouncementsListLayout";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), announcementsListLayout, "Main_Right", "100%", "en");

                Telerik.Sitefinity.Modules.Lists.Web.UI.ListView announcements = new Telerik.Sitefinity.Modules.Lists.Web.UI.ListView();
                announcements.Mode = ListViewMode.Expanded;
                announcements.SelectedListText = "Announcements";
                announcements.SelectedListIds = string.Format(@"[""{0}""]", SampleConstants.AnnouncementsListId);
                announcements.CurrentMasterTemplateId = new Guid(SampleUtilities.GetControlTemplateKey(typeof(ExpandedListItemsMasterView), SampleConstants.EducationAnnouncementsTemplateName));

                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), announcements, "AnnouncementsListLayout_Content", "List items", "en");
                #endregion
            }

            result = SampleUtilities.CreateLocalizedPage(new Guid(SampleConstants.HomePageId), "Startseite", false, false, "de");

            if (result)
            {
                SampleUtilities.SetTemplateToLocalizedPage(new Guid(SampleConstants.HomePageId), new Guid(SampleConstants.EducationTemplateId), "de");

                var mainLayoutControl = new LayoutControl();
                var mainLayoutColumns = new List<ColumnDetails>();

                var mainLayoutColumn1 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 15, 0, 0),
                    PlaceholderId = "Left"
                };
                mainLayoutColumns.Add(mainLayoutColumn1);

                var mainLayoutColumn2 = new ColumnDetails()
                {
                    ColumnSpaces = new ColumnSpaces(0, 0, 0, 15),
                    PlaceholderId = "Right"
                };
                mainLayoutColumns.Add(mainLayoutColumn2);

                mainLayoutControl.Layout = SampleUtilities.GenerateLayoutTemplate(mainLayoutColumns, string.Empty);
                mainLayoutControl.ID = "Main";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), mainLayoutControl, "content", "50% + 50% (custom)", "de");

                //Lates news block
                ContentBlockBase latestNewsBlock = new ContentBlockBase();
                latestNewsBlock.Html = @"<h1>Universit&auml;tsnachrichten</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), latestNewsBlock, "Main_Left", "Content block", "de");

                //Latest  news view
                NewsView latestNews = new NewsView();
                latestNews.MasterViewName = SampleConstants.EducationNewsSummaryContentViewName;
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), latestNews, "Main_Left", "News", "de");

                //Meet us image
                ImageControl meetUsImage = new ImageControl();
                meetUsImage.ImageId = SampleUtilities.GetLocalizedImageId("besuchen", "de");
                meetUsImage.CssClass = "sfimageWrp bottomImage";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), meetUsImage, "Main_Left", "Image", "de");

                //Upcoming events
                ContentBlockBase upcomingEventsBlock = new ContentBlockBase();
                upcomingEventsBlock.Html = @"<h1>Veranstaltungen</h1>";
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), upcomingEventsBlock, "Main_Right", "Content block", "de");

                //Upcoming events image
                ImageControl upcomingEventsImage = new ImageControl();
                upcomingEventsImage.ImageId = SampleUtilities.GetLocalizedImageId("event", "de");
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), upcomingEventsImage, "Main_Right", "Image", "de");

                //Welcome block
                ContentBlockBase welcomeBlock = new ContentBlockBase();
                Guid deanImageId = SampleUtilities.GetLocalizedImageId("dadean", "de");

                welcomeBlock.Html = string.Format(@"<h1>Begr&uuml;&szlig;ung des Dekans</h1> <p><img alt="""" src=""[images]{0}"" /><em>Herzlich willkommen auf die Telerik International University. Als Dekan der Universit&auml;t bin ich stolz auf das, was wir zu bieten haben, und ich freue mich, dass Sie an weiteren Informationen &uuml;ber uns interessiert sind. Unsere Region hat eine faszinierende Geschichte, eine kreative Kunst Community und fantastische M&ouml;glichkeiten zur Freizeitgestaltung.</em><br /><br /></p>",
                    deanImageId);
                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), welcomeBlock, "Main_Right", "Content block", "de");

                Telerik.Sitefinity.Modules.Lists.Web.UI.ListView announcements = new Telerik.Sitefinity.Modules.Lists.Web.UI.ListView();
                announcements.Mode = ListViewMode.Expanded;
                announcements.SelectedListText = "Announcements";
                announcements.SelectedListIds = string.Format(@"[""{0}""]", SampleConstants.AnnouncementsListId);
                announcements.CurrentMasterTemplateId = new Guid(SampleUtilities.GetControlTemplateKey(typeof(ExpandedListItemsMasterView), SampleConstants.EducationAnnouncementsTemplateName));

                SampleUtilities.AddControlToLocalizedPage(new Guid(SampleConstants.HomePageId), announcements, "Main_Right", "List items", "de");
            }
        }
Example #49
0
        /// <summary>
        /// Cargar imagenes del directorio especificado
        /// </summary>
        public void loadImages(string folderPath)
        {
            textBoxFolderPath.Text = browseDialog.SelectedPath;

            //Limpiar controles anteriores
            foreach (ImageControl c in panelImages.Controls)
            {
                c.dispose();
            }
            panelImages.Controls.Clear();

            if (Directory.Exists(folderPath))
            {
                //Cargar carpetas del directorio
                if (showFolders)
                {
                    //Obtener subdirectorios
                    string[] allDirs = Directory.GetDirectories(folderPath);
                    
                    //Excluir subdirectorios innecesarios
                    List<string> dirs = new List<string>();
                    for (int i = 0; i < allDirs.Length; i++)
                    {
                        if (!allDirs[i].Contains(".svn"))
                        {
                            dirs.Add(allDirs[i]);
                        }
                    }

                    //Crear control para cada directorio
                    foreach (string dir in dirs)
	                {
                        ImageControl imageControl = new ImageControl(dir, this, true);
                        panelImages.Controls.Add(imageControl);
                    }
                }

                //Cargar imagenes del directorio
                List<string> imageFiles = new List<string>();
                for (int i = 0; i < FILE_EXT_SEARCH.Length; i++)
                {
                    imageFiles.AddRange(Directory.GetFiles(folderPath, FILE_EXT_SEARCH[i], SearchOption.TopDirectoryOnly));
                }
                imageFiles.Sort();

                //Crear control para cada imagen
                for (int i = 0; i < imageFiles.Count; i++)
                {
                    string imageFile = imageFiles[i];

                    ImageControl imageControl = new ImageControl(imageFile, this, false);
                    panelImages.Controls.Add(imageControl);
                }

                //Seleccionar primer elemento
                if (panelImages.Controls.Count > 0)
                {
                    ((ImageControl)panelImages.Controls[0]).selectImage();
                }
            }

        }