public void UpdateOptionLabels()
        {
            slider_coplanar_angle.ValueText = m_coplanar_tol.ToString();
            slider_extrude_length.ValueText = Utility.ConvertFloatTo1Thru3Dec(m_extrude_length);
            slider_inset_bevel.ValueText    = m_inset_pct.ToString();
            slider_inset_length.ValueText   = Utility.ConvertFloatTo1Thru3Dec(m_inset_length);
            slider_bevel_width.ValueText    = Utility.ConvertFloatTo1Thru3Dec(m_bevel_width);
            slider_sizex.ValueText          = Utility.ConvertFloatTo1Thru3Dec(m_size_x);
            slider_sizey.ValueText          = Utility.ConvertFloatTo1Thru3Dec(m_size_y);
            slider_sizeheight.ValueText     = Utility.ConvertFloatTo1Thru3Dec(m_size_height);
            slider_sizesegments.ValueText   = m_size_segments.ToString();
            label_editmode.Text             = "Mode: " + m_edit_mode.ToString();
            label_pivotmode.Text            = "Pivot: " + m_pivot_mode.ToString();
            label_scalemode.Text            = "Scale: " + m_scale_mode.ToString();
            slider_grid_spacing.ValueText   = Utility.ConvertFloatTo1Thru3Dec(m_grid_spacing);
            slider_grid_snap.ValueText      = Utility.ConvertFloatTo1Thru3Dec(m_grid_snap);
            slider_grid_width.ValueText     = m_grid_width.ToString();
            label_grid_display.Text         = "Display: " + m_grid_display.ToString();
            label_view_layout.Text          = "Layout: " + m_view_layout.ToString();
            label_view_persp.Text           = "Persp: " + m_view_mode_persp.ToString();
            label_view_ortho.Text           = "Ortho: " + m_view_mode_ortho.ToString();
            label_view_dark.Text            = "Background: " + m_bg_color.ToString();
            label_gimbal.Text   = "Gimbal: " + m_gimbal_display.ToString();
            label_lighting.Text = "Lighting: " + m_lighting_type.ToString();

            label_vert_display.Text            = "Vert Normals: " + m_vert_display.ToString();
            label_poly_filter.Text             = "PolyFilter: " + m_vis_type.ToString();
            slider_smooth_angle_diff.ValueText = m_dmesh.smooth_angle_diff.ToString();
            slider_smooth_angle_same.ValueText = m_dmesh.smooth_angle_same.ToString();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ForumContext.CurrentState != ForumStateEnum.Thread)
        {
            Visible = false;
        }

        // WAI validation
        lblViewMode.ResourceString = "FlatForum.ViewMode";
        lblViewMode.Attributes.Add("style", "display: none;");

        // Fill the drop down list
        drpViewModeSelector.Items.Add(new ListItem(GetString("FlatForum.ModeThreaded"), FlatModeEnum.Threaded.ToString()));
        drpViewModeSelector.Items.Add(new ListItem(GetString("FlatForum.ModeNewest"), FlatModeEnum.NewestToOldest.ToString()));
        drpViewModeSelector.Items.Add(new ListItem(GetString("FlatForum.ModeOldest"), FlatModeEnum.OldestToNewest.ToString()));

        // Try to preselect value
        if (SessionHelper.GetValue("CMSForumViewMode") != null)
        {
            string mode = (string)SessionHelper.GetValue("CMSForumViewMode");
            if (mode != null)
            {
                ViewMode = ForumModes.GetFlatMode(mode);
                drpViewModeSelector.SelectedValue = ViewMode.ToString();
            }
        }
        else
        {
            // Try to copy forum viewer properties from parent
            CopyValuesFromParent(this);

            // Set mode from parent
            drpViewModeSelector.SelectedValue = ViewMode.ToString();
        }
    }
Ejemplo n.º 3
0
        public static void OnViewModeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            if (!args.NewValue.Equals(args.OldValue))
            {
                FileList fl       = (FileList)sender;
                ViewMode viewMode = (ViewMode)args.NewValue;
                string   viewName = (viewMode.ToString()).Substring(2) + "View";
                switch (viewMode)
                {
                case ViewMode.vmExtraLargeIcon:
                case ViewMode.vmLargeIcon:
                    viewName = "IconView";
                    break;
                }
                ViewBase view = (ViewBase)(fl.TryFindResource(viewName));;
                if (view != null)
                {
                    fl.View = view;
                }
                fl.UpdateCollumnHeader();

                if ((int)viewMode > (int)ViewMode.vmIcon && fl.ViewSize < (int)viewMode)
                {
                    fl.ViewSize = (int)viewMode;
                }
            }
        }
