public OptionSetSpecifierDialog(PluginControlBase callingControl, bool selectOptionSetsForEntity, string title = null)
     : base(callingControl)
 {
     InitializeComponent();
     FormName = title;
     SelectOptionSetsForEntity = selectOptionSetsForEntity;
 }
Beispiel #2
0
        public PluginForm(UserControl control, string name, string pluginName)
        {
            InitializeComponent();

            Tag         = control.Tag;
            Text        = name;
            PluginTitle = pluginName;

            control.Dock = DockStyle.Fill;
            pnlMain.Controls.Add(control);
            pnlMain.Controls.SetChildIndex(control, 0);
            pluginControlBase              = (PluginControlBase)control;
            pluginControlBase.OnCloseTool += PluginControlBase_OnCloseTool;
            Icon = pluginControlBase.PluginIcon;

            DisplayHighlight(pluginControlBase.ConnectionDetail);

            if (pluginControlBase is IStatusBarMessenger statusBarMessenger)
            {
                statusBarMessenger.SendMessageToStatusBar += StatusBarMessager_SendMessageToStatusBar;
            }

            if (pluginControlBase.ConnectionDetail != null)
            {
                pluginControlBase.ConnectionDetail.OnImpersonate += Detail_OnImpersonate;
                if (pluginControlBase.ConnectionDetail.ImpersonatedUserId != Guid.Empty)
                {
                    Detail_OnImpersonate(pluginControlBase.ConnectionDetail,
                                         new ImpersonationEventArgs(pluginControlBase.ConnectionDetail.ImpersonatedUserId,
                                                                    pluginControlBase.ConnectionDetail.ImpersonatedUserName));
                }
            }
        }
 public OptionSetSpecifierDialog(PluginControlBase callingControl, bool selectOptionSetsForEntity, string title = null)
     : base(callingControl)
 {
     InitializeComponent();
     FormName = title;
     SelectOptionSetsForEntity = selectOptionSetsForEntity;
 }
Beispiel #4
0
 public SpecifyActionsDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
     WorkflowlessActions = callingControl is IGetEditorSetting getter
         ? GetWorkflowLessActions(getter.GetEditorSetting(EditorSetting.WorkflowlessActions).GetList <string>())
         : new List <Workflow>();
 }
 public DialogBase(PluginControlBase callingControl)
     : this()
 {
     if (callingControl == null)
     {
         throw new ArgumentNullException(nameof(callingControl));
     }
     CallingControl = callingControl;
 }
 public DialogBase(PluginControlBase callingControl)
     : this()
 {
     if (callingControl == null)
     {
         throw new ArgumentNullException(nameof(callingControl));
     }
     CallingControl = callingControl;
 }
Beispiel #7
0
 internal ErrorDetail(PluginControlBase owner, Exception exception, string heading, string extrainfo, bool allownewissue)
 {
     this.owner         = owner;
     this.exception     = exception;
     this.extrainfo     = extrainfo;
     this.allownewissue = allownewissue && owner != null && owner is IGitHubPlugin;
     timestamp          = DateTime.Now;
     InitializeComponent();
     if (!string.IsNullOrEmpty(heading))
     {
         Text = heading;
     }
     AddErrorInfo(exception);
     Height = 200;
 }
Beispiel #8
0
        public PluginForm(UserControl control, string name)
        {
            InitializeComponent();

            Tag  = control.Tag;
            Text = name;

            control.Dock = DockStyle.Fill;
            Controls.Add(control);
            Controls.SetChildIndex(control, 0);
            pluginControlBase = (PluginControlBase)control;
            Icon = pluginControlBase.PluginIcon;

            if (pluginControlBase is IStatusBarMessenger statusBarMessenger)
            {
                statusBarMessenger.SendMessageToStatusBar += StatusBarMessager_SendMessageToStatusBar;
            }
        }
