Ejemplo n.º 1
1
 /// <summary>
 /// Shows the dialog with the specified image.
 /// </summary>
 /// <param name="owner">The owner.</param>
 /// <param name="title">The title.</param>
 /// <param name="image">The image.</param>
 public void Show(IWin32Window owner, string title, Image image)
 {
     this.ClientSize = image.Size;
     this.Text = title;
     this.pictureBox.Image = image;
     base.ShowDialog();
 }
Ejemplo n.º 2
0
        public UserDialog (IWin32Window owner, Control content, MessageBoxButtons buttons)
        {
            InitializeComponent();

            ClientSize = new System.Drawing.Size(content.Width, content.Height + buttonPanel.Height);

            contentPanel.Controls.Add(content);
            content.Dock = DockStyle.Fill;

            StartPosition = owner == null ? FormStartPosition.CenterScreen : FormStartPosition.CenterParent;

            if (buttons == MessageBoxButtons.OK)
            {
                okButton.Visible = true;
                cancelButton.Visible = false;
            }
            else if (buttons == MessageBoxButtons.OKCancel)
            {
                okButton.Visible = true;
                cancelButton.Visible = true;
            }
            else
            {
                throw new NotImplementedException("UserDialog currently only supports OK and OKCancel values for MessageBoxButtons");
            }
        }
 public MdiControlStrip(IWin32Window target)
 {
     IntPtr systemMenu = System.Windows.Forms.UnsafeNativeMethods.GetSystemMenu(new HandleRef(this, Control.GetSafeHandle(target)), false);
     this.target = target;
     this.minimize = new ControlBoxMenuItem(systemMenu, 0xf020, target);
     this.close = new ControlBoxMenuItem(systemMenu, 0xf060, target);
     this.restore = new ControlBoxMenuItem(systemMenu, 0xf120, target);
     this.system = new SystemMenuItem();
     Control control = target as Control;
     if (control != null)
     {
         control.HandleCreated += new EventHandler(this.OnTargetWindowHandleRecreated);
         control.Disposed += new EventHandler(this.OnTargetWindowDisposed);
     }
     this.Items.AddRange(new ToolStripItem[] { this.minimize, this.restore, this.close, this.system });
     base.SuspendLayout();
     foreach (ToolStripItem item in this.Items)
     {
         item.DisplayStyle = ToolStripItemDisplayStyle.Image;
         item.MergeIndex = 0;
         item.MergeAction = MergeAction.Insert;
         item.Overflow = ToolStripItemOverflow.Never;
         item.Alignment = ToolStripItemAlignment.Right;
         item.Padding = Padding.Empty;
     }
     this.system.Image = this.GetTargetWindowIcon();
     this.system.Alignment = ToolStripItemAlignment.Left;
     this.system.DropDownOpening += new EventHandler(this.OnSystemMenuDropDownOpening);
     this.system.ImageScaling = ToolStripItemImageScaling.None;
     this.system.DoubleClickEnabled = true;
     this.system.DoubleClick += new EventHandler(this.OnSystemMenuDoubleClick);
     this.system.Padding = Padding.Empty;
     this.system.ShortcutKeys = Keys.Alt | Keys.OemMinus;
     base.ResumeLayout(false);
 }
Ejemplo n.º 4
0
 public DialogResult ShowDialogInternal(string Text, IWin32Window owner)
 {
     m_Result = false;
     txtInput.Text = Text;
     this.ShowDialog(owner);
     return (m_Result) ? DialogResult.OK : DialogResult.Cancel;
 }
        public SetupStatus Install(IWin32Window owner)
        {
            if (_status == SetupStatus.Installed)
                return _status;

            try
            {
                // get Everyone token for the current locale
                string everyone = new System.Security.Principal.SecurityIdentifier(
                    "S-1-1-0").Translate(typeof(System.Security.Principal.NTAccount)).ToString();
                string port = ConfigurationManager.AppSettings["Port"];
                string arguments = string.Format("http add urlacl url=http://+:{0}/ user=\"\\{1}\"", port, everyone);
                Log.Info("Adding ACL rule...");
                ProcessHelper.RunNetShell(arguments, "Failed to add URL ACL");
                _status = SetupStatus.Installed;
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                _status = SetupStatus.Failed;
                Settings.Instance.UrlReservationSetupHadErrors = true;
                Settings.Instance.Save();
                throw;
            }
            return _status;
        }
Ejemplo n.º 6
0
        public static string ExpandFolderPath(IWin32Window owner, string path)
        {
            if (path == null)
                throw new ArgumentNullException("path");

            return _folderPathRe.Replace(path, m => PerformReplace(owner, m));
        }
Ejemplo n.º 7
0
 public void SearchForUpdatesAndShow(IWin32Window aOwnerWindow, bool alwaysShow)
 {
     OwnerWindow = aOwnerWindow;
     new Thread(SearchForUpdates).Start();
     if (alwaysShow)
         ShowDialog(aOwnerWindow);
 }
 /// <summary>
 /// Notifies the plugin that a blog post was successfully published.
 /// </summary>
 /// <param name="dialogOwner">Owner for any dialog boxes shown.</param>
 /// <param name="properties">Property-set that the plugin can use to get and set properties for this post.</param>
 /// <param name="publishingContext">Publishing context for HTML generation.</param>
 /// <param name="publish">If false, the post was posted as a draft.</param>
 public virtual void OnPostPublish(
     IWin32Window dialogOwner,
     IProperties properties,
     IPublishingContext publishingContext,
     bool publish)
 {
 }
