Ejemplo n.º 1
0
        private void Initialize(CommentsInputModel commentsInputModel, bool useReviews)
        {
            const string ReviewsSuffix = "_review";

            if (commentsInputModel == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(commentsInputModel.ThreadType))
            {
                this.ThreadType = commentsInputModel.ThreadType;
            }

            if (!string.IsNullOrEmpty(commentsInputModel.ThreadKey))
            {
                this.ThreadKey = commentsInputModel.ThreadKey;
            }
            else if (string.IsNullOrEmpty(this.ThreadKey))
            {
                if (SiteMapBase.GetActualCurrentNode() != null)
                {
                    this.ThreadKey = ControlUtilities.GetLocalizedKey(SiteMapBase.GetActualCurrentNode().Id, null, CommentsBehaviorUtilities.GetLocalizedKeySuffix(this.ThreadType));
                }
                else
                {
                    this.ThreadKey = string.Empty;
                }
            }

            if (useReviews && !this.ThreadKey.EndsWith(ReviewsSuffix))
            {
                this.ThreadKey = this.ThreadKey + ReviewsSuffix;
            }
            else if (!useReviews && this.ThreadKey.EndsWith(ReviewsSuffix))
            {
                this.ThreadKey = this.ThreadKey.Left(this.ThreadKey.Length - ReviewsSuffix.Length);
            }

            if (!string.IsNullOrEmpty(commentsInputModel.ThreadTitle))
            {
                this.ThreadTitle = commentsInputModel.ThreadTitle;
            }

            if (!string.IsNullOrEmpty(commentsInputModel.GroupKey))
            {
                this.GroupKey = commentsInputModel.GroupKey;
            }

            if (!string.IsNullOrEmpty(commentsInputModel.DataSource))
            {
                this.DataSource = commentsInputModel.DataSource;
            }
        }
 public FormResoluciones()
 {
     this.InitializeComponent();
     this.InitializeDropDownList();
     this.resolucionService       = new ResolucionService();
     this.docenteService          = new DocenteService();
     this.sentenciaService        = new SentenciaService();
     this.formModificarResolucion = new ModificarResolucion();
     ControlUtilities.ResetAllControls(groupBoxInfoResoluciones);
     ControlUtilities.ResetAllControls(groupBoxInfoSentencia);
     ControlUtilities.ResetAllControls(groupBoxInfoDocente);
 }
Ejemplo n.º 3
0
        private void AddAngleContextMenuStripItems()
        {
            ToolStripMenuItem itemSigned = new ToolStripMenuItem("Signed");

            itemSigned.Click += (sender, e) =>
            {
                _signed            = !_signed;
                itemSigned.Checked = _signed;
            };
            itemSigned.Checked = _signed;

            ToolStripMenuItem itemUnits = new ToolStripMenuItem("Units...");

            ControlUtilities.AddDropDownItems(
                itemUnits,
                new List <string> {
                "In-Game Units", "HAU", "Degrees", "Radians", "Revolutions"
            },
                new List <object>
            {
                AngleUnitType.InGameUnits,
                AngleUnitType.HAU,
                AngleUnitType.Degrees,
                AngleUnitType.Radians,
                AngleUnitType.Revolutions,
            },
                (object obj) => { _angleUnitType = (AngleUnitType)obj; },
                _angleUnitType);

            ToolStripMenuItem itemTruncateToMultipleOf16 = new ToolStripMenuItem("Truncate to Multiple of 16");

            itemTruncateToMultipleOf16.Click += (sender, e) =>
            {
                _truncateToMultipleOf16            = !_truncateToMultipleOf16;
                itemTruncateToMultipleOf16.Checked = _truncateToMultipleOf16;
            };
            itemTruncateToMultipleOf16.Checked = _truncateToMultipleOf16;

            ToolStripMenuItem itemConstrainToOneRevolution = new ToolStripMenuItem("Constrain to One Revolution");

            itemConstrainToOneRevolution.Click += (sender, e) =>
            {
                _constrainToOneRevolution            = !_constrainToOneRevolution;
                itemConstrainToOneRevolution.Checked = _constrainToOneRevolution;
            };
            itemConstrainToOneRevolution.Checked = _constrainToOneRevolution;

            _contextMenuStrip.AddToBeginningList(new ToolStripSeparator());
            _contextMenuStrip.AddToBeginningList(itemSigned);
            _contextMenuStrip.AddToBeginningList(itemUnits);
            _contextMenuStrip.AddToBeginningList(itemTruncateToMultipleOf16);
            _contextMenuStrip.AddToBeginningList(itemConstrainToOneRevolution);
        }