Beispiel #9
0
        public static WorkAsyncInfo WithLogger(this WorkAsyncInfo info, PluginControlBase plugin, TextBox output, object asyncArgument = null, string successMessage = "Finished Successfully!", int?successPercent = 99)
        {
            plugin.Enabled = false;
            var oldWork = info.Work;

            info.Work = (w, args) =>
            {
                Logger.WireUpToReportProgress(w);
                try
                {
                    oldWork(w, args);
                    if (successPercent.HasValue)
                    {
                        w.ReportProgress(successPercent.Value, successMessage);
                    }
                    else
                    {
                        plugin.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    w.ReportProgress(int.MinValue, ex.ToString());
                }
                finally
                {
                    Logger.UnwireFromReportProgress(w);
                }
            };
            info.AsyncArgument = asyncArgument;

            info.PostWorkCallBack = e => // Creation has finished.  Cleanup
            {
                Logger.DisplayLog(e, output);
                plugin.Enabled = true;
            };
            info.ProgressChanged = e => // Logic wants to display an update
            {
                Logger.DisplayLog(e, plugin.SetWorkingMessage, output);
            };
            return(info);
        }
Beispiel #10
0
        public static void RetrieveTypes(this ComboBox comboBox, PluginControlBase host, PluginAssembly pluginAssembly, bool allTypesOption = false)
        {
            if (comboBox == null || comboBox.Parent == null)
            {
                return;
            }

            var info = new WorkAsyncInfo();

            info.Message = "Loading types...";

            info.Work = (worker, a) =>
            {
                a.Result = host.Service.GetPluginTypes(pluginAssembly.Id);
            };

            info.PostWorkCallBack = (a) =>
            {
                comboBox.Items.Clear();

                if (allTypesOption)
                {
                    comboBox.Items.Add(new PluginType
                    {
                        FriendlyName = "All types"
                    });
                }

                foreach (var type in ((Entity[])a.Result).Select(x => new PluginType(x, pluginAssembly)))
                {
                    comboBox.Items.Add(type);
                }

                if (allTypesOption)
                {
                    // Select all types
                    comboBox.SelectedIndex = 0;
                }
            };

            host.WorkAsync(info);
        }
Beispiel #11
0
        public PluginForm(UserControl control, string name)
        {
            InitializeComponent();

            Tag  = control.Tag;
            Text = name;

            control.Dock = DockStyle.Fill;
            panel1.Controls.Add(control);
            panel1.Controls.SetChildIndex(control, 0);
            pluginControlBase              = (PluginControlBase)control;
            pluginControlBase.OnCloseTool += PluginControlBase_OnCloseTool;
            Icon = pluginControlBase.PluginIcon;

            DisplayHighlight(pluginControlBase.ConnectionDetail);

            if (pluginControlBase is IStatusBarMessenger statusBarMessenger)
            {
                statusBarMessenger.SendMessageToStatusBar += StatusBarMessager_SendMessageToStatusBar;
            }
        }
Beispiel #12
0
        public static void CreateNewIssue(PluginControlBase tool, string addedtext, string extrainfo)
        {
            if (tool == null || !(tool is IGitHubPlugin githubtool))
            {
                return;
            }
            var additionalInfo = "?body=[Write any error info to resolve easier]\n\n---\n";

            additionalInfo += addedtext.Replace("   at ", "- ") + "\n\n---\n";
            if (!string.IsNullOrWhiteSpace(extrainfo))
            {
                additionalInfo += "\n```\n" + extrainfo + "\n```\n---\n";
            }
            additionalInfo += $"- {tool.ProductName} Version: {Assembly.GetExecutingAssembly().GetName().Version}\n";
            if (tool.ConnectionDetail != null)
            {
                additionalInfo += $"- DB Version: {tool.ConnectionDetail.OrganizationVersion}\n";
                additionalInfo += $"- Deployment: {(tool.ConnectionDetail.WebApplicationUrl.ToLower().Contains("dynamics.com") ? "Online" : "OnPremise")}\n";
            }
            additionalInfo = additionalInfo.Replace("\n", "%0A").Replace("&", "%26").Replace(" ", "%20");
            var url = $"https://github.com/{githubtool.UserName}/{githubtool.RepositoryName}/issues/new";

            Process.Start(url + additionalInfo);
        }
        private static void PublishEntity(PluginControlBase objPlugin, IOrganizationService serviceProxy, EntityMetadata entityItem)
        {
            string paramXml =
                $" <importexportxml><entities><entity>{entityItem.LogicalName}</entity></entities><nodes/><securityroles/><settings/><workflows/></importexportxml>";

            objPlugin.WorkAsync(new WorkAsyncInfo
            {
                Message = "Publishing Entity  " + entityItem.LogicalName,
                Work    = (bw, ex) =>
                {
                    serviceProxy.Execute(new PublishXmlRequest
                    {
                        ParameterXml = paramXml
                    });
                },
                PostWorkCallBack = ex =>
                {
                    if (ex.Error != null)
                    {
                        MessageBox.Show(objPlugin.ParentForm, ex.Error.Message, @"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            });
        }
Beispiel #14
0
 public SelectViewDialog(PluginControlBase sender)
 {
     InitializeComponent();
     this.host = sender;
 }
 public AttributeToEnumMapperDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
 }
Beispiel #16
0
 public Messenger(PluginControlBase pluginControl)
 {
     this.pluginControl = pluginControl ?? throw new ArgumentNullException(nameof(pluginControl));
 }
Beispiel #17
0
 /// <summary>
 /// Will initiate loading of assemblies from currently connected server if current connection was updated in main application
 /// </summary>
 /// <param name="sender">Instance of class <see cref="MainControl"/></param>
 /// <param name="e">Event arguments</param>
 private void MainControl_ConnectionUpdated(object sender, PluginControlBase.ConnectionUpdatedEventArgs e)
 {
     ExecuteMethod(RetrieveAssemblies);
 }
Beispiel #18
0
 public SpecifyOptionSetsDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
 }
Beispiel #19
0
 public PasswordDialog(PluginControlBase callingControl) : base(callingControl)
 {
     InitializeComponent();
 }
Beispiel #20
0
 public OptionSetSpecifierDialog(PluginControlBase callingControl, bool selectOptionSetsForEntity)
     : base(callingControl)
 {
     InitializeComponent();
     SelectOptionSetsForEntity = selectOptionSetsForEntity;
 }
Beispiel #21
0
 public SpecifyStringValuesDialog(PluginControlBase callingControl, string title)
     : base(callingControl)
 {
     Title = title;
     InitializeComponent();
 }
 public OptionSetSpecifierDialog(PluginControlBase callingControl, bool selectOptionSetsForEntity)
     : base(callingControl)
 {
     InitializeComponent();
     SelectOptionSetsForEntity = selectOptionSetsForEntity;
 }
 public AttributesToEnumMapperDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
 }
 public SpecifyStringValuesDialog(PluginControlBase callingControl, string title)
     : base(callingControl)
 {
     Title = title;
     InitializeComponent();
 }
Beispiel #25
0
 public AttributeCaseSpecifierDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
 }
 public SelectViewDialog(PluginControlBase sender)
 {
     InitializeComponent();
     this.host = sender;
 }
 public AttributeCaseSpecifierDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
 }
 public SpecifyOptionSetsDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
 }
 public SpecifyAttributeNamesDialog(PluginControlBase callingControl) 
     : base(callingControl)
 {
     
 }
 public SpecifyAttributeNamesDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
 }