Ejemplo n.º 4
0
        public void SaveSettings()
        {
            if (m_servers.Any(x => !x.IsValid) || !HasInternetConnection)
            {
                return;
            }

            UserSettings settings = new UserSettings {
                Servers = new List <SavedJenkinsServers>()
            };

            foreach (ServerViewModel server in Servers)
            {
                List <SavedJob> jobs = server.Jobs.Where(x => x.IsSubscribed).Select(x => new SavedJob {
                    Name = x.Name
                }).ToList();
                settings.Servers.Add(new SavedJenkinsServers {
                    DomainUrl = server.DomainUrl, Jobs = jobs, RequiresAuthentication = server.RequiresAuthentication
                });
            }

            PersistedUserSettings.Save(settings);
            Settings.Default.ViewMode          = ViewMode.ToString();
            Settings.Default.JobUpdateInterval = UpdateTimerInterval;
            Settings.Default.Servers           = new StringCollection();
            Settings.Default.Servers.AddRange(Servers.Select(x => x.DomainUrl).ToArray());
            Settings.Default.Save();
        }
Ejemplo n.º 5
0
        private async Task SetupJumpList()
        {
            try
            {
                var calculatorOptions = NavCategoryStates.CreateCalculatorCategoryGroup();

                var jumpList = await JumpList.LoadCurrentAsync();

                jumpList.SystemGroupKind = JumpListSystemGroupKind.None;
                jumpList.Items.Clear();

                foreach (NavCategory option in calculatorOptions.Categories)
                {
                    if (!NavCategoryStates.IsViewModeEnabled(option.ViewMode))
                    {
                        continue;
                    }
                    ViewMode mode = option.ViewMode;
                    var      item = JumpListItem.CreateWithArguments(((int)mode).ToString(), "ms-resource:///Resources/" + NavCategoryStates.GetNameResourceKey(mode));
                    item.Description = "ms-resource:///Resources/" + NavCategoryStates.GetNameResourceKey(mode);
                    item.Logo        = new Uri("ms-appx:///Assets/" + mode.ToString() + ".png");

                    jumpList.Items.Add(item);
                }

                await jumpList.SaveAsync();
            }
            catch
            {
            }
        }