Ejemplo n.º 4
0
        public void AddPauseBufferFrames(int startIndex, int endIndex)
        {
            if (RawBytes == null)
            {
                return;
            }
            if (startIndex > endIndex)
            {
                return;
            }
            startIndex = MoreMath.Clamp(startIndex, 0, Inputs.Count - 1);
            endIndex   = MoreMath.Clamp(endIndex, 0, Inputs.Count - 1);

            for (int index = startIndex; index <= endIndex; index++)
            {
                M64CopiedData.OnePauseFrameOverwrite.Apply(Inputs[index]);
            }

            int currentPosition = _gui.DataGridViewInputs.FirstDisplayedScrollingRowIndex;

            _gui.DataGridViewInputs.DataSource = null;

            for (int index = startIndex; index <= endIndex; index++)
            {
                int currentFrame = startIndex + (index - startIndex) * 4;

                M64InputFrame newInput1 = new M64InputFrame(
                    currentFrame + 1, M64CopiedData.OneEmptyFrame.GetRawValue(0), false, this, _gui.DataGridViewInputs);
                Inputs.Insert(currentFrame + 1, newInput1);
                ModifiedFrames.Add(newInput1);

                M64InputFrame newInput2 = new M64InputFrame(
                    currentFrame + 2, M64CopiedData.OnePauseFrame.GetRawValue(0), false, this, _gui.DataGridViewInputs);
                Inputs.Insert(currentFrame + 2, newInput2);
                ModifiedFrames.Add(newInput2);

                M64InputFrame newInput3 = new M64InputFrame(
                    currentFrame + 3, M64CopiedData.OneEmptyFrame.GetRawValue(0), false, this, _gui.DataGridViewInputs);
                Inputs.Insert(currentFrame + 3, newInput3);
                ModifiedFrames.Add(newInput3);
            }

            RefreshInputFrames(startIndex);
            _gui.DataGridViewInputs.DataSource = Inputs;
            Config.M64Manager.UpdateTableSettings(ModifiedFrames);
            ControlUtilities.TableGoTo(_gui.DataGridViewInputs, currentPosition);

            IsModified       = true;
            Header.NumInputs = Inputs.Count;
            _gui.DataGridViewInputs.Refresh();
            Config.M64Manager.UpdateSelectionTextboxes();
        }
Ejemplo n.º 5
0
        public string ToHtmlString()
        {
            var htmlTag = new TagBuilder(_htmlElement);

            foreach (KeyValuePair <string, string> attribute in _htmlAttributes)
            {
                htmlTag.Attributes[attribute.Key] = attribute.Value;
            }

            htmlTag.InnerHtml = ControlUtilities.Sanitize(_innerHtml);

            return(htmlTag.ToString(TagRenderMode.Normal));
        }
Ejemplo n.º 6
0
        private void Annihilate()
        {
            List <DataGridViewRow> rows = ControlUtilities.GetTableSelectedRows(dataGridView);

            rows.ForEach(row =>
            {
                uint address = ParsingUtilities.ParseHex(row.Cells[0].Value);
                ButtonUtilities.AnnihilateTriangle(new List <uint>()
                {
                    address
                });
            });
        }
Ejemplo n.º 7
0
        private void RemoveTabModule(int tabId, int moduleId)
        {
            ModuleController.Instance.DeleteTabModule(tabId, moduleId, false);

            //remove that module control
            var moduleControl = ControlUtilities.FindFirstDescendent <Container>(Skin,
                                                                                 c => c.ID == "ctr" + moduleId);

            if (moduleControl != null)
            {
                moduleControl.Parent.Parent.Controls.Remove(moduleControl.Parent);
            }
        }