Beispiel #31
0
 public static void CreateNewIssueFromError(PluginControlBase tool, Exception error, string moreinfo)
 => CreateNewIssue(tool, "```\n" + ToTypeString(error) + ":\n" + error.Message + "\n" + error.StackTrace + "\n```", moreinfo);
Beispiel #32
0
 public SpecifyAttributesDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
 }
 private void ViewParameters_ConnectionUpdated(object sender, PluginControlBase.ConnectionUpdatedEventArgs e)
 {
     if (e.ConnectionDetail != null && !string.IsNullOrEmpty(e.ConnectionDetail.OrganizationServiceUrl))
     {
         this.RetrieveSnapshot((MainControl)sender);
         if (e.ConnectionDetail != null)
         {
             this.gbSnapshot.Text = e.ConnectionDetail.OrganizationFriendlyName;
         }
     }
 }
Beispiel #34
0
        internal static void OpenResourcePluginControl(PluginControlBase plugin, ResourceOperateInfo opInfo,
            ResourceInfo resInfo, Dictionary<string, string> parameter)
        {
            if (plugin != null)
            {
                plugin.ResourceInfo = resInfo;
                plugin.ResourceService = Services.ResourceService;
                plugin.OperateInfo = opInfo;
                plugin.Parameter = parameter;

                ZLSoft.BusinessHome.Plugin.SmartForms.SmartForm sf = plugin as ZLSoft.BusinessHome.Plugin.SmartForms.SmartForm;
                if (sf != null)
                {
                    //sf.RunTimeInfo.ShowToolBarOnSeperatedForm = true;
                    try
                    {
                        Type t = typeof(ZLSoft.BusinessHome.Plugin.SmartForms.SmartFormRunTimeInfo);
                        PropertyInfo pi = t.GetProperty("ShowToolBarOnSeperatedForm");
                        if (pi != null)
                        {
                            pi.SetValue(sf.RunTimeInfo, true, null);
                        }
                    }
                    catch { }

                    try
                    {
                        Type t = sf.GetType();
                        FieldInfo fi = t.GetField("ribbonControl1", BindingFlags.NonPublic | BindingFlags.Instance);
                        if (fi != null)
                        {
                            DevExpress.XtraBars.Ribbon.RibbonControl rc = fi.GetValue(sf) as DevExpress.XtraBars.Ribbon.RibbonControl;
                            if (rc != null)
                                rc.Visible = true;
                        }
                    }
                    catch { }
                }

                Form form = CreatePluginForm(plugin.OperateInfo, plugin, "", parameter);
                form.Show(Program.MainForm);
            }
        }