Ejemplo n.º 6
0
 private VisualNode RenderSwitchMode(ViewMode viewMode)
 => new RxStackLayout()
 {
     new RxLabel(viewMode.ToString()),
     new RxSwitch()
     .IsToggled(State.ViewMode == viewMode)
     .OnToggled((s, e) => SetState(_ => _.ViewMode = viewMode))
 }
 .WithHorizontalOrientation();
 /// <summary>
 /// Handles the event for button up.
 /// </summary>
 /// <param name="controller_id">The id of the controller.</param>
 /// <param name="button">The button that is being released.</param>
 private void HandleOnButtonUp(byte controller_id, MLInputControllerButton button)
 {
     if (button == MLInputControllerButton.Bumper)
     {
         _viewMode         = (ViewMode)((int)(_viewMode + 1) % Enum.GetNames(typeof(ViewMode)).Length);
         _statusLabel.text = string.Format("View Mode: {0}", _viewMode.ToString());
     }
     UpdateVisualizers();
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Handles the event for button down.
 /// </summary>
 /// <param name="controllerId">The id of the controller.</param>
 /// <param name="button">The button that is being released.</param>
 private void HandleOnButtonDown(byte controllerId, MLInputControllerButton button)
 {
     if (_controllerConnectionHandler.IsControllerValid(controllerId) && button == MLInputControllerButton.Bumper)
     {
         _viewMode           = (ViewMode)((int)(_viewMode + 1) % Enum.GetNames(typeof(ViewMode)).Length);
         _viewModeLabel.text = string.Format("View Mode: {0}", _viewMode.ToString());
     }
     UpdateVisualizers();
 }
        public void CycleViewMode()
        {
            m_view_mode = (ViewMode)(((int)m_view_mode + 1) % (int)ViewMode.NUM);

            SetSpacing();

            label_ViewMode.Text = "View: " + m_view_mode.ToString();

            this.Refresh();
        }
Ejemplo n.º 10
0
        public virtual JsonResult GetCats(ViewMode viewMode)
        {
            var context = new TazehaContext();
            var cats    =
                context.Categories.Where(c => viewMode.ToString().Contains(c.ViewMode.ToString()))
                .Select(c => new { title = c.Title, code = c.Code });

            return(Json(cats.ToList(), JsonRequestBehavior.AllowGet));

            return(null);
        }
Ejemplo n.º 11
0
 protected override void SaveRepositoryConfig(Section section)
 {
     if (Guid == Guids.ContextualDiffViewGuid)
     {
         var node = section.GetCreateSection("ContextualDiffOptions");
         node.SetValue <int>("Context", _options.Context);
         node.SetValue <bool>("IgnoreWhitespace", _options.IgnoreWhitespace);
         node.SetValue <bool>("UsePatienceAlgorithm", _options.UsePatienceAlgorithm);
         node.SetValue <string>("ViewMode", ViewMode.ToString());
     }
     base.SaveRepositoryConfig(section);
 }
Ejemplo n.º 12
0
        }//ToXml()

        public JObject ToJson()
        {
            //JObject Ret = new JObject();

            JObject RootPropObj = new JObject();

            //Ret[CswEnumNbtViewXmlNodeName.TreeView.ToString()] = RootPropObj;

            RootPropObj["nodename"]           = CswEnumNbtViewXmlNodeName.TreeView.ToString().ToLower();
            RootPropObj["viewname"]           = ViewName;
            RootPropObj["version"]            = "1.0";
            RootPropObj["iconfilename"]       = IconFileName;
            RootPropObj["selectable"]         = Selectable.ToString().ToLower();
            RootPropObj["mode"]               = ViewMode.ToString();
            RootPropObj["width"]              = (Width > 0) ? Width.ToString() : "";
            RootPropObj["viewid"]             = (ViewId.isSet()) ? ViewId.get().ToString() : "";
            RootPropObj["category"]           = Category;
            RootPropObj["visibility"]         = Visibility.ToString();
            RootPropObj["visibilityroleid"]   = (VisibilityRoleId != null) ? VisibilityRoleId.PrimaryKey.ToString() : "";
            RootPropObj["visibilityrolename"] = (VisibilityRoleId != null) ? _CswNbtResources.Nodes[VisibilityRoleId].NodeName : "";
            RootPropObj["visibilityuserid"]   = (VisibilityUserId != null) ? VisibilityUserId.PrimaryKey.ToString() : "";
            RootPropObj["visibilityusername"] = (VisibilityUserId != null) ? _CswNbtResources.Nodes[VisibilityUserId].NodeName : "";
            RootPropObj["groupbysiblings"]    = GroupBySiblings;
            RootPropObj["included"]           = Included.ToString().ToLower();
            RootPropObj["isdemo"]             = IsDemo.ToString().ToLower();
            RootPropObj["issystem"]           = IsSystem.ToString().ToLower();
            RootPropObj["includetempnodes"]   = IncludeTempNodes.ToString().ToLower();
            RootPropObj["gridgroupbycol"]     = GridGroupByCol.ToString().ToLower();
            RootPropObj["showdelete"]         = false; //for ViewContentTree - don't show the "X" on view root

            JObject ChildObject = new JObject();

            if (null == RootPropObj[_ChildRelationshipsName] ||
                RootPropObj[_ChildRelationshipsName].Type != JTokenType.Object)
            {
                RootPropObj[_ChildRelationshipsName] = ChildObject;

                // Recurse on child ViewNodes
                foreach (CswNbtViewRelationship ChildRelationship in ChildRelationships)
                {
                    JProperty ChildRelationshipProp = ChildRelationship.ToJson();
                    if (null == ChildObject[ChildRelationshipProp.Name])
                    {
                        ChildObject.Add(ChildRelationshipProp);
                    }
                }
            }
            //return Ret;
            return(RootPropObj);
        }//ToXml()
Ejemplo n.º 13
0
    public void toggleViewType(ViewMode mode)
    {
        DebugConsole.Log("ViewTypeToggled:" + mode.ToString(), "normal");
        viewMode = mode;
//		if (viewMode == ViewMode.around) {
//			gameObject.transform.parent = toFollow.transform;
//		} else if (viewMode == ViewMode.definitePos) {
//			gameObject.transform.parent = null;
////			lookAt.target = planet.transform;
////			gameObject.transform.parent = startingParent;
//		}
        lookAt.viewMode = viewMode;
//		cursorCheck ();
    }