Ejemplo n.º 8
0
        private void buttonShowLeftRightPanel_Click(object sender, EventArgs e)
        {
            SplitContainer splitContainer =
                ControlUtilities.GetDescendantSplitContainer(
                    splitContainerMain, Orientation.Vertical);

            if (splitContainer == null)
            {
                return;
            }
            splitContainer.Panel1Collapsed = false;
            splitContainer.Panel2Collapsed = false;
        }
        private void AddItemsToContextMenuStrip()
        {
            ToolStripMenuItem resetVariablesItem = new ToolStripMenuItem("Reset Variables");

            resetVariablesItem.Click += (sender, e) => ResetVariables();

            ToolStripMenuItem clearAllButHighlightedItem = new ToolStripMenuItem("Clear All But Highlighted");

            clearAllButHighlightedItem.Click += (sender, e) => ClearAllButHighlightedVariables();

            ToolStripMenuItem fixVerticalScrollItem = new ToolStripMenuItem("Fix Vertical Scroll");

            fixVerticalScrollItem.Click += (sender, e) => FixVerticalScroll();

            ToolStripMenuItem openSaveClearItem = new ToolStripMenuItem("Open / Save / Clear ...");

            ControlUtilities.AddDropDownItems(
                openSaveClearItem,
                new List <string>()
            {
                "Open", "Save in Place", "Save As", "Clear"
            },
                new List <Action>()
            {
                () => OpenVariables(),
                () => SaveVariablesInPlace(),
                () => SaveVariables(),
                () => ClearVariables(),
            });

            ToolStripMenuItem doToAllVariablesItem = new ToolStripMenuItem("Do to all variables...");

            WatchVariableSelectionUtilities.CreateSelectionToolStripItems(
                () => GetCurrentVariableControls(), this)
            .ForEach(item => doToAllVariablesItem.DropDownItems.Add(item));

            ToolStripMenuItem filterVariablesItem = new ToolStripMenuItem("Filter Variables...");

            _filteringDropDownItems = _allGroups.ConvertAll(varGroup => CreateFilterItem(varGroup));
            UpdateFilterItemCheckedStatuses();
            _filteringDropDownItems.ForEach(item => filterVariablesItem.DropDownItems.Add(item));
            filterVariablesItem.DropDown.AutoClose   = false;
            filterVariablesItem.DropDown.MouseLeave += (sender, e) => { filterVariablesItem.DropDown.Close(); };

            ContextMenuStrip.Items.Add(resetVariablesItem);
            ContextMenuStrip.Items.Add(clearAllButHighlightedItem);
            ContextMenuStrip.Items.Add(fixVerticalScrollItem);
            ContextMenuStrip.Items.Add(openSaveClearItem);
            ContextMenuStrip.Items.Add(doToAllVariablesItem);
            ContextMenuStrip.Items.Add(filterVariablesItem);
        }
Ejemplo n.º 10
0
        /** null if controls should be refreshed */
        private void SetOutlineWidth(float?outlineWidthNullable)
        {
            bool  updateMapObjs = outlineWidthNullable != null;
            float outlineWidth  = outlineWidthNullable ?? mapObject.OutlineWidth;

            if (updateMapObjs)
            {
                mapObject.OutlineWidth = outlineWidth;
            }
            textBoxOutlineWidth.SubmitText(outlineWidth.ToString());
            trackBarOutlineWidth.StartChangingByCode();
            ControlUtilities.SetTrackBarValueCapped(trackBarOutlineWidth, outlineWidth);
            trackBarOutlineWidth.StopChangingByCode();
        }
Ejemplo n.º 11
0
        /** null if controls should be refreshed */
        private void SetOpacity(int?opacityNullable)
        {
            bool updateMapObjs = opacityNullable != null;
            int  opacity       = opacityNullable ?? mapObject.OpacityPercent;

            if (updateMapObjs)
            {
                mapObject.OpacityPercent = opacity;
            }
            textBoxOpacity.SubmitText(opacity.ToString());
            trackBarOpacity.StartChangingByCode();
            ControlUtilities.SetTrackBarValueCapped(trackBarOpacity, opacity);
            trackBarOpacity.StopChangingByCode();
        }
Ejemplo n.º 12
0
        /** null if controls should be refreshed */
        private void SetSize(float?sizeNullable)
        {
            bool  updateMapObjs = sizeNullable != null;
            float size          = sizeNullable ?? mapObject.Size;

            if (updateMapObjs)
            {
                mapObject.Size = size;
            }
            textBoxSize.SubmitText(size.ToString());
            trackBarSize.StartChangingByCode();
            ControlUtilities.SetTrackBarValueCapped(trackBarSize, size);
            trackBarSize.StopChangingByCode();
        }
Ejemplo n.º 13
0
        public void RefreshDataGridViewAfterRemoval()
        {
            List <DataGridViewRow> rows = ControlUtilities.GetTableAllRows(dataGridView);

            rows.ForEach(row =>
            {
                uint address = ParsingUtilities.ParseHex(row.Cells[0].Value);
                if (!_triAddressList.Contains(address))
                {
                    dataGridView.Rows.Remove(row);
                }
            });
            labelNumTriangles.Text = _triAddressList.Count + " Triangles";
        }