Beispiel #35
0
        /// <summary>
        /// ����������
        /// </summary>
        static DevExpress.XtraEditors.XtraForm CreatePluginForm(ResourceOperateInfo opInfo, PluginControlBase pluginControlBase,
            string pluginName, Dictionary<string, string> parameter)
        {
            PluginFormBase form = new PluginFormBase();
            KeyValuePair<string, string> info = new KeyValuePair<string, string>(pluginControlBase.HostResourceID, opInfo.ID);
            form.Tag = info;
            form.ClientSize = pluginControlBase.Size;
            form.Controls.Add(pluginControlBase);
            form.StartPosition = FormStartPosition.CenterScreen;

            //���ݴ����λ�ã�ע�⣺��������[Dock]����֮ǰ
            if (pluginControlBase.Location != Point.Empty &&
                !(pluginControlBase.Location.X == 0 && pluginControlBase.Location.Y == 0))
            {
                form.Location = new Point(pluginControlBase.Location.X, pluginControlBase.Location.Y);
                form.StartPosition = FormStartPosition.Manual;
            }

            pluginControlBase.Dock = DockStyle.Fill;

            try
            {
                form.ImeMode = ImeMode.OnHalf;
            }
            catch (Exception ex)
            {
                ClientLogger.Error("���ô����IMEģʽΪ[ImeMode.OnHalf]ʱ�����" + ex.Message + Environment.NewLine
                    + "������.net FrameWork��2.0sp2���ϰ汾��");
            }

            if (parameter.ContainsKey("TopMost") && !string.IsNullOrEmpty(parameter["TopMost"]))
                form.TopMost = parameter["TopMost"].ToUpper() == "TRUE";
            if (parameter.ContainsKey(AppConst.SmartForm_InputParamKey_WindowsState_Text)
                && !string.IsNullOrEmpty(parameter[AppConst.SmartForm_InputParamKey_WindowsState_Text]))
            {
                SmartFormWindowsState ws = EnumHelper.GetEnumValueByName<SmartFormWindowsState>(parameter[AppConst.SmartForm_InputParamKey_WindowsState_Text]);

                if (ws == SmartFormWindowsState.ȫ����ʾ)
                    form.WindowState = FormWindowState.Maximized;
                else if (ws == SmartFormWindowsState.��С����ʾ)
                    form.WindowState = FormWindowState.Minimized;
            }

            if (parameter.ContainsKey(AppConst.SmartForm_InputParamKey_FormBorderStyle_Text)
                && !string.IsNullOrEmpty(parameter[AppConst.SmartForm_InputParamKey_FormBorderStyle_Text]))
            {
                SmartFormBorderStyle ws = EnumHelper.GetEnumValueByName<SmartFormBorderStyle>(parameter[AppConst.SmartForm_InputParamKey_FormBorderStyle_Text]);

                if (ws == SmartFormBorderStyle.�ɵ�����С)
                    form.FormBorderStyle = FormBorderStyle.Sizable;
                else if (ws == SmartFormBorderStyle.�̶���С)
                    form.FormBorderStyle = FormBorderStyle.FixedSingle;
                else if (ws == SmartFormBorderStyle.�ޱ߿�)
                    form.FormBorderStyle = FormBorderStyle.None;
            }

            string startPosition = string.Empty;

            if (parameter.ContainsKey(AppConst.SmartForm_InputParamKey_StartPosition_Text)
                && !string.IsNullOrEmpty(parameter[AppConst.SmartForm_InputParamKey_StartPosition_Text]))
            {
                startPosition = parameter[AppConst.SmartForm_InputParamKey_StartPosition_Text].ToString();

                if (startPosition == SmartFormStartPosition.��Ļ����.ToString())
                {
                    form.StartPosition = FormStartPosition.CenterScreen;
                }
                else if (startPosition == SmartFormStartPosition.���������.ToString())
                {
                    form.StartPosition = FormStartPosition.CenterParent;
                }
                else
                {
                    form.StartPosition = FormStartPosition.Manual;

                    string strTopLocation = parameter[AppConst.SmartForm_InputParamKey_StartPosition_Text].ToString();

                    if (!string.IsNullOrEmpty(strTopLocation))
                    {
                        string[] temps = strTopLocation.Split(',');
                        if (temps.Length > 0)
                        {
                            try
                            {
                                int x = Convert.ToInt32(temps[0]);
                                int y = Convert.ToInt32(temps[1]);
                                int h = Convert.ToInt32(temps[2]);  //�ؼ��߶�

                                Point topLocation = new Point(x, y);
                                topLocation.Offset(1, 1);
                                Point bottomLocation = new Point(topLocation.X, topLocation.Y + h);
                                Point location = DevExpress.Utils.ControlUtils.CalcLocation(bottomLocation, topLocation, form.Size);
                                form.Location = location;
                            }
                            catch (Exception ex)
                            {
                                //ClientLogger.Error("ͨ���������ô���[" + pluginName + "]ʱ���õij�ʼλ��ʱ���ַ���[" + DesktopLocation + "]�޷�ת������Чֵ��", ex);
                            }
                        }
                    }
                }
            }

            if (parameter.ContainsKey(AppConst.SmartForm_InputParamKey_ScreenIndex_Text)
              && !string.IsNullOrEmpty(parameter[AppConst.SmartForm_InputParamKey_ScreenIndex_Text]))
            {
                int screenIndex = Convert.ToInt32(parameter[AppConst.SmartForm_InputParamKey_ScreenIndex_Text]);

                if (screenIndex > 0 && Screen.AllScreens.Length > 1 && screenIndex < Screen.AllScreens.Length)
                {
                    form.DesktopLocation = Screen.AllScreens[screenIndex].Bounds.Location;
                    form.StartPosition = FormStartPosition.Manual;

                    if (startPosition == SmartFormStartPosition.��Ļ����.ToString() || string.IsNullOrEmpty(startPosition))
                    {
                        int emptyWidth = Screen.AllScreens[screenIndex].Bounds.Width - form.ClientSize.Width;
                        int emptyHeight = Screen.AllScreens[screenIndex].Bounds.Height - form.ClientSize.Height;

                        form.Location = new Point(form.DesktopLocation.X + (emptyWidth / 2), form.DesktopLocation.Y + (emptyHeight / 2));
                    }
                }
            }

            if (pluginName == "")
            {
                form.Text = pluginControlBase.ResourceInfo.DisplayName;
            }
            else
            {
                form.Text = pluginName;
            }

            form.FormClosing += new FormClosingEventHandler(pluginForm_FormClosing);
            form.FormClosed += new FormClosedEventHandler(pluginForm_FormClosed);
            return form;
        }
 public SpecifyAttributesDialog(PluginControlBase callingControl)
     : base(callingControl)
 {
     InitializeComponent();
 }