Ejemplo n.º 14
0
    public static string ViewModeToString(ViewMode viewMode_)
    {
        switch (viewMode_)
        {
        case ViewMode.simple:
            return("Simple Calendar View");

        case ViewMode.scheduledEvents:
            return("Scheduled Events");

        case ViewMode.staffSchedules:
            return("Staff Schedules");

        case ViewMode.salesReports:
            return("Sales Reports");
        }
        return(viewMode_.ToString());
    }
Ejemplo n.º 15
0
        public void SaveSettings()
        {
            UserSettings settings = new UserSettings {
                Servers = new List <SavedJenkinsServers>()
            };

            foreach (ServerViewModel server in Servers)
            {
                List <SavedJob> jobs = server.Jobs.Where(x => x.IsSubscribed).Select(x => new SavedJob {
                    Name = x.Name
                }).ToList();
                settings.Servers.Add(new SavedJenkinsServers {
                    DomainUrl = server.DomainUrl, Jobs = jobs, RequiresAuthentication = server.RequiresAuthentication
                });
            }

            PersistedUserSettings.Save(settings);
            Settings.Default.ViewMode = ViewMode.ToString();
            Settings.Default.Servers  = new StringCollection();
            Settings.Default.Servers.AddRange(Servers.Select(x => x.DomainUrl).ToArray());
            Settings.Default.Save();
        }
Ejemplo n.º 16
0
        public void CycleViewMode()
        {
            m_view_mode = (ViewMode)(((int)m_view_mode + 1) % (int)ViewMode.NUM);
            switch (m_view_mode)
            {
            case ViewMode.LARGE:
                listview.LargeImageList = m_image_list_large;
                ListViewItem_SetSpacing(listview, 128 + 10, 128 + 20);
                listview.Font = m_list_font;
                listview.View = View.LargeIcon;
                break;

            case ViewMode.SMALL:
                ListViewItem_SetSpacing(listview, 64 + 4, 64 + 11);
                listview.LargeImageList = m_image_list_small;
                listview.Font           = m_list_font_tiny;
                break;
            }

            label_view_mode.Text = "View: " + m_view_mode.ToString();

            this.Refresh();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Save the Presentation.CommandBar settings to the settings file
        /// </summary>
        /// <param name="commandBarNode">XML-node for the Presentation.CommandBar settings</param>
        public void Save(XmlNode commandBarNode)
        {
            string xpath;

            xpath = "./viewMode";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, ViewMode.ToString());

            xpath = "./operations";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "plugin", Operations);

            xpath = "./operationShortcuts";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "plugin", OperationShortcuts);

            xpath = "./outputFormats";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "outputFormat", OutputFormats);

            xpath = "./outputFormatShortcuts";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "outputFormat", OutputFormatShortcuts);

            xpath = "./presentationViews";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "plugin", PresentationViews);

            xpath = "./presentationViewShortcuts";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "plugin", PresentationViewShortcuts);

            xpath = "./commandBarShortcuts";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "plugin", CommandBarShortcuts);

            xpath = "./operationButtons";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "plugin", OperationButtons);

            xpath = "./fileTypeButtons";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "outputFormat", FileTypeButtons);

            xpath = "./presentationViewButtons";
            SettingsHelper.SetSettingValue(xpath, commandBarNode, "plugin", PresentationViewButtons);
        }
Ejemplo n.º 18
0
 protected override void OnInvoke(ViewMode viewMode)
 {
     Console.WriteLine($"Instantiated ExampleViewComponent for mode {viewMode.ToString()}");
 }