Ejemplo n.º 14
0
 public DataManager(
     string varFilePath,
     WatchVariableFlowLayoutPanel variablePanel,
     List <VariableGroup> allVariableGroups     = null,
     List <VariableGroup> visibleVariableGroups = null)
 {
     _variablePanel = variablePanel;
     _variablePanel.Initialize(
         varFilePath,
         allVariableGroups,
         visibleVariableGroups);
     TabName  = ControlUtilities.GetTabName(_variablePanel);
     TabIndex = ControlUtilities.GetTabIndex(_variablePanel);
 }
Ejemplo n.º 15
0
        public static MvcHtmlString CommentsCount(this HtmlHelper helper, string navigateUrl, IDataItem item)
        {
            if (item == null)
            {
                return(MvcHtmlString.Empty);
            }

            var  contentItem      = item as Content;
            bool?allowComments    = contentItem != null ? contentItem.AllowComments : null;
            var  threadKey        = ControlUtilities.GetLocalizedKey(item.Id, null, CommentsBehaviorUtilities.GetLocalizedKeySuffix(item.GetType().FullName));
            var  itemTypeFullName = item.GetType().FullName;

            return(CommentsHelpers.CommentsCount(helper, navigateUrl, threadKey, itemTypeFullName, allowComments));
        }
Ejemplo n.º 16
0
        public PuManager(string varFilePath, TabPage tabControl, WatchVariableFlowLayoutPanel watchVariablePanel)
            : base(varFilePath, watchVariablePanel, ALL_VAR_GROUPS, VISIBLE_VAR_GROUPS)
        {
            SplitContainer splitContainerFile = tabControl.Controls["splitContainerPu"] as SplitContainer;

            _puController = splitContainerFile.Panel1.Controls["groupBoxPuController"] as GroupBox;

            // Pu Controller initialize and register click events
            _puController.Controls["buttonPuConHome"].Click  += (sender, e) => PuUtilities.SetMarioPu(0, 0, 0);
            _puController.Controls["buttonPuConZnQpu"].Click += (sender, e) => PuUtilities.TranslateMarioPu(0, 0, -4);
            _puController.Controls["buttonPuConZpQpu"].Click += (sender, e) => PuUtilities.TranslateMarioPu(0, 0, 4);
            _puController.Controls["buttonPuConXnQpu"].Click += (sender, e) => PuUtilities.TranslateMarioPu(-4, 0, 0);
            _puController.Controls["buttonPuConXpQpu"].Click += (sender, e) => PuUtilities.TranslateMarioPu(4, 0, 0);
            _puController.Controls["buttonPuConZnPu"].Click  += (sender, e) => PuUtilities.TranslateMarioPu(0, 0, -1);
            _puController.Controls["buttonPuConZpPu"].Click  += (sender, e) => PuUtilities.TranslateMarioPu(0, 0, 1);
            _puController.Controls["buttonPuConXnPu"].Click  += (sender, e) => PuUtilities.TranslateMarioPu(-1, 0, 0);
            _puController.Controls["buttonPuConXpPu"].Click  += (sender, e) => PuUtilities.TranslateMarioPu(1, 0, 0);

            GroupBox groupBoxMarioPu = splitContainerFile.Panel1.Controls["groupBoxMarioPu"] as GroupBox;

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                false,
                groupBoxMarioPu,
                groupBoxMarioPu.Controls["buttonMarioPuXn"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuXp"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuZn"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuZp"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuXnZn"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuXnZp"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuXpZn"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuXpZp"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuYp"] as Button,
                groupBoxMarioPu.Controls["buttonMarioPuYn"] as Button,
                groupBoxMarioPu.Controls["textBoxMarioPuXZ"] as TextBox,
                groupBoxMarioPu.Controls["textBoxMarioPuY"] as TextBox,
                groupBoxMarioPu.Controls["checkBoxMarioPuQpu"] as CheckBox,
                (float hOffset, float vOffset, float nOffset, bool useQpu) =>
            {
                int hOffsetInt = ParsingUtilities.ParseInt(hOffset);
                int vOffsetInt = ParsingUtilities.ParseInt(vOffset);
                int nOffsetInt = ParsingUtilities.ParseInt(nOffset);
                int multiplier = useQpu ? 4 : 1;
                PuUtilities.TranslateMarioPu(
                    hOffsetInt * multiplier,
                    nOffsetInt * multiplier,
                    -1 * vOffsetInt * multiplier);
            });
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Gets the template based on the Layout property that will be instantiated inside the control.
        /// </summary>
        protected override ITemplate GetTemplate()
        {
            if (SystemManager.GetModule("Feather") == null)
            {
                var markup = this.ProcessLayoutString(Res.Get <GridDesignerResources>().GridDoesNotWork, ensureSfColsWrapper: true);
                return(ControlUtilities.GetTemplate(null, markup.GetHashCode().ToString(CultureInfo.InvariantCulture), null, markup));
            }

            var       layout         = this.Layout;
            bool      isVirtualPath  = layout.StartsWith("~/", StringComparison.Ordinal);
            bool      isHtmlTemplate = layout.EndsWith(".html", StringComparison.OrdinalIgnoreCase) || layout.EndsWith(".htm", StringComparison.Ordinal);
            ITemplate template       = this.GetTemplate(isVirtualPath, isHtmlTemplate, layout);

            return(template);
        }