Beispiel #37
0
        public TabPage GenerateTab(string displayName, int countRecord, out DataGridView grid, PluginControlBase control)
        {
            TabPage tbPage = new TabPage(string.Format("{0} ({1})", displayName, countRecord));

            grid = new DataGridView();
            ((System.ComponentModel.ISupportInitialize)(grid)).BeginInit();
            control.SuspendLayout();
            grid.Parent = tbPage;
            grid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            grid.Dock = DockStyle.Fill;
            grid.RowHeadersVisible        = false;
            grid.AutoSizeColumnsMode      = DataGridViewAutoSizeColumnsMode.Fill;
            grid.AutoSizeRowsMode         = DataGridViewAutoSizeRowsMode.DisplayedCells;
            grid.AllowUserToAddRows       = false;
            grid.AllowUserToDeleteRows    = false;
            grid.AllowUserToOrderColumns  = false;
            grid.AllowUserToResizeColumns = true;
            grid.AllowUserToResizeRows    = true;
            grid.ReadOnly = true;
            control.ResumeLayout(false);

            return(tbPage);
        }
 public PasswordDialog(PluginControlBase callingControl) : base(callingControl)
 {
     InitializeComponent();
 }
Beispiel #39
0
 public AsyncJobScheduler(PluginControlBase pluginControl, PluginViewModelBase pluginViewModel = null)
 {
     this.queue           = new Queue <Job>();
     this.pluginControl   = pluginControl;
     this.pluginViewModel = pluginViewModel;
 }