Ejemplo n.º 19
0
        /// <summary>
        /// Populates the form with the appropriate data.
        /// </summary>
        /// <param name="listView"></param>
        /// <param name="viewMode"></param>
        private void PopulateForm(ListView listView, ViewMode viewMode)
        {
            listView.View               = View.Details;
            listView.FullRowSelect      = true;
            listView.AllowColumnReorder = true;
            listView.Sorting            = SortOrder.None;
            listView.HeaderStyle        = ColumnHeaderStyle.Clickable;

            labelInstructions.Text = "You can delete a " + viewMode.ToString().Substring(0, viewMode.ToString().Length - 1) + " by checking its box on the left and pressing the 'Delete' button.";

            switch (viewMode)
            {
            case ViewMode.Users:
                panelMain.GradientColorOne = Color.LightGreen;
                panelMain.GradientColorTwo = Color.SeaGreen;

                listView.Columns.Add("", 22, HorizontalAlignment.Center);            // For the Delete checkbox
                listView.Columns.Add("Username ", 90, HorizontalAlignment.Left);
                listView.Columns.Add("First Name ", 90, HorizontalAlignment.Left);
                listView.Columns.Add("Last Name ", 90, HorizontalAlignment.Left);
                listView.Columns.Add("Creation Date ", 100, HorizontalAlignment.Left);
                listView.Columns.Add("Creation Time ", 100, HorizontalAlignment.Left);

                foreach (_User user in SysInfo.Data.Users)
                {
                    ListViewItem item = new ListViewItem();

                    if (user.Name == SysInfo.Data.Options.PrimaryUser)
                    {
                        item.ForeColor = Color.Blue;
                    }

                    item.Text = "";
                    item.SubItems.AddRange(new string[] { user.Name, user.FirstName, user.LastName, user.CreationDate.ToShortDateString(), user.CreationDate.ToShortTimeString() });
                    listView.Items.Add(item);
                }

                buttonDelete.Text    = "Delete Selected Users";
                buttonDelete.Enabled = false;
                break;

            case ViewMode.Devices:
                panelMain.GradientColorOne = Color.Lavender;
                panelMain.GradientColorTwo = Color.MediumSlateBlue;

                listView.Columns.Add("", 22, HorizontalAlignment.Center);            // For the Delete checkbox
                listView.Columns.Add("Primary User ", 75, HorizontalAlignment.Left);
                listView.Columns.Add("OS Version ", 75, HorizontalAlignment.Left);
                listView.Columns.Add("PP Version ", 100, HorizontalAlignment.Left);
                listView.Columns.Add("Last Update ", 120, HorizontalAlignment.Left);
                listView.Columns.Add("Last Sync ", 120, HorizontalAlignment.Left);

                foreach (_Device device in SysInfo.Data.Devices)
                {
                    ListViewItem item = new ListViewItem();
                    item.Text = "";
                    item.SubItems.AddRange(new string[] { device.PrimaryUser, device.OSVersion, device.SoftwareVersion, device.LastUpdate.ToShortDateString() + " " + device.LastUpdate.ToShortTimeString(), device.LastSync.ToShortDateString() + " " + device.LastSync.ToShortTimeString() });
                    listView.Items.Add(item);
                }

                buttonDelete.Text    = "Delete Selected Devices";
                buttonDelete.Enabled = false;
                break;

            default:
                Debug.Fail("Unaccounted for ViewMode: " + viewMode.ToString(), "frmView.PopulateForm");
                break;
            }

            this.Text = "View " + viewMode.ToString();

            int totWidth = 0;

            for (int i = 0; i < listView.Columns.Count; i++)
            {
                totWidth += listView.Columns[i].Width + 2;
            }

            this.Width  = listView.Left * 2 + totWidth + 2;
            this.Height = Screen.PrimaryScreen.WorkingArea.Height / 2;
            int minHgt = (int)(SysInfo.Data.Users.Count * listView.Font.Height * 1.3 + 150);

            minHgt           = Math.Min(this.Height, minHgt);
            this.MinimumSize = new Size(this.Width, minHgt);

            this.Show();
        }