Ejemplo n.º 18
0
 public MainLoadingForm()
 {
     InitializeComponent();
     textBoxLoadingHelpfulHint.Text = HelpfulHintUtilities.GetRandomHelpfulHint();
     ControlUtilities.AddContextMenuStripFunctions(
         textBoxLoadingHelpfulHint,
         new List <string>()
     {
         "Show All Helpful Hints"
     },
         new List <Action>()
     {
         () => HelpfulHintUtilities.ShowAllHelpfulHints()
     });
 }
        // Public members

        public override void PaintControl(RadioButton control, ControlPaintArgs e)
        {
            e.PaintBackground();
            e.PaintBorder();

            PaintCheck(control, e);

            IRuleset ruleset = e.StyleSheet.GetRuleset(control);

            Rectangle       clientRect      = control.ClientRectangle;
            Rectangle       textRect        = new Rectangle(clientRect.X + CheckWidth + 3, clientRect.Y, clientRect.Width, clientRect.Height);
            TextFormatFlags textFormatFlags = ControlUtilities.GetTextFormatFlags(control.TextAlign);

            e.StyleRenderer.PaintText(e.Graphics, textRect, ruleset, control.Text, control.Font, textFormatFlags);
        }
Ejemplo n.º 20
0
        override protected void OnPaintBackground(PaintEventArgs e)
        {
            SolidBrush brush;

            if (ControlUtilities.IsHierarchyFocused(this))
            {
                brush = new SolidBrush(HeaderColorFocused);
            }
            else
            {
                brush = new SolidBrush(HeaderColor);
            }
            e.Graphics.FillRectangle(brush, e.ClipRectangle);
            brush.Dispose();
        }
Ejemplo n.º 21
0
        public override void InitializeTab()
        {
            base.InitializeTab();

            _numSnowParticles     = 0;
            _snowParticleControls = new List <List <WatchVariableControl> >();


            buttonSnowRetrieve.Click += (sender, e) =>
            {
                int?snowIndexNullable = ParsingUtilities.ParseIntNullable(textBoxSnowIndex.Text);
                if (!snowIndexNullable.HasValue)
                {
                    return;
                }
                int snowIndex = snowIndexNullable.Value;
                if (snowIndex < 0 || snowIndex > _numSnowParticles)
                {
                    return;
                }
                ButtonUtilities.RetrieveSnow(snowIndex);
            };

            ControlUtilities.InitializeThreeDimensionController(
                CoordinateSystem.Euler,
                true,
                groupBoxSnowPosition,
                "SnowPosition",
                (float hOffset, float vOffset, float nOffset, bool useRelative) =>
            {
                int?snowIndexNullable = ParsingUtilities.ParseIntNullable(textBoxSnowIndex.Text);
                if (!snowIndexNullable.HasValue)
                {
                    return;
                }
                int snowIndex = snowIndexNullable.Value;
                if (snowIndex < 0 || snowIndex > _numSnowParticles)
                {
                    return;
                }
                ButtonUtilities.TranslateSnow(
                    snowIndex,
                    hOffset,
                    nOffset,
                    -1 * vOffset,
                    useRelative);
            });
        }
Ejemplo n.º 22
0
 private static void AddModuleMessage(Control control, string heading, string message, ModuleMessage.ModuleMessageType moduleMessageType, string iconSrc)
 {
     if (control != null)
     {
         if (!string.IsNullOrEmpty(message))
         {
             var messagePlaceHolder = ControlUtilities.FindControl <PlaceHolder>(control, "MessagePlaceHolder", true);
             if (messagePlaceHolder != null)
             {
                 messagePlaceHolder.Visible = true;
                 ModuleMessage moduleMessage = GetModuleMessageControl(heading, message, moduleMessageType, iconSrc);
                 messagePlaceHolder.Controls.Add(moduleMessage);
             }
         }
     }
 }
