Exemplo n.º 1
0
        private void Login(System.Windows.Window loginView)
        {
            //  ログイン画面が閉じられた時にアプリケーションが終了しないよう、OnExplicitShutdownを設定しておく
            Current.ShutdownMode = ShutdownMode.OnExplicitShutdown;

            var isLoggedin = loginView.ShowDialog() ?? false;
            var isAuthenticated = Thread.CurrentPrincipal.Identity.IsAuthenticated;

            if (isLoggedin && isAuthenticated)
            {
                //  MainWindowが閉じられた時にアプリケーションが終了するように変更
                Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

                var vm = new LoggedinViewModel();
                vm.UserName = Thread.CurrentPrincipal.Identity.Name;

                var loggedinView = new LoggedinView();
                loggedinView.DataContext = vm;

                Current.MainWindow = loggedinView;
                loggedinView.ShowDialog();
            }
            else
            {
                //  OnExplicitShutdownの場合、明示的なShutdown()呼び出しが必要
                Current.Shutdown(-1);
            }
        }
Exemplo n.º 2
0
 public static bool CreateDialogForm(System.Windows.Forms.Form childForm)
 {
     try
     {
         if (childForm.Tag != null)
         {
             if (Services.Security.checkForm(childForm.Tag.ToString().ToUpper(), Variables.UserInfo))
             {
                 childForm.ShowInTaskbar = false;
                 childForm.ShowDialog();
                 return true;
             }
             else
             {
                 MessageBox.Show("Уучлаарай! Та хандах эрхгүй байна.", "Анхааруулга", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return false;
             }
         }
         else
         {
             MessageBox.Show("Уучлаарай! Энд хандах боломжгүй байна.", "Анхааруулга", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return false;
         }
     }
     catch (Exception Err)
     {
         MessageBox.Show("Дараахи алдаа гарлаа : " + Err.Message.ToString(), "Алдаа", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return false;
     }
 }
 public static System.Windows.Forms.DialogResult DimAndShowDialog(this System.Windows.Forms.Form parentForm, System.Windows.Forms.Form dlg)
 {
     System.Windows.Forms.DialogResult result = System.Windows.Forms.DialogResult.None;
     var dimForm = new System.Windows.Forms.Form()
     {
         Text = "",
         ControlBox = false,
         FormBorderStyle = System.Windows.Forms.FormBorderStyle.None,
         Size = parentForm.Size,
         Location = parentForm.Location,
         BackColor = System.Drawing.Color.Black,
         ShowInTaskbar = false,
         Opacity = .5
     };
     dlg.FormClosing += (oSender, oE) =>
     {
         dimForm.Close();
         dimForm = null;
     };
     dimForm.Shown += (oSender, oE) =>
     {
         dimForm.Location = parentForm.Location;
         result = dlg.ShowDialog();
         parentForm.Focus();
     };
     dimForm.ShowDialog();
     return result;
 }
Exemplo n.º 4
0
        public static List<List<double>> ReadData(System.Windows.Forms.OpenFileDialog openFileDialog1)
        {
            //получи результат в объект data
            List<List<double>> data = new List<List<double>>();
            data.Add(new List<double>());
            data.Add(new List<double>());
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                StreamReader ds = new StreamReader(openFileDialog1.FileName);
                string TextFile = ds.ReadToEnd();
                string[] split = TextFile.Split(new Char[] { '\n' });
                for (int i = 0; i < split.Length; i++)
                {
                    if (split[i].Length == 0)
                        break;
                    string[] tmpMass = split[i].Split(new Char[] {','});

                    data[0].Add(Convert.ToDouble(tmpMass[0]));
                    data[1].Add(Convert.ToDouble(tmpMass[1]));
                }
                if (data[0].Count != data[1].Count)
                {
                    data[0].RemoveAt(data[0].Count - 1);
                }
                ds.Close();
               
            return data;
        }
    }
Exemplo n.º 5
0
        public DataRow retornaFila()
        {
            Formas.fCatalogo f = new SOPORTEC.Formas.fCatalogo(dt,"Nombre del Catalogo",2, );
                f.ShowDialog();
                rw = f.fila;
                f.Close();
                f.Dispose();

            return rw;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Function to save the game.
        /// </summary>
        /// <param name="sfd">Object class SaveFileDialog.</param>
        /// <param name="d">Object class Debra.</param>
        /// <param name="g">Object of the Game class.</param>
        /// <param name="ai">Object class Squad (detachment of the computer).</param>
        /// <param name="pl">Object class Squad (squad players).</param>
        public void SaveGame(System.Windows.Forms.SaveFileDialog sfd, Debra d, Game g, Squad ai, Squad pl)
        {
            if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            using (Stream save = File.Open(sfd.FileName, FileMode.Create))
            using (var sw = new StreamWriter(save))
            {
                // TODO: Нормально реализовать данный функционал, а не как было.
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Function to loading games.
        /// </summary>
        /// <param name="ofd">Object class OpenFileDialog.</param>
        /// <param name="d">Object class Debra.</param>
        /// <param name="g">Object of the Game class.</param>
        /// <param name="ai">Object class Squad (detachment of the computer).</param>
        /// <param name="pl">Object class Squad (squad players).</param>
        public void LoadGame(System.Windows.Forms.OpenFileDialog ofd, Debra d, Game g, Squad ai, Squad pl)
        {
            if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            using (Stream save = File.Open(ofd.FileName, FileMode.Open))
            using (var sr = new StreamReader(save))
            {
                // TODO: Нормально реализовать данный функционал, а не как было.
            }
        }
Exemplo n.º 8
0
 public static string[] BrowseFile(System.Windows.Forms.FileDialog openFileDialog)
 {
     string[] fileNames = new string[1];
     DialogResult dlgRes = openFileDialog.ShowDialog();
     if (dlgRes == DialogResult.OK)
     {
         // store the selected filename on the currentFile
         fileNames = openFileDialog.FileNames;
     }
     else
     {
         fileNames = null;
     }
     return fileNames;
 }
Exemplo n.º 9
0
		internal bool? InternalShowModalWindow(System.Windows.Window w)
		{
			if (null == w)
				throw new ArgumentNullException("w");

			w.Owner = TopmostModalWindow;
			_modalWindows.Push(w);
			try
			{
				return w.ShowDialog();
			}
			finally
			{
				_modalWindows.Pop();
			}
		}
Exemplo n.º 10
0
 public bool? ShowDialogWithModel(System.Windows.Window view, DialogType dialogType, DialogViewModel viewModel)
 {
     if (view == null)
     {
         throw new ArgumentNullException("view");
     }
     view.Owner = this.Window;
     view.WindowStartupLocation = WindowStartupLocation.CenterOwner;
     view.ShowInTaskbar = false;
     if (viewModel != null)
     {
         viewModel.Init();
         view.DataContext = viewModel;
     }
     if (dialogType == DialogType.Modal)
     {
         return view.ShowDialog();
     }
     view.Show();
     return null;
 }
Exemplo n.º 11
0
		private static void ShowPrintDialog(System.Windows.Forms.PrintDialog dlg)
		{
			if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
			{
				try
				{
					dlg.Document.Print();
				}
				catch (Win32Exception)
				{
					//Printing was canceled
				}
			}
		}
Exemplo n.º 12
0
 DialogResult IWindowsFormsEditorService.ShowDialog(System.Windows.Forms.Form dialog)
 {
     IUIService service = (IUIService)((IServiceProvider)this).GetService(
         typeof(IUIService));
     if (service != null)
     {
         return service.ShowDialog(dialog);
     }
     return dialog.ShowDialog(this._designer.Component as IWin32Window);
 }
Exemplo n.º 13
0
 public static System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.Form newForm, System.Windows.Forms.Form currentForm)
 {
     string title = currentForm.Text;
     currentForm.Text = "";
     System.Windows.Forms.DialogResult result = newForm.ShowDialog();
     currentForm.Text = title;
     currentForm.Show();
     currentForm.BringToFront();
     return result;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Show a windows form that is modal in the sense that this function does not return until
 /// the form is closed, but also allows for interaction with other elements of the Rhino
 /// user interface.
 /// </summary>
 /// <param name="form">
 /// The form must have buttons that are assigned to the "AcceptButton" and "CancelButton".
 /// </param>
 /// <returns>One of the System.Windows.Forms.DialogResult values.</returns>
 public static System.Windows.Forms.DialogResult ShowSemiModal(System.Windows.Forms.Form form)
 {
   SemiModalFormMessenger semihelper = new SemiModalFormMessenger(form);
   return form.ShowDialog(RhinoApp.MainWindow());
 }
Exemplo n.º 15
0
 private void btGetMove4_Click(object sender, EventArgs e)
 {
     if (ComboPok閙on.Text != "")
     {
         FormPopupMouvementSelection fp = new FormPopupMouvementSelection(txtCapacit� ComboPok閙on.SelectedIndex);
         fp.ShowDialog();
     }
     else
         MessageBox.Show("Choisi un pok閙on d'abord!");
 }
Exemplo n.º 16
0
 public static bool DialogResultIsOK(System.Windows.Forms.SaveFileDialog ofd, string filter)
 {
     #if WPF4
     throw new NotImplementedException("hehaw (not implemented).");
     #else
     if (filter!=null) ofd.Filter = filter;
     return ofd.ShowDialog()== System.Windows.Forms.DialogResult.OK;
     #endif
 }
Exemplo n.º 17
0
 public System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.Form form)
 {
     //form.Owner = controller.MainFrm;
     return form.ShowDialog(controller.MainFrm);
 }
Exemplo n.º 18
0
 public System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.Form form)
 {
     return form.ShowDialog(mainForm);
 }
Exemplo n.º 19
0
        public System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.Form dialog)
        {
            DialogResult result;

            IntPtr focushWnd = WinApi.GetFocus();
            IUIService uiService = (IUIService)this.GetService(typeof(IUIService));
            if (uiService != null)
            {
                result = uiService.ShowDialog(dialog);
            }
            else
            {
                result = dialog.ShowDialog();
            }
            if (focushWnd != IntPtr.Zero)
            {
                WinApi.SetFocus(focushWnd);
            }
            return result;
        }
 /// <summary>
 /// Show the specified <see cref="T:System.Windows.Forms.Form"></see>.
 /// </summary>
 /// <param name="dialog">The <see cref="T:System.Windows.Forms.Form"></see> to display.</param>
 /// <returns>
 /// A <see cref="T:System.Windows.Forms.DialogResult"></see> indicating the result code returned by the <see cref="T:System.Windows.Forms.Form"></see>.
 /// </returns>
 public virtual System.Windows.Forms.DialogResult ShowDialog(System.Windows.Forms.Form dialog)
 {
     return dialog.ShowDialog(this);
 }
Exemplo n.º 21
0
 /*******************************/
 /// <summary>
 /// Shows a dialog object.
 /// </summary>
 /// <param name="dialog">Dialog to be shown.</param>
 /// <param name="visible">Indicates if the dialog should be shown.</param>
 public static void ShowDialog(System.Windows.Forms.FileDialog dialog, bool visible)
 {
     if (visible)
         dialog.ShowDialog();
 }
Exemplo n.º 22
0
 System.Windows.Forms.DialogResult IUIService.ShowDialog(System.Windows.Forms.Form form)
 {
     return form.ShowDialog();
 }
Exemplo n.º 23
0
 /// <summary>
 /// Show a windows form that is modal in the sense that this function does not return until
 /// the form is closed, but also allows for interaction with other elements of the Rhino
 /// user interface.
 /// </summary>
 /// <param name="form">
 /// The form must have buttons that are assigned to the "AcceptButton" and "CancelButton".
 /// </param>
 /// <returns>One of the System.Windows.Forms.DialogResult values.</returns>
 public static System.Windows.Forms.DialogResult ShowSemiModal(System.Windows.Forms.Form form)
 {
   if (Runtime.HostUtils.RunningOnWindows)
     form.Load += SemiModalFormLoad;
   return form.ShowDialog(RhinoApp.MainWindow());
 }
Exemplo n.º 24
0
 public void PrintPreview(System.Windows.Forms.PrintPreviewDialog dlg)
 {
     this.InitPrintDocument();
     dlg.Document = this._printDoc;
     dlg.ShowDialog(this.FindForm());
 }
Exemplo n.º 25
0
        /// <summary>
        /// ����Ϣ���ڡ�fr��վ�յ�ϵͳ��
        /// </summary>
        /// <param name="IsModify"></param>
        private void Newfr��վ�յ�ϵͳ(bool IsModify)
        {
            if (selectionFeature == null ||
             selectionFeature.Count < 1)
            {
                MessageBox.Show("��ѡ��һ����վ", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            MapInfo.Data.Table maptable = Session.Current.Catalog.GetTable(strTempMapPointTable);
            Feature f = selectionFeature[0];

            string strPointCode = f["ID"].ToString().Trim();
            string strPointName = f["Caption"].ToString().Trim();
            using (fr��վ�յ�ϵͳ flc = new fr��վ�յ�ϵͳ(strPointCode, strPointName, IsModify))
            {
                try
                {
                    flc.ShowDialog();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                finally
                {
                    this.Show();
                }
            }
        }
 protected virtual DialogResult ShowRecurrenceForm(System.Windows.Forms.Form form)
 {
     return form.ShowDialog(this);
 }
Exemplo n.º 27
0
 System.Windows.Forms.DialogResult IWindowsFormsEditorService.ShowDialog(System.Windows.Forms.Form dialog)
 {
     return dialog.ShowDialog();
 }
Exemplo n.º 28
0
        public static DialogResult ShowDialogForm(System.Windows.Forms.Form form,
            Size formSize, Size maxSize, Size minSize, string formName, 
            System.Windows.Forms.Form parentForm,
            bool minimizeBox, bool maximizeBox, bool controlBox)
        {
            //ContainerForm contextForm = new ContainerForm();

            form.Dock = DockStyle.Fill;
            form.MaximumSize = maxSize;
            form.MinimumSize = minSize;

            //oyxdelete20090217contextForm.Text = "外贸快登手" + EFTMIS.Logic.AssmblyInfo.GetVersonName() + "--" + formName;
            //contextForm.Text = AssmblyInfo.GetVersonName() + "--" + formName;//oyxAdd20090219
            //contextForm.Controls.Add(control);
            //contextForm.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.MaximizeBox = maximizeBox;
            form.MinimizeBox = minimizeBox;
            form.ControlBox = controlBox;
            //if (AssmblyInfo.GetAssmblySoft() == AssmblyInfo.DH) //zhangzhiming add20090224
            //{
            //    contextForm.Icon = Properties.Resources.DH;
            //}
            //else
            //{
            //    contextForm.Icon = Properties.Resources.ESoft;
            //}
            form.StartPosition = FormStartPosition.CenterParent;
            if (formSize != Size.Empty)
            {

                form.Size = formSize;
            }

            //释放资源事件
            //contextForm.Disposed += new EventHandler(Form_Disposed);
            DialogResult result = form.ShowDialog(parentForm);
            //DialogResult result = new DialogResult();
            form.Dispose();
            //contextForm.Disposed -= new EventHandler(Form_Disposed);

            return result;
        }
        void ProcessDialog(object sender, RoutedEventArgs e, System.Windows.Forms.OpenFileDialog ofd, string specificFolder = "")
        {
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //(EditorUtils.FindVisualChildren<ScrollViewer>(parent).ElementAt(0) as ScrollViewer).Visibility = Visibility.Collapsed;
                DependencyObject parent = EditorUtils.GetParent(sender as TextBlock, 3);

                string destFolder = (Gibbo.Library.SceneManager.GameProject.ProjectPath + "\\Content\\" + specificFolder).Trim();
                string filename = System.IO.Path.GetFileName(ofd.FileName);

                bool fileOnDirectory = ofd.FileName.StartsWith(Gibbo.Library.SceneManager.GameProject.ProjectPath);

                if (!System.IO.Directory.Exists(destFolder) && !fileOnDirectory)
                    System.IO.Directory.CreateDirectory(destFolder);

                if (!System.IO.File.Exists(destFolder + filename) || fileOnDirectory)
                    this.SetNewPath(ofd.FileName, destFolder, specificFolder, filename, parent);
                else
                {
                    MessageBoxResult overwriteResult = MessageBox.Show("A file with the name " + filename + " already exists. Would you like to overwrite it?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
                    if (overwriteResult == MessageBoxResult.Yes)
                        this.SetNewPath(ofd.FileName, destFolder, specificFolder, filename, parent, true);
                }
            }
        }
Exemplo n.º 30
0
        private void settingsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var zQuery = new QueryPanelDialog(
                "CardMaker Settings",
                450, 
                250,
#if !MONO_BUILD
                true
#else
                false
#endif
                );
            zQuery.SetIcon(CardMakerInstance.ApplicationIcon);
            zQuery.SetMaxHeight(600);
#if !MONO_BUILD
            zQuery.AddTab("General");
#endif
            zQuery.AddCheckBox("Enable Google Cache", CardMakerSettings.EnableGoogleCache, IniSettings.EnableGoogleCache);
            zQuery.AddCheckBox("Print/Export Layout Border", CardMakerSettings.PrintLayoutBorder, IniSettings.PrintLayoutBorder);
            zQuery.AddPullDownBox("Default Translator Type",
                new string[] { TranslatorType.Incept.ToString(), TranslatorType.JavaScript.ToString() }, (int)CardMakerSettings.DefaultTranslatorType, IniSettings.DefaultTranslator);

#if !MONO_BUILD
            zQuery.AddTab("PDF Export");
#else
            zQuery.AddVerticalSpace(20);
            zQuery.AddLabel("---- PDF Export Settings ----", 16);
#endif
            zQuery.AddNumericBox("Page Width (inches)", CardMakerSettings.PrintPageWidth, 1, 1024, 1, 2, IniSettings.PrintPageWidth);
            zQuery.AddNumericBox("Page Height (inches)", CardMakerSettings.PrintPageHeight, 1, 1024, 1, 2, IniSettings.PrintPageHeight);
            zQuery.AddNumericBox("Page Horizontal Margin (inches)", CardMakerSettings.PrintPageHorizontalMargin, 0, 1024, 0.01m, 2, IniSettings.PrintPageHorizontalMargin);
            zQuery.AddNumericBox("Page Vertical Margin (inches)", CardMakerSettings.PrintPageVerticalMargin, 0, 1024, 0.01m, 2, IniSettings.PrintPageVerticalMargin);
            zQuery.AddCheckBox("Auto-Center Layouts on Page", CardMakerSettings.PrintAutoHorizontalCenter, IniSettings.PrintAutoCenterLayout);
            zQuery.AddCheckBox("Print Layouts On New Page", CardMakerSettings.PrintLayoutsOnNewPage, IniSettings.PrintLayoutsOnNewPage);
            zQuery.SetIcon(Icon);

            if (DialogResult.OK == zQuery.ShowDialog(this))
            {
                CardMakerSettings.PrintPageWidth = zQuery.GetDecimal(IniSettings.PrintPageWidth);
                CardMakerSettings.PrintPageHeight = zQuery.GetDecimal(IniSettings.PrintPageHeight);
                CardMakerSettings.PrintPageHorizontalMargin = zQuery.GetDecimal(IniSettings.PrintPageHorizontalMargin);
                CardMakerSettings.PrintPageVerticalMargin = zQuery.GetDecimal(IniSettings.PrintPageVerticalMargin);
                CardMakerSettings.PrintAutoHorizontalCenter = zQuery.GetBool(IniSettings.PrintAutoCenterLayout);
                CardMakerSettings.PrintLayoutBorder = zQuery.GetBool(IniSettings.PrintLayoutBorder);
                CardMakerSettings.PrintLayoutsOnNewPage = zQuery.GetBool(IniSettings.PrintLayoutsOnNewPage);
                CardMakerSettings.DefaultTranslatorType = (TranslatorType)zQuery.GetIndex(IniSettings.DefaultTranslator);

                var bWasGoogleCacheEnabled = CardMakerSettings.EnableGoogleCache;
                CardMakerSettings.EnableGoogleCache = zQuery.GetBool(IniSettings.EnableGoogleCache);
                if (!CardMakerSettings.EnableGoogleCache && bWasGoogleCacheEnabled)
                {
                    DeleteGoogleCache();
                }
            }
        }