Ejemplo n.º 20
0
 public static string SetViewMode(ViewMode VMode)
 {
     return(string.Format("{0}={1}", QueryStrings.ViewMode.ToString(), VMode.ToString()));
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Persists the gallery control settings to the data store.
        /// </summary>
        /// <param name="galleryControlSettings">The gallery control settings.</param>
        internal static void SaveGalleryControlSettings(IGalleryControlSettings galleryControlSettings)
        {
            using (SqlConnection cn = SqlDataProvider.GetDbConnection())
            {
                using (SqlCommand cmd = GetCommandGalleryControlSettingUpdate(cn))
                {
                    cmd.Parameters["@ControlId"].Value = galleryControlSettings.ControlId;

                    string[] propertiesToExclude = new[] { "GalleryControlSettingId", "ControlId", "HasValues" };

                    string viewModeType     = typeof(ViewMode).ToString();
                    Type   gsType           = galleryControlSettings.GetType();
                    string boolType         = typeof(bool).ToString();
                    string boolNullableType = typeof(bool?).ToString();
                    string intType          = typeof(int).ToString();
                    string intNullableType  = typeof(int?).ToString();
                    string stringType       = typeof(string).ToString();

                    cn.Open();

                    foreach (PropertyInfo prop in gsType.GetProperties())
                    {
                        if (Array.IndexOf(propertiesToExclude, prop.Name) >= 0)
                        {
                            continue;                             // Skip this one.
                        }

                        object objPropValue = prop.GetValue(galleryControlSettings, null);
                        string propValue    = null;

                        if (objPropValue != null)
                        {
                            if (prop.PropertyType.FullName == null)
                            {
                                continue;
                            }

                            if (prop.PropertyType.FullName.Equals(boolType) || prop.PropertyType.FullName.Equals(boolNullableType))
                            {
                                propValue = Convert.ToBoolean(objPropValue, CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture);
                            }
                            else if (prop.PropertyType.FullName.Equals(intType) || prop.PropertyType.FullName.Equals(intNullableType))
                            {
                                propValue = Convert.ToInt32(objPropValue, CultureInfo.InvariantCulture).ToString(CultureInfo.InvariantCulture);
                            }
                            else if (prop.PropertyType.FullName.Equals(stringType))
                            {
                                propValue = Convert.ToString(objPropValue, CultureInfo.InvariantCulture);
                            }
                            else if (prop.PropertyType.FullName.Equals(viewModeType))
                            {
                                // Only save ViewMode if it has a non-default value; otherwise set it to null so it is deleted (if it even exists).
                                ViewMode viewMode = (ViewMode)Enum.Parse(typeof(ViewMode), objPropValue.ToString(), true);

                                if (viewMode != ViewMode.NotSet)
                                {
                                    propValue = viewMode.ToString();
                                }
                            }
                            else
                            {
                                propValue = objPropValue.ToString();
                            }
                        }

                        // Update the item.
                        if (propValue != null)
                        {
                            cmd.Parameters["@SettingValue"].Value = propValue;
                        }
                        else
                        {
                            cmd.Parameters["@SettingValue"].Value = DBNull.Value;
                        }

                        cmd.Parameters["@SettingName"].Value = prop.Name;

                        cmd.ExecuteNonQuery();

                        //if (propValue == null)
                        //{
                        //  // Include this only for debug purposes.
                        //  System.Diagnostics.StackTrace st = new System.Diagnostics.StackTrace(true);
                        //  string msg = String.Format(CultureInfo.CurrentCulture, "Deleted Gallery Control Setting \"{0}\". Stack trace: {1}", prop.Name, st);
                        //  ErrorHandler.Error.Record(new DataException(msg));
                        //}
                    }
                }
            }
        }
Ejemplo n.º 22
0
 protected void SetViewMode(ViewMode mode)
 {
     HttpContext.Session.SetString("ViewMode", mode.ToString());
 }
Ejemplo n.º 23
0
        protected override void Render(HtmlTextWriter writer)
        {
            StringBuilder builder = new StringBuilder();

            #region Label

            if (!string.IsNullOrEmpty(this.LabelResourceKey) || !string.IsNullOrEmpty(this.LabelText))
            {
                this.lbl.RenderControl(new HtmlTextWriter(new StringWriter(builder)));
                writer.Write(string.Format("<div class='control-labels'>{0}{1}</div>", builder.ToString(), this.IsRequired ? "<span class='required'>*</span>" : string.Empty));
            }

            #endregion

            #region Calendar

            string _dateFormat = "";
            switch (this.MinViewMode)
            {
            case CalendarViewModes.Years:
                _dateFormat = this.DateFormat.Replace("dd/", "").Replace("MM/", "");
                break;

            case CalendarViewModes.Months:
                _dateFormat = this.DateFormat.Replace("dd/", "");
                break;

            case CalendarViewModes.Days:
                _dateFormat = this.DateFormat;
                break;
            }

            writer.Write(string.Format("<div id='{0}' class='input-group date {1}'>", "dp_" + this.ClientID, this.ControlSize.ToString().ToLower()));

            switch (this.Mode)
            {
            case CalendarModes.Date:
                this.Attributes.Add("data-date-format", _dateFormat);
                this.Attributes.Add("placeholder", _dateFormat);
                break;

            case CalendarModes.Time:
                this.Attributes.Add("data-date-format", this.bootstrapTimeFormat);
                this.Attributes.Add("placeholder", this.bootstrapTimeFormat);
                break;

            case CalendarModes.DateTime:
                this.Attributes.Add("data-date-format", _dateFormat + " " + this.bootstrapTimeFormat);
                this.Attributes.Add("placeholder", _dateFormat + " " + this.bootstrapTimeFormat);
                break;
            }

            #region Validator

            if (this.IsRequired)
            {
                builder.Clear();
                reqValidator.Display = ValidatorDisplay.Dynamic;
                reqValidator.RenderControl(new HtmlTextWriter(new StringWriter(builder)));
            }

            #endregion

            base.Render(writer);
            writer.Write(string.Format("<span class='input-group-addon' id='{0}-addon'><i class='{1}'></i>{2}</span></div>", this.ID, (this.Mode == CalendarModes.Date ? "icon-calendar" : " icon-time"), this.IsRequired ? builder.ToString() : string.Empty));

            #endregion

            #region Script

            if (!this.ScriptRegistered && this.Enabled)
            {
                string startDate = "sdate_" + this.ClientID;
                string localDate = "localdate_" + this.ClientID;
                string script    = @"var #sdate=Date.parseExact('_sdate','_format');
                                    $('#id').datetimepicker(
                                                                {
                                                                    format: '#dateformat#timeformat',
                                                                    pickTime:#pickTime,
                                                                    pickDate:#pickDate,
                                                                    viewMode:'#viewMode',
                                                                    minViewMode:'#minViewMode',
                                                                    startDate:#sdate
                                                                });";

                if (OnChangeScript != null)
                {
                    script += @"$('#id').on(""changeDate"",function (e) {" + OnChangeScript + "});";
                }

                if (!this.Page.IsPostBack)
                {
                    script = script + @"var #localdate=#sdate?new Date(#sdate):null;
                                            #localdate = #localdate;
                                            if(#localdate)$('#id').data('datetimepicker').setLocalDate(#localdate);";
                }

                script = script.Replace("#id", "#dp_" + ClientID)
                         .Replace("#viewMode", ViewMode.ToString().ToLower())
                         .Replace("#minViewMode", MinViewMode.ToString().ToLower())
                         .Replace("_sdate", StartDate.HasValue ? StartDate.Value.ToString(GetFullFormat()) : "")
                         .Replace("#sdate", startDate)
                         .Replace("#localdate", localDate)
                         .Replace("_format", GetFullFormat());


                switch (this.Mode)
                {
                case CalendarModes.Date:
                    script = script.Replace("#dateformat", _dateFormat).Replace("#timeformat", "").Replace("#pickTime", "false").Replace("#pickDate", "true");
                    break;

                case CalendarModes.Time:
                    script = script.Replace("#dateformat", "").Replace("#timeformat", this.bootstrapTimeFormat).Replace("#pickTime", "true").Replace("#pickDate", "false");
                    break;

                case CalendarModes.DateTime:
                    script = script.Replace("#dateformat", _dateFormat).Replace("#timeformat", " " + this.bootstrapTimeFormat).Replace("#pickTime", "true").Replace("#pickDate", "true");
                    break;
                }

                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), this.ClientID + "-script", script, true);
                this.ScriptRegistered = true;
            }

            #endregion
        }