Ejemplo n.º 23
0
        private Control FindModuleControl(int moduleId)
        {
            var moduleContainer = FindModuleContainer(moduleId);

            if (moduleContainer != null)
            {
                var moduleInfo = FindModuleInfo(moduleId);
                if (moduleInfo != null)
                {
                    var controlId = Path.GetFileNameWithoutExtension(moduleInfo.ModuleControl.ControlSrc);
                    return(ControlUtilities.FindFirstDescendent <Control>(moduleContainer, c => c.ID == controlId));
                }
            }

            return(null);
        }
Ejemplo n.º 24
0
        public VariableBitForm(string varName, WatchVariable watchVar, List <uint> fixedAddressList)
        {
            _varName          = varName;
            _watchVar         = watchVar;
            _fixedAddressList = fixedAddressList;
            _timer            = new Timer {
                Interval = 30
            };

            InitializeComponent();

            _textBoxVarName.Text = _varName;
            _bytes = new BindingList <ByteModel>();
            for (int i = 0; i < watchVar.ByteCount.Value; i++)
            {
                _bytes.Add(new ByteModel(watchVar.ByteCount.Value - 1 - i, 0, _dataGridViewBits, this));
            }
            _dataGridViewBits.DataSource        = _bytes;
            _dataGridViewBits.CellContentClick += (sender, e) =>
                                                  _dataGridViewBits.CommitEdit(new DataGridViewDataErrorContexts());
            ControlUtilities.SetTableDoubleBuffered(_dataGridViewBits, true);

            _reversedBytes = _bytes.ToList();
            _reversedBytes.Reverse();

            int effectiveTableHeight = ControlUtilities.GetTableEffectiveHeight(_dataGridViewBits);
            int totalTableHeight     = _dataGridViewBits.Height;
            int emptyHeight          = totalTableHeight - effectiveTableHeight + 3;

            Height -= emptyHeight;

            ControlUtilities.AddCheckableContextMenuStripItems(
                this,
                new List <string>()
            {
                "Show Value", "Show Float Components"
            },
                new List <bool>()
            {
                false, true
            },
                boolValue => _showFloatComponents = boolValue,
                false);

            _timer.Tick += (s, e) => UpdateForm();
            _timer.Start();
        }
Ejemplo n.º 25
0
 private void TabControlDetails_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (_gui.TabControlDetails.SelectedTab == _gui.TabPageInputs)
     {
         _gui.DataGridViewInputs.Refresh();
     }
     else if (_gui.TabControlDetails.SelectedTab == _gui.TabPageHeader)
     {
         ControlUtilities.SetPropertyGridLabelColumnWidth(_gui.PropertyGridHeader, 160);
         _gui.PropertyGridHeader.Refresh();
     }
     else if (_gui.TabControlDetails.SelectedTab == _gui.TabPageStats)
     {
         ControlUtilities.SetPropertyGridLabelColumnWidth(_gui.PropertyGridStats, 160);
         _gui.PropertyGridStats.Refresh();
     }
 }
Ejemplo n.º 26
0
        void SchemeUserControl_Disposed(object sender, EventArgs e)
        {
            ControlUtilities.UnsubscribeDisposed(sender, SchemeUserControl_Disposed);

            var schemeUserControl = sender as SchemeUserControl;

            if (schemeUserControl?.SchemeImage != null && schemeUserControl.RequstsReturningToWizard)
            {
                var clonedImage = schemeUserControl.SchemeImage.Clone(true);
                clonedImage.FileName = schemeUserControl.SchemeImage.FileName;
                ShowWizardUserControl(clonedImage);
            }
            else
            {
                ShowHomeUserControl();
            }
        }