Ejemplo n.º 9
0
 public static void SaveRadTree(RadTreeView view, IWin32Window frm = null, string filename = "")
 {
     var saveFileDialogCsv = new SaveFileDialog();
     saveFileDialogCsv.Title = "Save data to Comma Separated File";
     saveFileDialogCsv.Filter = "CSV or Excel|*.csv";
     saveFileDialogCsv.CheckPathExists = true;
     saveFileDialogCsv.DefaultExt = "csv";
     saveFileDialogCsv.AddExtension = true;
     saveFileDialogCsv.OverwritePrompt = true;
     saveFileDialogCsv.InitialDirectory = Repository.DataFolder;
     saveFileDialogCsv.FileName = filename;
     if (saveFileDialogCsv.ShowDialog(frm) == System.Windows.Forms.DialogResult.OK)
     {
         try
         {
             sb = new StringBuilder();
             foreach (var node in view.Nodes)
             {
                 sb.AppendLine(node.Text.Replace("<=", ","));
                 ListNodes(node);
             }
             System.IO.File.WriteAllText(saveFileDialogCsv.FileName, sb.ToString(),Encoding.UTF8);
         }
         catch (Exception exc)
         {
             MessageBox.Show(exc.Message, "Unexpected Error");
         }
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Internal constructor
 /// </summary>
 /// <param name="serialNumber">C++ pointer serial number returned by the C interface wrapper.</param>
 /// <param name="window">The control created and embedded in the expandable tab control in the content browser.</param>
 internal UserInterfaceSection(int serialNumber, IWin32Window window)
 {
   m_SerialNumber = serialNumber;
   m_Window = window;
   if (serialNumber > 0) m_UserInterfaceSectionDictionary.Add(serialNumber, this);
   SetHooks();
 }
Ejemplo n.º 11
0
 public new void Show(IWin32Window owner)
 {
     if (!Visible)
         base.Show(owner);
     else
         Activate();
 }
Ejemplo n.º 12
0
        public static bool RunScript(IWin32Window owner, GitModule aModule, string script, RevisionGrid revisionGrid)
        {
            if (string.IsNullOrEmpty(script))
                return false;

            ScriptInfo scriptInfo = ScriptManager.GetScript(script);

            if (scriptInfo == null)
            {
                MessageBox.Show(owner, "Cannot find script: " + script, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            if (string.IsNullOrEmpty(scriptInfo.Command))
                return false;

            string argument = scriptInfo.Arguments;
            foreach (string option in Options)
            {
                if (string.IsNullOrEmpty(argument) || !argument.Contains(option))
                    continue;
                if (!option.StartsWith("{s"))
                    continue;
                if (revisionGrid != null)
                    continue;
                MessageBox.Show(owner,
                    string.Format("Option {0} is only supported when started from revision grid.", option),
                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            return RunScript(owner, aModule, scriptInfo, revisionGrid);
        }
Ejemplo n.º 13
0
		/// <summary>
		/// Show a configuration dialog (modal) for JMDWriter
		/// </summary>
		/// <param name="threads">number of threads</param>
		/// <param name="complevel">compression level</param>
		/// <param name="tmin">minimum possible number of threads</param>
		/// <param name="tmax">maximum possible number of threads</param>
		/// <param name="cmin">minimum compression level, assumed to be "no compression"</param>
		/// <param name="cmax">maximum compression level</param>
		/// <param name="hwnd">hwnd of parent</param>
		/// <returns>false if user canceled; true if user consented</returns>
		public static bool DoCompressionDlg(ref int threads, ref int complevel, int tmin, int tmax, int cmin, int cmax, IWin32Window hwnd)
		{
			JMDForm j = new JMDForm();
			j.threadsBar.Minimum = tmin;
			j.threadsBar.Maximum = tmax;
			j.compressionBar.Minimum = cmin;
			j.compressionBar.Maximum = cmax;
			j.threadsBar.Value = threads;
			j.compressionBar.Value = complevel;
			j.threadsBar_Scroll(null, null);
			j.compressionBar_Scroll(null, null);
			j.threadLeft.Text = String.Format("{0}", tmin);
			j.threadRight.Text = String.Format("{0}", tmax);
			j.compressionLeft.Text = String.Format("{0}", cmin);
			j.compressionRight.Text = String.Format("{0}", cmax);

			DialogResult d = j.ShowDialog(hwnd);

			threads = j.threadsBar.Value;
			complevel = j.compressionBar.Value;

			j.Dispose();
			if (d == DialogResult.OK)
				return true;
			else
				return false;
		}
 public override bool EditComponent(ITypeDescriptorContext context, object obj, IWin32Window parent)
 {
     bool flag = false;
     bool inTemplateModeInternal = false;
     IComponent component = (IComponent) obj;
     ISite site = component.Site;
     if (site != null)
     {
         IDesignerHost service = (IDesignerHost) site.GetService(typeof(IDesignerHost));
         TemplatedControlDesigner designer = (TemplatedControlDesigner) service.GetDesigner(component);
         inTemplateModeInternal = designer.InTemplateModeInternal;
     }
     if (!inTemplateModeInternal)
     {
         System.Type[] componentEditorPages = this.GetComponentEditorPages();
         if ((componentEditorPages != null) && (componentEditorPages.Length != 0))
         {
             ComponentEditorForm form = new ComponentEditorForm(obj, componentEditorPages);
             if (!string.Equals(System.Design.SR.GetString("RTL"), "RTL_False", StringComparison.Ordinal))
             {
                 form.RightToLeft = RightToLeft.Yes;
                 form.RightToLeftLayout = true;
             }
             if (form.ShowForm(parent, this.GetInitialComponentEditorPageIndex()) == DialogResult.OK)
             {
                 flag = true;
             }
         }
         return flag;
     }
     System.Windows.Forms.Design.RTLAwareMessageBox.Show(null, System.Design.SR.GetString("BDL_TemplateModePropBuilder"), System.Design.SR.GetString("BDL_PropertyBuilder"), MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1, 0);
     return flag;
 }
Ejemplo n.º 15
0
		public static DialogResult Show (IWin32Window owner, string text, string caption,
						 MessageBoxButtons buttons)
		{
			MessageBoxForm form = new MessageBoxForm (owner, text, caption, buttons, MessageBoxIcon.None);
				
			return form.RunDialog ();
		}
        public IDataItem createByForm(IConnection aConnection, IWin32Window aOwner)
        {
            Connection lConnection  = (Connection)aConnection;
                DataItem lItem          = new DataItem();

                using (var lSetupForm = new ItemSetupForm(lConnection, lItem))
                {
                    if (lSetupForm.ShowDialog(aOwner) == DialogResult.OK)
                    {
                        lItem.mMemoryType   = lSetupForm.MemoryType;
                        lItem.DB            = lSetupForm.DB;
                        lItem.Byte          = lSetupForm.Byte;
                        lItem.Bit           = lSetupForm.Bit;
                        lItem.DataType      = lSetupForm.DataType;
                        lItem.FloatingP     = lSetupForm.FloatingP;
                        lItem.Signed        = lSetupForm.Signed;
                        lItem.Length        = lSetupForm.Length;

                        lConnection.addItem(lItem);
                    }
                    else
                    {
                        lItem = null;
                    }
                }

                return lItem;
        }
 /// <include file='doc\MessageBox.uex' path='docs/doc[@for="MessageBox.Show6"]/*' />
 /// <devdoc>
 ///    <para>
 ///       Displays a message box with specified text, caption, and style.
 ///       Makes the dialog RTL if the resources for this dll have been localized to a RTL language.
 ///    </para>
 /// </devdoc>
 public static DialogResult Show(IWin32Window owner, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, 
                                 MessageBoxDefaultButton defaultButton, MessageBoxOptions options) {
     if (RTLAwareMessageBox.IsRTLResources) {
         options |= (MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading);
     }
     return MessageBox.Show(owner, text, caption, buttons, icon, defaultButton, options);
 }
Ejemplo n.º 18
0
 /// <summary>
 /// this Method will run automationTests for automationElement
 /// </summary>
 public static void RunTest(IEnumerable<AutomationTest> automationTests, AutomationElement automationElement, bool TestEvents, IWin32Window parentWindow)
 {
     using (AutomationTestManager manager = new AutomationTestManager(TestEvents, false))
     {
         RunTestInternal(automationTests, automationElement, parentWindow, manager);
     }
 }
Ejemplo n.º 19
0
 public new void ShowDialog(IWin32Window owner)
 {
     if (CheckMasterAuthority())
         base.ShowDialog(owner);
     else
         MessageBox.Show("对不起,操作权限不足。");
 }
Ejemplo n.º 20
0
 public static void Execute(IWin32Window owner)
 {
     using (var form = new EmployeesForm())
     {
         form.ShowDialog(owner);
     }
 }
Ejemplo n.º 21
0
        public Search(string token, IWin32Window owner, TransferType transferType, bool closeOnTransfer)
        {
            _owner = (Form)owner;
            _token = token;
            _transferType = transferType;
            _closeOnTransfer = closeOnTransfer;

            if (!string.IsNullOrEmpty(token))
            {

                // instantiate our ChemSpider Search instance
                _cs = new ChemSpiderSearch.Search();

                // instantiate our ChemSpider InChI instance
                _ci = new ChemSpiderInChI.InChI();

                // setup event handlers
                _cs.ElementsSearchCompleted += (cs_ElementsSearchCompleted);
                _cs.IntrinsicPropertiesSearchCompleted += (cs_IntrinsicPropertiesSearchCompleted);
                _cs.LassoSearchCompleted += (cs_LassoSearchCompleted);
                _cs.PredictedPropertiesSearchCompleted += (cs_PredictedPropertiesSearchCompleted);
                _cs.SimilaritySearchCompleted += (cs_SimilaritySearchCompleted);
                _cs.SimpleSearchCompleted += (cs_SimpleSearchCompleted);
                _cs.StructureSearchCompleted += (cs_StructureSearchCompleted);
                _cs.SubstructureSearchCompleted += (cs_SubstructureSearchCompleted);
                _cs.GetAsyncSearchResultCompleted += (_cs_GetAsyncSearchResultCompleted);
                _cs.GetAsyncSearchResultPartCompleted += (_cs_GetAsyncSearchResultPartCompleted);
            }
            else
            {
                MessageBox.Show(owner, "ChemSpider token not set", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 22
0
        public override bool OnPrePublish(IWin32Window dialogOwner, IProperties properties,
                                          IPublishingContext publishingContext, bool publish)
        {
            var info = (BlogPost) publishingContext.PostInfo;

            //look at the publish date.
            if (!info.HasDatePublishedOverride)
            {
                var nextPubDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                nextPubDate = GetNextDayOccurrence(DayOfWeek.Tuesday, nextPubDate);

                var reader = new JsonTextReader(reader: File.OpenText("Plugins\\Throttle.json"));
                var json = new Newtonsoft.Json.JsonSerializer();

                var config = json.Deserialize<Configuration>(reader);
                var wrapper = new MetaWeblogWrapper(config.Url, config.Username, config.Password);
                List<Post> recentPosts = wrapper.GetRecentPosts(10).ToList();
                while (recentPosts.Any(p => p.DateCreated >= nextPubDate && p.DateCreated < nextPubDate.AddDays(1)))
                {
                    nextPubDate = GetNextDayOccurrence(DayOfWeek.Tuesday, nextPubDate.AddDays(1));
                }
                var pubDate = new DateTime(nextPubDate.Year, nextPubDate.Month, nextPubDate.Day, 9, 0, 0);
                info.DatePublished = pubDate;
                info.DatePublishedOverride = pubDate;
            }
            return base.OnPrePublish(dialogOwner, properties, publishingContext, publish);
        }
		public DialogResult showMessage(IWin32Window owner, string message, string title, MessageBoxIcon icon, MessageBoxButtons buttons) {

			//Wenn kein Owner mitgegeben wurde, dann Versuchen das Hauptfenster anzuzeigen
			if (owner == null || owner.Handle == IntPtr.Zero)
				owner = new dummyWindow(Process.GetCurrentProcess().MainWindowHandle);

			const string appTitle = "updateSystem.NET Administration";

			//Nachricht loggen
			logLevel lLevel;
			switch (icon) {
				case MessageBoxIcon.Error:
					lLevel = logLevel.Error;
					break;
				case MessageBoxIcon.Exclamation:
					lLevel = logLevel.Warning;
					break;
				default:
					lLevel = logLevel.Info;
					break;
			}
			Log.writeState(lLevel,
			                        string.Format("{0}{1}", string.IsNullOrEmpty(title) ? "" : string.Format("{0} -> ", title),
			                                      message));

			var dlgResponse = Environment.OSVersion.Version.Major >= 6
			       	? showTaskDialog(owner, appTitle, title, message, buttons, icon)
			       	: showMessageBox(owner, appTitle, title, message, icon, buttons);

			Log.writeKeyValue(lLevel, "Messagedialogresult", dlgResponse.ToString());

			return dlgResponse;
		}
Ejemplo n.º 24
0
 public static void ShowLoading(IWin32Window owner, string text, Image loadingImage)
 {
     CloseLoading();
     LoadingBoxArgs args = new LoadingBoxArgs(owner, text, loadingImage);
     form = new MessageIconForm();
     form.ShowLoading(args);
 }
Ejemplo n.º 25
0
		public new DialogResult ShowDialog(IWin32Window owner)
		{
			// Set validate names to false otherwise windows will not let you select "Folder Selection."
			dialog.ValidateNames = false;
			dialog.CheckFileExists = false;
			dialog.CheckPathExists = true;
			
			try
			{
				// Set initial directory (used when dialog.FileName is set from outside)
				if (dialog.FileName != null && dialog.FileName != "")
				{
					if (Directory.Exists(dialog.FileName))
						dialog.InitialDirectory = dialog.FileName;
					else
						dialog.InitialDirectory = Path.GetDirectoryName(dialog.FileName);
				}
			}
			catch (Exception ex)
			{
				// Do nothing
			}

			// Always default to Folder Selection.
			dialog.FileName = "Folder Selection.";

			if (owner == null)
				return dialog.ShowDialog();
			else
				return dialog.ShowDialog(owner);
		}
Ejemplo n.º 26
0
		public DialogResult ShowDialog(IWin32Window Owner, string Path) {
			lblInfo.Text = string.Format(
				Language.GetString("fileAccessDialog_lblInfo_text")
				, Path);

			return base.ShowDialog(Owner);
		}
Ejemplo n.º 27
0
		public virtual bool EditComponent (ITypeDescriptorContext context, object component, IWin32Window owner)
		{
			ComponentEditorForm f = new ComponentEditorForm (component, GetComponentEditorPages ());
			if (f.ShowForm (owner, GetInitialComponentEditorPageIndex ()) == DialogResult.OK)
				return true;
			return false;
		}
Ejemplo n.º 28
0
        /// <summary>Shows the "SSH error" dialog modally, and returns the path to the key, if one was loaded.</summary>
        public static string AskForKey(IWin32Window parent)
        {
            var form = new FormPuttyError();
            form.ShowDialog(parent);

            return form.KeyPath;
        }
Ejemplo n.º 29
0
 // ***** Dialog display *****
 public void SetDialog(IWin32Window owner, ClassHvcw refHvcw, string ssid, string token)
 {
     clsHvcw = refHvcw;
     textSSID.Text = ssid;
     txtToken = token;
     this.ShowDialog(owner);
 }
Ejemplo n.º 30
0
        public void SaveDeck(IWin32Window window)
        {
            SaveFileDialog save = new SaveFileDialog();

            save = new SaveFileDialog();
            //Set the default name
            using (this.m_Model.Workspace.Lock()) {
                using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).SyncRoot)) {
                    using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).Deck.SyncRoot)) {
                        if ((~this.m_Model.Workspace.CurrentDeckTraversal).Deck.Filename != "")
                            save.FileName = (~this.m_Model.Workspace.CurrentDeckTraversal).Deck.Filename;
                        else save.FileName = (~this.m_Model.Workspace.CurrentDeckTraversal).Deck.HumanName;
                    }
                }
            }
            save.Filter = "CP3 files (*.cp3)|*.cp3|All Files (*.*)|*.*";
            if (save.ShowDialog() == DialogResult.OK) {
                //If filter ("*.cp3") is chosen, then make sure the File Name End with ".cp3"
                if (save.FilterIndex == 1 && !save.FileName.EndsWith(".cp3"))
                    save.FileName = save.FileName + ".cp3";

                //Get the "current" deck
                //Here we define the current deck as the one whose tab is currently selected
                using (this.m_Model.Workspace.Lock()) {
                    using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).SyncRoot)) {
                        using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).Deck.SyncRoot)) {
                            Decks.PPTDeckIO.SaveAsCP3(new FileInfo(save.FileName), (~this.m_Model.Workspace.CurrentDeckTraversal).Deck);
                            this.m_Model.Workspace.CurrentDeckTraversal.Value.Deck.Dirty = false;
                            (~this.m_Model.Workspace.CurrentDeckTraversal).Deck.Filename=Path.GetFileNameWithoutExtension(save.FileName);
                        }
                    }
                }
            }
        }