Ejemplo n.º 24
0
        public XmlNode ToXml(XmlDocument XmlDoc)
        {
            XmlNode RootXmlNode = XmlDoc.CreateNode(XmlNodeType.Element, CswEnumNbtViewXmlNodeName.TreeView.ToString(), "");

            XmlAttribute ViewNameAttribute = XmlDoc.CreateAttribute("viewname");

            ViewNameAttribute.Value = ViewName;
            RootXmlNode.Attributes.Append(ViewNameAttribute);

            //bz #5157
            XmlAttribute ViewVersionAttribute = XmlDoc.CreateAttribute("version");

            ViewVersionAttribute.Value = "1.0";
            RootXmlNode.Attributes.Append(ViewVersionAttribute);

            XmlAttribute IconFileNameAttribute = XmlDoc.CreateAttribute("iconfilename");

            IconFileNameAttribute.Value = IconFileName;
            RootXmlNode.Attributes.Append(IconFileNameAttribute);

            XmlAttribute SelectableAttribute = XmlDoc.CreateAttribute("selectable");

            SelectableAttribute.Value = Selectable.ToString().ToLower();
            RootXmlNode.Attributes.Append(SelectableAttribute);

            XmlAttribute ModeAttribute = XmlDoc.CreateAttribute("mode");

            ModeAttribute.Value = ViewMode.ToString();
            RootXmlNode.Attributes.Append(ModeAttribute);

            XmlAttribute WidthAttribute = XmlDoc.CreateAttribute("width");

            if (Width > 0)
            {
                WidthAttribute.Value = Width.ToString();
            }
            else
            {
                WidthAttribute.Value = "";
            }
            RootXmlNode.Attributes.Append(WidthAttribute);

            XmlAttribute ViewIdAttribute = XmlDoc.CreateAttribute("viewid");

            if (ViewId.isSet())
            {
                ViewIdAttribute.Value = ViewId.get().ToString();
            }
            else
            {
                ViewIdAttribute.Value = "";
            }
            RootXmlNode.Attributes.Append(ViewIdAttribute);

            XmlAttribute CategoryAttribute = XmlDoc.CreateAttribute("category");

            CategoryAttribute.Value = Category.ToString();
            RootXmlNode.Attributes.Append(CategoryAttribute);

            XmlAttribute VisibilityAttribute = XmlDoc.CreateAttribute("visibility");

            VisibilityAttribute.Value = Visibility.ToString();
            RootXmlNode.Attributes.Append(VisibilityAttribute);

            XmlAttribute VisibilityRoleIdAttribute = XmlDoc.CreateAttribute("visibilityroleid");

            if (VisibilityRoleId != null)
            {
                VisibilityRoleIdAttribute.Value = VisibilityRoleId.PrimaryKey.ToString();
            }
            RootXmlNode.Attributes.Append(VisibilityRoleIdAttribute);

            XmlAttribute VisibilityUserIdAttribute = XmlDoc.CreateAttribute("visibilityuserid");

            if (VisibilityUserId != null)
            {
                VisibilityUserIdAttribute.Value = VisibilityUserId.PrimaryKey.ToString();
            }
            RootXmlNode.Attributes.Append(VisibilityUserIdAttribute);

            XmlAttribute GroupBySiblingsAttribute = XmlDoc.CreateAttribute("groupbysiblings");

            GroupBySiblingsAttribute.Value = GroupBySiblings.ToString().ToLower();
            RootXmlNode.Attributes.Append(GroupBySiblingsAttribute);

            XmlAttribute IncludedAttribute = XmlDoc.CreateAttribute("included");

            IncludedAttribute.Value = Included.ToString().ToLower();
            RootXmlNode.Attributes.Append(IncludedAttribute);

            XmlAttribute IsDemoAttribute = XmlDoc.CreateAttribute("isdemo");

            IsDemoAttribute.Value = IsDemo.ToString().ToLower();
            RootXmlNode.Attributes.Append(IsDemoAttribute);

            XmlAttribute IsSystemAttribute = XmlDoc.CreateAttribute("issystem");

            IsSystemAttribute.Value = IsSystem.ToString().ToLower();
            RootXmlNode.Attributes.Append(IsSystemAttribute);

            XmlAttribute IncludeTempNodesAttribute = XmlDoc.CreateAttribute("includetempnodes");

            IncludeTempNodesAttribute.Value = IncludeTempNodes.ToString().ToLower();
            RootXmlNode.Attributes.Append(IncludeTempNodesAttribute);

            XmlAttribute GridGroupByColAttribute = XmlDoc.CreateAttribute("gridgroupbycol");

            GridGroupByColAttribute.Value = GridGroupByCol.ToString().ToLower();
            RootXmlNode.Attributes.Append(GridGroupByColAttribute);

            // Recurse on child ViewNodes
            foreach (CswNbtViewRelationship ChildRelationship in this.ChildRelationships)
            {
                XmlNode ChildXmlNode = ChildRelationship.ToXml(XmlDoc);
                RootXmlNode.AppendChild(ChildXmlNode);
            }

            return(RootXmlNode);
        }//ToXml()