Ejemplo n.º 27
0
 private void TabControlDetails_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (tabControlM64Details.SelectedTab == tabPageM64Inputs)
     {
         dataGridViewM64Inputs.Refresh();
     }
     else if (tabControlM64Details.SelectedTab == tabPageM64Header)
     {
         ControlUtilities.SetPropertyGridLabelColumnWidth(propertyGridM64Header, 160);
         propertyGridM64Header.Refresh();
     }
     else if (tabControlM64Details.SelectedTab == tabPageM64Stats)
     {
         ControlUtilities.SetPropertyGridLabelColumnWidth(propertyGridM64Stats, 160);
         propertyGridM64Stats.Refresh();
     }
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Gets the template.
        /// </summary>
        /// <param name="isVirtualPath">The is virtual path.</param>
        /// <param name="isHtmlTemplate">The is HTML template.</param>
        /// <param name="layout">The layout.</param>
        /// <returns></returns>
        protected virtual ITemplate GetTemplate(bool isVirtualPath, bool isHtmlTemplate, string layout)
        {
            if (isVirtualPath && isHtmlTemplate)
            {
                if (!HostingEnvironment.VirtualPathProvider.FileExists(layout))
                {
                    throw new ArgumentException(Res.Get <InfrastructureResources>("CannotFindTemplateMvcForm", layout));
                }

                using (var reader = new StreamReader(HostingEnvironment.VirtualPathProvider.GetFile(layout).Open()))
                {
                    layout = reader.ReadToEnd();
                }
            }
            else if (isVirtualPath)
            {
                return(ControlUtilities.GetTemplate(layout, null, null, null));
            }
            else if (layout != null && layout.EndsWith(".ascx", StringComparison.Ordinal))
            {
                Type assemblyInfo;

                if (string.IsNullOrEmpty(this.AssemblyInfo))
                {
                    assemblyInfo = Config.Get <ControlsConfig>().ResourcesAssemblyInfo;
                }
                else
                {
                    assemblyInfo = TypeResolutionService.ResolveType(this.AssemblyInfo, true);
                }

                return(ControlUtilities.GetTemplate(null, layout, assemblyInfo, null));
            }

            // Add sf_cols wrapper for back end pages and email campaigns.
            var currentNode         = SiteMapBase.GetActualCurrentNode();
            var rootNode            = currentNode != null ? currentNode.RootNode as PageSiteNode : null;
            var ensureSfColsWrapper = (this.IsBackend() && !SystemManager.IsPreviewMode) ||
                                      rootNode == null ||
                                      rootNode.Id == NewslettersModule.standardCampaignRootNodeId ||
                                      System.Web.HttpContext.Current.Items[SiteMapBase.CurrentNodeKey] == null;

            layout = this.ProcessLayoutString(layout, ensureSfColsWrapper);

            return(ControlUtilities.GetTemplate(null, layout.GetHashCode().ToString(System.Globalization.CultureInfo.InvariantCulture), null, layout));
        }
Ejemplo n.º 29
0
        public void DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
        {
            IRuleset ruleset = GetColumnHeaderRuleset(e.Header);

            const int textPadding = 4;

            Rectangle headerRect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Header.Width, e.Bounds.Height);
            Rectangle textRect   = new Rectangle(headerRect.X + textPadding, headerRect.Y, headerRect.Width - textPadding * 2, headerRect.Height);

            TextFormatFlags textFormatFlags = ControlUtilities.GetTextFormatFlags(e.Header.TextAlign) | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis | TextFormatFlags.NoPrefix;

            styleRenderer.PaintBackground(e.Graphics, headerRect, ruleset);
            styleRenderer.PaintText(e.Graphics, textRect, ruleset, e.Header.Text, e.Font, textFormatFlags);
            styleRenderer.PaintBorder(e.Graphics, headerRect, ruleset);

            PaintHeaderControlRightPortion(e.Header.ListView);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Replaces images sources by cid in e-mail content.
        /// </summary>
        /// <param name="htmlBody">E-mail html content.</param>
        /// <param name="contentIds">Collection of content items identifiers.</param>
        /// <param name="attachments">List of items of <see cref="Sender.EmailAttachment"/> type.</param>
        /// <returns>Html content.</returns>
        private string ReplaceImgSource(string htmlBody, ICollection <Guid> contentIds,
                                        ICollection <EmailAttachment> attachments)
        {
#if !NETSTANDARD2_0 //TODO #CRM-44355
            string decodedBody = UserConnection.GetIsFeatureEnabled("DisableEmailDecoding")
                                        ? htmlBody
                                        : ControlUtilities.HtmlDecode(htmlBody);
#else
            string decodedBody = htmlBody;
#endif
            var files = new List <EntityFile>();
            decodedBody = ReplaceFileServiceCallsInImgSrc(decodedBody, contentIds, files);
            decodedBody = ReplaceHttpHandlersInImgSrc(decodedBody, contentIds);
            decodedBody = ReplaceBase64ImgSrc(decodedBody, attachments, contentIds);
            files.RemoveAll(file => attachments.Any(att => att.Id.Equals(file.RecordId)));
            attachments.AddRange(GetEmailAttachments(files));
            return(decodedBody);
        }