Ejemplo n.º 31
0
 public static DialogResult ShowConfirm(this IWin32Window owner, string text) => MessageBox.Show(owner, text, Application.ProductName + " - Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
Ejemplo n.º 32
0
 /// <summary>
 /// Shows a metro-styles message notification into the specified owner window.
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="message"></param>
 /// <param name="title"></param>
 /// <param name="buttons"></param>
 /// <param name="icon"></param>
 /// <returns></returns>
 public static DialogResult Show(IWin32Window owner, String message, String title, MessageBoxButtons buttons, MessageBoxIcon icon)
 {
     return(Show(owner, message, title, buttons, icon, MessageBoxDefaultButton.Button1));
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Shows a metro-styles message notification into the specified owner window.
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="message"></param>
 /// <param name="title"></param>
 /// <param name="buttons"></param>
 /// <returns></returns>
 public static DialogResult Show(IWin32Window owner, String message, String title, MessageBoxButtons buttons)
 {
     return(Show(owner, message, title, buttons, MessageBoxIcon.None));
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Shows a metro-styles message notification into the specified owner window.
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="message"></param>
 /// <param name="title"></param>
 /// <returns></returns>
 public static DialogResult Show(IWin32Window owner, String message, String title)
 {
     return(Show(owner, message, title, MessageBoxButtons.OK));
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Shows a metro-styles message notification into the specified owner window.
 /// </summary>
 /// <param name="owner"></param>
 /// <param name="message"></param>
 /// <returns></returns>
 public static DialogResult Show(IWin32Window owner, String message)
 {
     return(Show(owner, message, "Notification"));
 }
Ejemplo n.º 36
0
 public BetterMessageBoxFluentInterface <T> Owner(IWin32Window owner)
 {
     BetterMessageBoxData = BetterMessageBoxData.WithOwner(owner);
     return(this);
 }
Ejemplo n.º 37
0
 public static void ShowError(this IWin32Window owner, string text) => MessageBox.Show(owner, text, Application.ProductName + " - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Ejemplo n.º 38
0
        private bool HandlePushOnExit(ref bool isError, FormProcess form)
        {
            if (!isError)
            {
                return(false);
            }

            //there is no way to pull to not current branch
            if (_selectedBranch != _currentBranchName)
            {
                return(false);
            }

            //auto pull from URL not supported. See https://github.com/gitextensions/gitextensions/issues/1887
            if (!PushToRemote.Checked)
            {
                return(false);
            }

            //auto pull only if current branch was rejected
            Regex isRejected = new Regex(Regex.Escape("! [rejected] ") + ".*" + Regex.Escape(_currentBranchName) + ".*", RegexOptions.Compiled);

            if (isRejected.IsMatch(form.GetOutputString()) && !Module.IsBareRepository())
            {
                bool         forcePush = false;
                IWin32Window owner     = form;
                if (AppSettings.AutoPullOnPushRejectedAction == null)
                {
                    bool   cancel      = false;
                    string destination = PushToRemote.Checked ? _NO_TRANSLATE_Remotes.Text : PushDestination.Text;
                    string buttons     = _pullRepositoryButtons.Text;
                    switch (Module.LastPullAction)
                    {
                    case AppSettings.PullAction.Fetch:
                    case AppSettings.PullAction.FetchAll:
                        buttons = string.Format(buttons, _pullActionFetch.Text);
                        break;

                    case AppSettings.PullAction.Merge:
                        buttons = string.Format(buttons, _pullActionMerge.Text);
                        break;

                    case AppSettings.PullAction.Rebase:
                        buttons = string.Format(buttons, _pullActionRebase.Text);
                        break;

                    default:
                        buttons = string.Format(buttons, _pullActionNone.Text);
                        break;
                    }
                    int idx = PSTaskDialog.cTaskDialog.ShowCommandBox(owner,
                                                                      String.Format(_pullRepositoryCaption.Text, destination),
                                                                      _pullRepositoryMainInstruction.Text,
                                                                      _pullRepository.Text,
                                                                      "",
                                                                      "",
                                                                      _dontShowAgain.Text,
                                                                      buttons,
                                                                      true,
                                                                      0,
                                                                      0);
                    bool rememberDecision = PSTaskDialog.cTaskDialog.VerificationChecked;
                    switch (idx)
                    {
                    case 0:
                        if (rememberDecision)
                        {
                            AppSettings.AutoPullOnPushRejectedAction = AppSettings.PullAction.Default;
                        }
                        break;

                    case 1:
                        AppSettings.FormPullAction = AppSettings.PullAction.Rebase;
                        if (rememberDecision)
                        {
                            AppSettings.AutoPullOnPushRejectedAction = AppSettings.FormPullAction;
                        }
                        break;

                    case 2:
                        AppSettings.FormPullAction = AppSettings.PullAction.Merge;
                        if (rememberDecision)
                        {
                            AppSettings.AutoPullOnPushRejectedAction = AppSettings.FormPullAction;
                        }
                        break;

                    case 3:
                        forcePush = true;
                        break;

                    default:
                        cancel = true;
                        if (rememberDecision)
                        {
                            AppSettings.AutoPullOnPushRejectedAction = AppSettings.PullAction.None;
                        }
                        break;
                    }
                    if (cancel)
                    {
                        return(false);
                    }
                }

                if (forcePush)
                {
                    if (!form.ProcessArguments.Contains(" -f ") && !form.ProcessArguments.Contains(" --force"))
                    {
                        if (GitCommandHelpers.VersionInUse.SupportPushForceWithLease)
                        {
                            form.ProcessArguments = form.ProcessArguments.Replace("push", "push --force-with-lease");
                        }
                        else
                        {
                            form.ProcessArguments = form.ProcessArguments.Replace("push", "push -f");
                        }
                    }
                    form.Retry();
                    return(true);
                }

                if (AppSettings.AutoPullOnPushRejectedAction == AppSettings.PullAction.None)
                {
                    return(false);
                }

                if (AppSettings.AutoPullOnPushRejectedAction == AppSettings.PullAction.Default)
                {
                    if (Module.LastPullAction == AppSettings.PullAction.None)
                    {
                        return(false);
                    }

                    Module.LastPullActionToFormPullAction();
                }

                if (AppSettings.FormPullAction == AppSettings.PullAction.Fetch)
                {
                    form.AppendOutput(Environment.NewLine +
                                      "Can not perform auto pull, when merge option is set to fetch.");
                    return(false);
                }

                if (IsRebasingMergeCommit())
                {
                    form.AppendOutput(Environment.NewLine +
                                      "Can not perform auto pull, when merge option is set to rebase " + Environment.NewLine +
                                      "and one of the commits that are about to be rebased is a merge.");
                    return(false);
                }

                bool pullCompleted;
                UICommands.StartPullDialog(owner, true, _selectedRemoteBranchName, _selectedRemote.Name, out pullCompleted, false);
                if (pullCompleted)
                {
                    form.Retry();
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 39
0
        public bool Load(IWin32Window owner, RasterCodecs codecs, bool autoLoad)
        {
#if LEADTOOLS_V16_OR_LATER && !LEADTOOLS_V17_OR_LATER
            // Load using the RasterizeDocument options
            codecs.Options.RasterizeDocument.Load.Enabled = true;
#endif

            RasterOpenDialog ofd = new RasterOpenDialog(codecs);

            ofd.DereferenceLinks      = true;
            ofd.CheckFileExists       = false;
            ofd.CheckPathExists       = true;
            ofd.EnableSizing          = true;
            ofd.Filter                = Filters;
            ofd.FilterIndex           = _filterIndex;
            ofd.LoadFileImage         = false;
            ofd.LoadOptions           = false;
            ofd.LoadRotated           = true;
            ofd.LoadCompressed        = true;
            ofd.Multiselect           = false;
            ofd.ShowGeneralOptions    = true;
            ofd.ShowLoadCompressed    = true;
            ofd.ShowLoadOptions       = true;
            ofd.ShowLoadRotated       = true;
            ofd.ShowMultipage         = true;
            ofd.ShowPdfOptions        = true;
            ofd.ShowPreview           = true;
            ofd.ShowProgressive       = true;
            ofd.ShowRasterOptions     = true;
            ofd.ShowTotalPages        = true;
            ofd.ShowDeletePage        = true;
            ofd.ShowFileInformation   = true;
            ofd.UseFileStamptoPreview = true;
            ofd.PreviewWindowVisible  = true;
            ofd.Title    = "LEADTOOLS Open Dialog";
            ofd.FileName = FileName;
#if LEADTOOLS_V16_OR_LATER
            ofd.ShowRasterizeDocumentOptions = true;
            ofd.ShowXlsOptions = true;
#endif
            bool ok = false;

            if (ofd.ShowDialog(owner) == DialogResult.OK)
            {
                RasterDialogFileData firstItem = ofd.OpenedFileData[0] as RasterDialogFileData;
                FileName = firstItem.Name;

                ok = true;

                _filterIndex = ofd.FilterIndex;

                CodecsImageInfo info;

                using (WaitCursor wait = new WaitCursor())
                    info = codecs.GetInformation(FileName, true);

                if (info.Format == RasterImageFormat.RasPdf ||
                    info.Format == RasterImageFormat.RasPdfG31Dim ||
                    info.Format == RasterImageFormat.RasPdfG32Dim ||
                    info.Format == RasterImageFormat.RasPdfG4 ||
                    info.Format == RasterImageFormat.RasPdfJpeg ||
                    info.Format == RasterImageFormat.RasPdfJpeg422 ||
                    info.Format == RasterImageFormat.RasPdfJpeg411)
                {
                    if (!codecs.Options.Pdf.IsEngineInstalled)
                    {
#if !LEADTOOLS_V17_OR_LATER
                        PdfEngineDialog dlg = new PdfEngineDialog();
                        if (dlg.ShowDialog(owner) != DialogResult.OK)
                        {
                            return(false);
                        }
#endif
                    }
                }

#if LEADTOOLS_V16_OR_LATER
                // Set the RasterizeDocument load options before calling GetInformation
#if !LEADTOOLS_V17_OR_LATER
                codecs.Options.RasterizeDocument.Load.Enabled = firstItem.Options.RasterizeDocumentOptions.Enabled;
#endif
                codecs.Options.RasterizeDocument.Load.PageWidth    = firstItem.Options.RasterizeDocumentOptions.PageWidth;
                codecs.Options.RasterizeDocument.Load.PageHeight   = firstItem.Options.RasterizeDocumentOptions.PageHeight;
                codecs.Options.RasterizeDocument.Load.LeftMargin   = firstItem.Options.RasterizeDocumentOptions.LeftMargin;
                codecs.Options.RasterizeDocument.Load.TopMargin    = firstItem.Options.RasterizeDocumentOptions.TopMargin;
                codecs.Options.RasterizeDocument.Load.RightMargin  = firstItem.Options.RasterizeDocumentOptions.RightMargin;
                codecs.Options.RasterizeDocument.Load.BottomMargin = firstItem.Options.RasterizeDocumentOptions.BottomMargin;
                codecs.Options.RasterizeDocument.Load.Unit         = firstItem.Options.RasterizeDocumentOptions.Unit;
                codecs.Options.RasterizeDocument.Load.XResolution  = firstItem.Options.RasterizeDocumentOptions.XResolution;
                codecs.Options.RasterizeDocument.Load.YResolution  = firstItem.Options.RasterizeDocumentOptions.YResolution;
                codecs.Options.RasterizeDocument.Load.SizeMode     = firstItem.Options.RasterizeDocumentOptions.SizeMode;
#endif

                // Set the user Options
                codecs.Options.Load.Passes     = firstItem.Passes;
                codecs.Options.Load.Rotated    = firstItem.LoadRotated;
                codecs.Options.Load.Compressed = firstItem.LoadCompressed;
                _FileFormatType = firstItem.Options.FileType;

                switch (firstItem.Options.FileType)
                {
                case RasterDialogFileOptionsType.Meta:
                {
                    // Set the user options
                    codecs.Options.Wmf.Load.XResolution = firstItem.Options.MetaOptions.XResolution;
                    codecs.Options.Wmf.Load.YResolution = firstItem.Options.MetaOptions.XResolution;

                    break;
                }

                case RasterDialogFileOptionsType.Pdf:
                {
                    if (codecs.Options.Pdf.IsEngineInstalled)
                    {
#if !LEADTOOLS_V175_OR_LATER
                        if (!_firstPdfLoaded)
                        {
                            PdfDPIOptions DPIOptions = new PdfDPIOptions();

                            if (DPIOptions.ShowDialog() == DialogResult.OK)
                            {
                                codecs.Options.Pdf.Load.XResolution = DPIOptions.XResolution;
                                codecs.Options.Pdf.Load.YResolution = DPIOptions.YResolution;
                                _firstPdfLoaded = true;
                            }
                            else
                            {
                                codecs.Options.Pdf.Load.XResolution = 150;
                                codecs.Options.Pdf.Load.YResolution = 150;
                            }
                        }
                        else
                        {
                            // Set the user options
                            codecs.Options.Pdf.Load.DisplayDepth  = firstItem.Options.PdfOptions.DisplayDepth;
                            codecs.Options.Pdf.Load.GraphicsAlpha = firstItem.Options.PdfOptions.GraphicsAlpha;
                            codecs.Options.Pdf.Load.TextAlpha     = firstItem.Options.PdfOptions.TextAlpha;
                            codecs.Options.Pdf.Load.UseLibFonts   = firstItem.Options.PdfOptions.UseLibFonts;
                        }
#endif
                    }

                    break;
                }

                case RasterDialogFileOptionsType.Misc:
                {
                    switch (firstItem.FileInfo.Format)
                    {
                    case RasterImageFormat.Jbig:
                    {
                        // Set the user options
                        codecs.Options.Jbig.Load.Resolution = new LeadSize(firstItem.Options.MiscOptions.XResolution,
                                                                           firstItem.Options.MiscOptions.YResolution);
                        break;
                    }

                    case RasterImageFormat.Cmw:
                    {
                        // Set the user options
                        codecs.Options.Jpeg2000.Load.CmwResolution = new LeadSize(firstItem.Options.MiscOptions.XResolution,
                                                                                  firstItem.Options.MiscOptions.YResolution);
                        break;
                    }

                    case RasterImageFormat.Jp2:
                    {
                        // Set the user options
                        codecs.Options.Jpeg2000.Load.Jp2Resolution = new LeadSize(firstItem.Options.MiscOptions.XResolution,
                                                                                  firstItem.Options.MiscOptions.YResolution);
                        break;
                    }

                    case RasterImageFormat.J2k:
                    {
                        // Set the user options
                        codecs.Options.Jpeg2000.Load.J2kResolution = new LeadSize(firstItem.Options.MiscOptions.XResolution,
                                                                                  firstItem.Options.MiscOptions.YResolution);
                        break;
                    }
                    }

                    break;
                }
                }

                int firstPage = 1;
                int lastPage  = 1;

                if (ShowLoadPagesDialog)
                {
                    firstPage = 1;
                    lastPage  = info.TotalPages;

                    if (firstPage != lastPage)
                    {
                        ImageFileLoaderPagesDialog dlg = new ImageFileLoaderPagesDialog(info.TotalPages, LoadOnlyOnePage);
                        if (dlg.ShowDialog(owner) == DialogResult.OK)
                        {
                            firstPage = dlg.FirstPage;
                            lastPage  = dlg.LastPage;
                        }
                        else
                        {
                            ok = false;
                        }
                    }
                }
                else
                {
                    firstPage = firstItem.PageNumber;
                    lastPage  = firstItem.PageNumber;
                }

                _firstPage = firstPage;
                _lastPage  = lastPage;

                if (autoLoad && ok)
                {
                    using (WaitCursor wait = new WaitCursor())
                    {
                        _image = codecs.Load(FileName, 0, CodecsLoadByteOrder.BgrOrGray, firstPage, lastPage);
                    }
                }
            }

            return(ok);
        }
Ejemplo n.º 40
0
 public static void ShowMessage(this IWin32Window owner, string text) => MessageBox.Show(owner, text, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
Ejemplo n.º 41
0
        private bool HandlePushOnExit(ref bool isError, FormProcess form)
        {
            if (!isError)
            {
                return(false);
            }

            // there is no way to pull to not current branch
            if (_selectedBranch != _currentBranchName)
            {
                return(false);
            }

            // auto pull from URL not supported. See https://github.com/gitextensions/gitextensions/issues/1887
            if (!PushToRemote.Checked)
            {
                return(false);
            }

            // auto pull only if current branch was rejected
            var isRejected = new Regex(Regex.Escape("! [rejected] ") + ".*" + Regex.Escape(_currentBranchName) + ".*", RegexOptions.Compiled);

            if (isRejected.IsMatch(form.GetOutputString()) && !Module.IsBareRepository())
            {
                IWin32Window owner = form.Owner;
                (var onRejectedPullAction, var forcePush) = AskForAutoPullOnPushRejectedAction(owner);

                if (forcePush)
                {
                    if (!form.ProcessArguments.Contains(" -f ") && !form.ProcessArguments.Contains(" --force"))
                    {
                        Trace.Assert(form.ProcessArguments.StartsWith("push "), "Arguments should start with 'push' command");

                        string forceArg = GitVersion.Current.SupportPushForceWithLease ? " --force-with-lease" : " -f";
                        form.ProcessArguments = form.ProcessArguments.Insert("push".Length, forceArg);
                    }

                    form.Retry();
                    return(true);
                }

                if (onRejectedPullAction == AppSettings.PullAction.Default)
                {
                    onRejectedPullAction = AppSettings.DefaultPullAction;
                }

                if (onRejectedPullAction == AppSettings.PullAction.None)
                {
                    return(false);
                }

                if (onRejectedPullAction != AppSettings.PullAction.Merge && onRejectedPullAction != AppSettings.PullAction.Rebase)
                {
                    form.AppendOutput(Environment.NewLine +
                                      "Automatical pull can only be performed, when the default pull action is either set to Merge or Rebase." +
                                      Environment.NewLine + Environment.NewLine);
                    return(false);
                }

                if (IsRebasingMergeCommit())
                {
                    form.AppendOutput(Environment.NewLine +
                                      "Can not perform automatical pull, when the pull action is set to Rebase " + Environment.NewLine +
                                      "and one of the commits that are about to be rebased is a merge commit." +
                                      Environment.NewLine + Environment.NewLine);
                    return(false);
                }

                UICommands.StartPullDialogAndPullImmediately(
                    out var pullCompleted,
                    owner,
                    _selectedRemoteBranchName,
                    _selectedRemote.Name,
                    onRejectedPullAction);

                if (pullCompleted)
                {
                    form.Retry();
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 42
0
        private bool PushChanges(IWin32Window owner)
        {
            ErrorOccurred = false;
            if (PushToUrl.Checked && string.IsNullOrEmpty(PushDestination.Text))
            {
                MessageBox.Show(owner, _selectDestinationDirectory.Text);
                return(false);
            }

            var selectedRemoteName = _selectedRemote.Name;

            if (PushToRemote.Checked && string.IsNullOrEmpty(selectedRemoteName))
            {
                MessageBox.Show(owner, _selectRemote.Text);
                return(false);
            }
            if (TabControlTagBranch.SelectedTab == TagTab && string.IsNullOrEmpty(TagComboBox.Text))
            {
                MessageBox.Show(owner, _selectTag.Text);
                return(false);
            }

            //Extra check if the branch is already known to the remote, give a warning when not.
            //This is not possible when the remote is an URL, but this is ok since most users push to
            //known remotes anyway.
            if (TabControlTagBranch.SelectedTab == BranchTab && PushToRemote.Checked &&
                !Module.IsBareRepository())
            {
                //If the current branch is not the default push, and not known by the remote
                //(as far as we know since we are disconnected....)
                if (_NO_TRANSLATE_Branch.Text != AllRefs &&
                    RemoteBranch.Text != _gitRemoteController.GetDefaultPushRemote(_selectedRemote, _NO_TRANSLATE_Branch.Text) &&
                    !IsBranchKnownToRemote(selectedRemoteName, RemoteBranch.Text))
                {
                    //Ask if this is really what the user wants
                    if (!AppSettings.DontConfirmPushNewBranch &&
                        DialogResult.No == MessageBox.Show(owner, _branchNewForRemote.Text, _pushCaption.Text, MessageBoxButtons.YesNo))
                    {
                        return(false);
                    }
                }
            }

            if (PushToUrl.Checked)
            {
                Repositories.AddMostRecentRepository(PushDestination.Text);
            }
            AppSettings.RecursiveSubmodules = RecursiveSubmodules.SelectedIndex;

            var    remote = "";
            string destination;

            if (PushToUrl.Checked)
            {
                destination = PushDestination.Text;
            }
            else
            {
                EnsurePageant(selectedRemoteName);

                destination = selectedRemoteName;
                remote      = selectedRemoteName.Trim();
            }

            string pushCmd;

            if (TabControlTagBranch.SelectedTab == BranchTab)
            {
                bool track = ReplaceTrackingReference.Checked;
                if (!track && !string.IsNullOrWhiteSpace(RemoteBranch.Text))
                {
                    GitRef selectedLocalBranch = _NO_TRANSLATE_Branch.SelectedItem as GitRef;
                    track = selectedLocalBranch != null && string.IsNullOrEmpty(selectedLocalBranch.TrackingRemote) &&
                            !_gitRemoteController.Remotes.Any(x => _NO_TRANSLATE_Branch.Text.StartsWith(x.Name, StringComparison.OrdinalIgnoreCase));
                    var autoSetupMerge = Module.EffectiveConfigFile.GetValue("branch.autoSetupMerge");
                    if (autoSetupMerge.IsNotNullOrWhitespace() && autoSetupMerge.ToLowerInvariant() == "false")
                    {
                        track = false;
                    }
                    if (track && !AppSettings.DontConfirmAddTrackingRef)
                    {
                        var result = MessageBox.Show(this,
                                                     string.Format(_updateTrackingReference.Text, selectedLocalBranch.Name, RemoteBranch.Text),
                                                     _pushCaption.Text,
                                                     MessageBoxButtons.YesNoCancel);
                        if (result == DialogResult.Cancel)
                        {
                            return(false);
                        }
                        track = result == DialogResult.Yes;
                    }
                }

                if (ForcePushBranches.Checked)
                {
                    if (GitCommandHelpers.VersionInUse.SupportPushForceWithLease)
                    {
                        var choice = MessageBox.Show(this,
                                                     _useForceWithLeaseInstead.Text,
                                                     "", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
                                                     MessageBoxDefaultButton.Button1);
                        switch (choice)
                        {
                        case DialogResult.Yes:
                            ForcePushBranches.Checked = false;
                            ckForceWithLease.Checked  = true;
                            break;

                        case DialogResult.Cancel:
                            return(false);
                        }
                    }
                }

                if (_NO_TRANSLATE_Branch.Text == AllRefs)
                {
                    pushCmd = Module.PushAllCmd(destination, GetForcePushOption(), track, RecursiveSubmodules.SelectedIndex);
                }
                else
                {
                    pushCmd = Module.PushCmd(destination, _NO_TRANSLATE_Branch.Text, RemoteBranch.Text,
                                             GetForcePushOption(), track, RecursiveSubmodules.SelectedIndex);
                }
            }
            else if (TabControlTagBranch.SelectedTab == TagTab)
            {
                string tag         = TagComboBox.Text;
                bool   pushAllTags = false;
                if (tag == AllRefs)
                {
                    tag         = "";
                    pushAllTags = true;
                }
                pushCmd = GitCommandHelpers.PushTagCmd(destination, tag, pushAllTags, GetForcePushOption());
            }
            else
            {
                // Push Multiple Branches Tab selected
                var pushActions = new List <GitPushAction>();
                foreach (DataRow row in _branchTable.Rows)
                {
                    var push   = Convert.ToBoolean(row["Push"]);
                    var force  = Convert.ToBoolean(row["Force"]);
                    var delete = Convert.ToBoolean(row["Delete"]);

                    if (push || force)
                    {
                        pushActions.Add(new GitPushAction(row["Local"].ToString(), row["Remote"].ToString(), force));
                    }
                    else if (delete)
                    {
                        pushActions.Add(GitPushAction.DeleteRemoteBranch(row["Remote"].ToString()));
                    }
                }
                pushCmd = GitCommandHelpers.PushMultipleCmd(destination, pushActions);
            }

            ScriptManager.RunEventScripts(this, ScriptEvent.BeforePush);

            //controls can be accessed only from UI thread
            _selectedBranch = _NO_TRANSLATE_Branch.Text;
            _candidateForRebasingMergeCommit = PushToRemote.Checked && (_selectedBranch != AllRefs) && TabControlTagBranch.SelectedTab == BranchTab;
            _selectedRemoteBranchName        = RemoteBranch.Text;

            using (var form = new FormRemoteProcess(Module, pushCmd)
            {
                Remote = remote,
                Text = string.Format(_pushToCaption.Text, destination),
                HandleOnExitCallback = HandlePushOnExit
            })
            {
                form.ShowDialog(owner);
                ErrorOccurred = form.ErrorOccurred();

                if (!Module.InTheMiddleOfAction() && !form.ErrorOccurred())
                {
                    ScriptManager.RunEventScripts(this, ScriptEvent.AfterPush);
                    if (_createPullRequestCB.Checked)
                    {
                        UICommands.StartCreatePullRequest(owner);
                    }
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 43
0
 public ProjectActions(IWin32Window owner)
 {
     this.owner = owner;
 }
Ejemplo n.º 44
0
        private (AppSettings.PullAction pullAction, bool forcePush) AskForAutoPullOnPushRejectedAction(IWin32Window owner)
        {
            bool forcePush = false;

            AppSettings.PullAction?onRejectedPullAction = AppSettings.AutoPullOnPushRejectedAction;
            if (onRejectedPullAction == null)
            {
                string destination = _NO_TRANSLATE_Remotes.Text;
                string buttons     = _pullRepositoryButtons.Text;
                switch (AppSettings.DefaultPullAction)
                {
                case AppSettings.PullAction.Fetch:
                case AppSettings.PullAction.FetchAll:
                case AppSettings.PullAction.FetchPruneAll:
                    buttons = string.Format(buttons, _pullActionFetch.Text);
                    break;

                case AppSettings.PullAction.Merge:
                    buttons = string.Format(buttons, _pullActionMerge.Text);
                    break;

                case AppSettings.PullAction.Rebase:
                    buttons = string.Format(buttons, _pullActionRebase.Text);
                    break;

                default:
                    buttons = string.Format(buttons, _pullActionNone.Text);
                    break;
                }

                int idx = PSTaskDialog.cTaskDialog.ShowCommandBox(owner,
                                                                  string.Format(_pullRepositoryCaption.Text, destination),
                                                                  _pullRepositoryMainInstruction.Text,
                                                                  _pullRepository.Text,
                                                                  "",
                                                                  "",
                                                                  _dontShowAgain.Text,
                                                                  buttons,
                                                                  true,
                                                                  0,
                                                                  0);
                bool rememberDecision = PSTaskDialog.cTaskDialog.VerificationChecked;
                switch (idx)
                {
                case 0:
                    onRejectedPullAction = AppSettings.PullAction.Default;
                    break;

                case 1:
                    onRejectedPullAction = AppSettings.PullAction.Rebase;
                    break;

                case 2:
                    onRejectedPullAction = AppSettings.PullAction.Merge;
                    break;

                case 3:
                    forcePush = true;
                    break;

                default:
                    onRejectedPullAction = AppSettings.PullAction.None;
                    break;
                }

                if (rememberDecision)
                {
                    AppSettings.AutoPullOnPushRejectedAction = onRejectedPullAction;
                }
            }

            return(onRejectedPullAction ?? AppSettings.PullAction.None, forcePush);
        }
Ejemplo n.º 45
0
        /// <summary>
        /// Displays property dialog for specified projection.
        /// </summary>
        public static void ShowProjectionProperties(this IAppContext context, ISpatialReference projection, IWin32Window parent = null)
        {
            var cs = context.Projections.GetCoordinateSystem(projection, ProjectionSearchType.UseDialects);

            var model = cs != null ? new ProjectionInfoModel(cs) : new ProjectionInfoModel(projection);

            context.Container.Run <ProjectionInfoPresenter, ProjectionInfoModel>(model, parent);
        }
Ejemplo n.º 46
0
 public static bool HandleMergeConflicts(IWin32Window owner)
 {
     return(HandleMergeConflicts(owner, true));
 }
Ejemplo n.º 47
0
 public new DialogResult ShowDialog(IWin32Window owner)
 {
     CurrentDirectory = InitialDirectory ?? new MsDataFilePath(Environment.CurrentDirectory);
     return(base.ShowDialog(owner));
 }
Ejemplo n.º 48
0
        /// <summary>
        /// Displays property dialog for specified coordinate system.
        /// </summary>
        public static void ShowProjectionProperties(this IAppContext context, ICoordinateSystem cs, IWin32Window parent = null)
        {
            var model = new ProjectionInfoModel(cs);

            context.Container.Run <ProjectionInfoPresenter, ProjectionInfoModel>(model, parent);
        }
 public SqlExecutionPlanViewer(IWin32Window owner) : this()
 {
     _Owner = owner;
 }
 public DialogResult EnsureDuplicateProteinFilter(IWin32Window parent)
 {
     return(EnsureDuplicateProteinFilter(parent, false));
 }
Ejemplo n.º 51
0
 public static Point GetTreeViewScrollPos(IWin32Window treeView)
 {
     return(new Point(
                GetScrollPos((int)treeView.Handle, SB_HORZ),
                GetScrollPos((int)treeView.Handle, SB_VERT)));
 }
Ejemplo n.º 52
0
        //private static UserDataFromConsole userData;

        /*public static IUserData GetUserData(ref ExchangeService service)
         * {
         *  if (userData == null)
         *  {
         *      GetUserDataFromConsoleCredUi(ref service);
         *  }
         *
         *  return userData;
         * }*/

        internal static bool GetUserDataFromConsoleCredUi(IWin32Window owner, IUserData data, ref ExchangeService service)
        {
            return(CredentialHelper.AppLogin(owner, data, ref service));
        }
Ejemplo n.º 53
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 /// <param name="parent">The parent.</param>
 /// <returns></returns>
 /// ------------------------------------------------------------------------------------
 DialogResult IFontDialog.ShowDialog(IWin32Window parent)
 {
     return(ShowDialog(parent));
 }
Ejemplo n.º 54
0
 public static void SetTreeViewScrollPos(IWin32Window treeView, Point scrollPosition)
 {
     SetScrollPos(treeView.Handle, SB_HORZ, scrollPosition.X, true);
     SetScrollPos(treeView.Handle, SB_VERT, scrollPosition.Y, true);
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Hide any currently visible tooltip
 /// </summary>
 /// <param name="window"></param>
 public void PopToolTip(IWin32Window window)
 {
     NativeMethods.SendMessage(this.Handle, TTM_POP, 0, 0);
 }
Ejemplo n.º 56
0
 // this this member
 public new void Show(IWin32Window win)
 {
     Show();
 }
 public void PopToolTip(IWin32Window window)
 {
     BrightIdeasSoftware.NativeMethods.SendMessage(base.Handle, 0x41c, 0, 0);
 }
Ejemplo n.º 58
0
        //public void Munge() {
        //    NativeMethods.TOOLINFO tool = new NativeMethods.TOOLINFO();
        //    IntPtr result = NativeMethods.SendMessageTOOLINFO(this.Handle, TTM_GETCURRENTTOOL, 0, tool);
        //    System.Diagnostics.Trace.WriteLine("-");
        //    System.Diagnostics.Trace.WriteLine(result);
        //    result = NativeMethods.SendMessageTOOLINFO(this.Handle, TTM_GETBUBBLESIZE, 0, tool);
        //    System.Diagnostics.Trace.WriteLine(String.Format("{0} {1}", result.ToInt32() >> 16, result.ToInt32() & 0xFFFF));
        //    NativeMethods.ChangeSize(this, result.ToInt32() & 0xFFFF, result.ToInt32() >> 16);
        //    //NativeMethods.RECT r = new NativeMethods.RECT();
        //    //r.right
        //    //IntPtr x = NativeMethods.SendMessageRECT(this.Handle, TTM_ADJUSTRECT, true, ref r);

        //    //System.Diagnostics.Trace.WriteLine(String.Format("{0} {1} {2} {3}", r.left, r.top, r.right, r.bottom));
        //}

        /// <summary>
        /// Remove the given window from those managed by this tooltip
        /// </summary>
        /// <param name="window"></param>
        public void RemoveToolTip(IWin32Window window)
        {
            NativeMethods.TOOLINFO lParam = this.MakeToolInfoStruct(window);
            NativeMethods.SendMessageTOOLINFO(this.Handle, TTM_DELTOOL, 0, lParam);
        }
 private BrightIdeasSoftware.NativeMethods.TOOLINFO MakeToolInfoStruct(IWin32Window window)
 {
     return(new BrightIdeasSoftware.NativeMethods.TOOLINFO {
         hwnd = window.Handle, uFlags = 0x11, uId = window.Handle, lpszText = (IntPtr)(-1)
     });
 }
 public void AddTool(IWin32Window window)
 {
     BrightIdeasSoftware.NativeMethods.TOOLINFO lParam = this.MakeToolInfoStruct(window);
     BrightIdeasSoftware.NativeMethods.SendMessageTOOLINFO(base.Handle, 0x432, 0, lParam);
 }