Ejemplo n.º 31
0
        private void frm_AllMain_Load(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    var asm = Assembly.LoadFrom("VIETBAIT.LIS.HISConnectivity.dll");
                    var obj = (UserControl)asm.CreateInstance("VIETBAIT.LIS.HISConnectivity.Usc_KetNoi_XetNghiem");
                    if (obj != null)
                    {
                        obj.Dock = DockStyle.Fill;
                        obj.Visible = true;
                        tabHISLIS.TabVisible = true;
                        tabHISLIS.Controls.Add(obj);
                        //obj.BringToFront();
                    }
                }
                catch (Exception ex)
                {

                }
                try
                {
                    var asm = Assembly.LoadFrom("VIETBAIT.LIS.HISConnectivity.dll");
                    var obj = (UserControl)asm.CreateInstance("VIETBAIT.LIS.HISConnectivity.Usc_HisLis_Gtvt");
                    if (obj != null)
                    {
                        obj.Dock = DockStyle.Fill;
                        obj.Visible = true;
                        tabHISLIS.TabVisible = true;
                        tabHISLIS.Controls.Add(obj);
                        //obj.BringToFront();
                    }
                }
                catch (Exception ex)
                {
                    // Utility.ShowMsg("Lỗi ko load form HISConnectivity" + ex.ToString());
                }
                // Load tab HIS-LIS
                try
                {
                    var asm = Assembly.LoadFrom("VIETBAIT.LIS.HISConnectivity2.dll");
                    var obj = (UserControl) asm.CreateInstance("VIETBAIT.LIS.HISConnectivity.Uc_HisLis_NoiTiet");
                    if (obj != null)
                    {
                        obj.Dock = DockStyle.Fill;
                        obj.Visible = true;
                        tabHISLIS.TabVisible = true;
                        tabHISLIS.Controls.Add(obj);
                        //obj.BringToFront();
                    }
                }
                catch (Exception ex)
                {
                    //   Utility.ShowMsg("Lỗi ko load form HISConnectivity" + ex.ToString());
                }

                try
                {
                    if(_myProperties.TabCapNhapKetQua ==false)
                    {
                         var x = new Uc_QuickInputResult();
                    x.Dock = DockStyle.Fill;
                    x.Visible = true;
                    tabQuickInput.TabVisible = true;
                    tabQuickInput.Controls.Add(x);
                    }

                }
                catch (Exception ex)
                {
                    //  Utility.ShowMsg("Lỗi ko load form Uc_QuickInputResult" + ex.ToString());
                }
                try
                {
                    if (_myProperties.TabXulyDL == false)
                    {
                        tabDataMonitor.TabVisible = true;
                    }

                }
                catch (Exception ex)
                {
                    //  Utility.ShowMsg("Lỗi ko load form Uc_QuickInputResult" + ex.ToString());
                }

                SetEventColumnHeaderColor();

                if (!File.Exists(_autoLoadRegListFile))
                {
                    _autoLoadRegList = false;
                    File.WriteAllText(_autoLoadRegListFile, "0");
                }
                else
                {
                    var tempStr = File.ReadAllText(_autoLoadRegListFile);
                    _autoLoadRegList = tempStr.Contains("1");
                }

                ControlUtilities controlUtilities = new ControlUtilities();
                controlUtilities.FormName = this.Name;
                controlUtilities.Control = this;
                controlUtilities.SetChildWindowsFormProperties();

                ResetTabKey resetTabKey = new ResetTabKey();
                resetTabKey.ArrControl = new Control[] {grdTestInfoModification, grdResultModification};
                resetTabKey.Implement();

                _bw.DoWork += BwPerformSearch;
                _bw.RunWorkerCompleted += BwRunWorkerCompleted;

              //  btnExpandPanelText = btnExpandPanel.Text;
                LoadTestType();
                LoadDepartment();
                LoadObjectType();
                LoadSexCombo();
                LoadDevice();
                //cboDate.SelectedIndex = 0;
                grdPatients.CheckAllRecords();
                if (cmsResultDetail.Items["tsmEditResult"].Enabled == false)
                {
                    grdResultDetail.RootTable.Columns["Test_Result"].EditType = EditType.NoEdit;
                    grdResultDetail.RootTable.Columns["Test_Result"].CellStyle.BackColor = colorNoEditResult;
                }

                // Gán sự kiện cho các nút lọc đã in và chưa in
                rbtTatCa.CheckedChanged += rbtPrint_Checked_Changed;
                rbtChuaIn.CheckedChanged += rbtPrint_Checked_Changed;
                rbtDaIn.CheckedChanged += rbtPrint_Checked_Changed;
                tabTestInfo.SelectedIndex = 1;
                cmdSearch.PerformClick();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg("Lỗi:" + ex.Message);
                Dispose();
            }
        }