Пример #1
0
        private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGrid dg = sender as DataGrid;

            if (dg != null)
            {
                DataGridRow dgr     = (DataGridRow)(dg.ItemContainerGenerator.ContainerFromIndex(dg.SelectedIndex));
                var         product = (ShowableSimpleProduct)dgr.Item;
                if (product.IsSold)
                {
                    var         url = $"../../Content/Warehouse/SoldProductPage.xaml?id={Guid.NewGuid()}";
                    BBCodeBlock bs  = new BBCodeBlock();
                    try
                    {
                        Application.Current.Properties["product_id"] = product.Id;
                        bs.LinkNavigator.Navigate(new Uri(url, UriKind.Relative), this);
                    }
                    catch (Exception error)
                    {
                        ModernDialog.ShowMessage(error.Message, FirstFloor.ModernUI.Resources.NavigationFailed, MessageBoxButton.OK);
                    }
                }
                else if (product.IsStored)
                {
                }
            }
        }
Пример #2
0
        private void EventSetter_OnHandler(object sender, MouseButtonEventArgs e)
        {
            var cmd = App.Container.GetExportedValues <ICommand>("cmd://home/AttachToProcessCommand").FirstOrDefault();

            if (cmd == null)
            {
                return;
            }
            if (cmd.CanExecute(null))
            {
                try
                {
                    cmd.Execute(null);
                    var lastError = ((BaseViewModel)DataContext).LastError;
                    if (!string.IsNullOrEmpty(lastError))
                    {
                        ModernDialog.ShowMessage("Error in attach to process. \n" + lastError, "Error", MessageBoxButton.OK);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    ModernDialog.ShowMessage("Error in attach to process. \n" + ex.Message, "Error", MessageBoxButton.OK);
                    return;
                }

                var bbBlock = new BBCodeBlock();
                bbBlock.LinkNavigator.Navigate(new Uri("/OperationTypes", UriKind.Relative), this, NavigationHelper.FrameSelf);
            }
        }
        void IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Image1 = (Image)target;
                return;

            case 2:
                this.Image2 = (Image)target;
                return;

            case 3:
                this.Description = (BBCodeBlock)target;
                return;

            case 4:
                this.Prev        = (Button)target;
                this.Prev.Click += new RoutedEventHandler(this.prev_Click);
                return;

            case 5:
                this.Next        = (Button)target;
                this.Next.Click += new RoutedEventHandler(this.next_Click);
                return;

            case 6:
                this.DotPanel = (StackPanel)target;
                return;

            default:
                this._contentLoaded = true;
                return;
            }
        }
Пример #4
0
        private void ModernButton_Click(object sender, RoutedEventArgs e)
        {
            var url = "/Pages/AddAccountPage.xaml";
            var bb  = new BBCodeBlock();

            bb.LinkNavigator.Navigate(new Uri(url, UriKind.Relative), this, NavigationHelper.FrameSelf);
        }
Пример #5
0
        /*/// <summary>
         * /// Identifies the BackgroundContent dependency property.
         * /// </summary>
         * public static readonly DependencyProperty BackgroundContentProperty = DependencyProperty.Register("BackgroundContent", typeof(object), typeof(InputBox));
         * /// <summary>
         * /// Identifies the Buttons dependency property.
         * /// </summary>
         * public static readonly DependencyProperty ButtonsProperty = DependencyProperty.Register("Buttons", typeof(IEnumerable<Button>), typeof(InputBox));
         *
         * private ICommand closeCommand;
         *
         * private Button okButton;
         * private Button cancelButton;
         * private Button yesButton;
         * private Button noButton;
         * private Button closeButton;
         *
         * private MessageBoxResult messageBoxResult = MessageBoxResult.None;
         *
         * /// <summary>
         * /// Initializes a new instance of the <see cref="InputBox"/> class.
         * /// </summary>
         * public InputBox()
         * {
         *  this.DefaultStyleKey = typeof(InputBox);
         *  this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
         *
         *  this.closeCommand = new RelayCommand(o =>
         *  {
         *      var result = o as MessageBoxResult?;
         *      if (result.HasValue)
         *      {
         *          this.messageBoxResult = result.Value;
         *
         *          // sets the Window.DialogResult as well
         *          if (result.Value == MessageBoxResult.OK || result.Value == MessageBoxResult.Yes)
         *          {
         *              this.DialogResult = true;
         *          }
         *          else if (result.Value == MessageBoxResult.Cancel || result.Value == MessageBoxResult.No)
         *          {
         *              this.DialogResult = false;
         *          }
         *          else
         *          {
         *              this.DialogResult = null;
         *          }
         *      }
         *      Close();
         *  });
         *
         *  this.Buttons = new Button[] { this.CloseButton };
         *
         *  // set the default owner to the app main window (if possible)
         *  if (Application.Current != null && Application.Current.MainWindow != this)
         *  {
         *      this.Owner = Application.Current.MainWindow;
         *  }
         * }
         *
         * private Button CreateCloseDialogButton(string content, bool isDefault, bool isCancel, MessageBoxResult result)
         * {
         *  return new Button
         *  {
         *      Content = content,
         *      Command = this.CloseCommand,
         *      CommandParameter = result,
         *      IsDefault = isDefault,
         *      IsCancel = isCancel,
         *      MinHeight = 21,
         *      MinWidth = 65,
         *      Margin = new Thickness(4, 0, 0, 0)
         *  };
         * }
         *
         * /// <summary>
         * /// Gets the close window command.
         * /// </summary>
         * public ICommand CloseCommand
         * {
         *  get { return this.closeCommand; }
         * }
         *
         * /// <summary>
         * /// Gets the Ok button.
         * /// </summary>
         * public Button OkButton
         * {
         *  get
         *  {
         *      if (this.okButton == null)
         *      {
         *          this.okButton = CreateCloseDialogButton(FirstFloor.ModernUI.Resources.Ok, true, false, MessageBoxResult.OK);
         *      }
         *      return this.okButton;
         *  }
         * }
         *
         * /// <summary>
         * /// Gets the Cancel button.
         * /// </summary>
         * public Button CancelButton
         * {
         *  get
         *  {
         *      if (this.cancelButton == null)
         *      {
         *          this.cancelButton = CreateCloseDialogButton(FirstFloor.ModernUI.Resources.Cancel, false, true, MessageBoxResult.Cancel);
         *      }
         *      return this.cancelButton;
         *  }
         * }
         *
         * /// <summary>
         * /// Gets the Yes button.
         * /// </summary>
         * public Button YesButton
         * {
         *  get
         *  {
         *      if (this.yesButton == null)
         *      {
         *          this.yesButton = CreateCloseDialogButton(FirstFloor.ModernUI.Resources.Yes, true, false, MessageBoxResult.Yes);
         *      }
         *      return this.yesButton;
         *  }
         * }
         *
         * /// <summary>
         * /// Gets the No button.
         * /// </summary>
         * public Button NoButton
         * {
         *  get
         *  {
         *      if (this.noButton == null)
         *      {
         *          this.noButton = CreateCloseDialogButton(FirstFloor.ModernUI.Resources.No, false, true, MessageBoxResult.No);
         *      }
         *      return this.noButton;
         *  }
         * }
         *
         * /// <summary>
         * /// Gets the Close button.
         * /// </summary>
         * public Button CloseButton
         * {
         *  get
         *  {
         *      if (this.closeButton == null)
         *      {
         *          this.closeButton = CreateCloseDialogButton(FirstFloor.ModernUI.Resources.Close, true, false, MessageBoxResult.None);
         *      }
         *      return this.closeButton;
         *  }
         * }
         *
         * public string Input
         * {
         *  get { return ""; }
         * }
         *
         * /// <summary>
         * /// Gets or sets the background content of this window instance.
         * /// </summary>
         * public object BackgroundContent
         * {
         *  get { return GetValue(BackgroundContentProperty); }
         *  set { SetValue(BackgroundContentProperty, value); }
         * }
         *
         * /// <summary>
         * /// Gets or sets the dialog buttons.
         * /// </summary>
         * public IEnumerable<Button> Buttons
         * {
         *  get { return (IEnumerable<Button>)GetValue(ButtonsProperty); }
         *  set { SetValue(ButtonsProperty, value); }
         * }
         *
         * /// <summary>
         * /// Gets the message box result.
         * /// </summary>
         * /// <value>
         * /// The message box result.
         * /// </value>
         * public MessageBoxResult MessageBoxResult
         * {
         *  get { return this.messageBoxResult; }
         * }*/

        /// <summary>
        /// Displays a messagebox.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="title">The title.</param>
        /// <param name="button">The button.</param>
        /// <param name="owner">The window owning the messagebox. The messagebox will be located at the center of the owner.</param>
        /// <returns></returns>
        public static string Show(string text, string title, Window owner = null)
        {
            StackPanel pnl = new StackPanel();
            TextBox    t   = new TextBox {
                Margin = new Thickness(0, 0, 0, 8)
            };
            BBCodeBlock blc = new BBCodeBlock {
                BBCode = text, Margin = new Thickness(0, 0, 0, 8)
            };

            pnl.Children.Add(blc);
            pnl.Children.Add(t);
            var dlg = new InputBox
            {
                Title     = title,
                Content   = pnl,
                MinHeight = 0,
                MinWidth  = 0,
                MaxHeight = 480,
                MaxWidth  = 640,
            };

            if (owner != null)
            {
                dlg.Owner = owner;
            }

            dlg.Buttons = new List <Button> {
                dlg.OkButton
            };
            dlg.ShowDialog();
            return(t.Text);
        }
Пример #6
0
        public void AddHeader(string text)
        {
            BBCodeBlock t = new BBCodeBlock();

            t.BBCode = "[b][size=16]" + text.ToUpper() + "[/b][/size]";
            t.Margin = baseMargin;
            s.Children.Add(t);
        }
Пример #7
0
        public void AddBBCode(string text)
        {
            BBCodeBlock t = new BBCodeBlock();

            t.BBCode = text;
            t.Margin = baseMargin;
            s.Children.Add(t);
        }
Пример #8
0
 //btnCancel_Click
 private void btnCancel_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BBCodeBlock bbcodeblock = new BBCodeBlock();
         bbcodeblock.LinkNavigator.Navigate(new Uri(@"/Pages/Home/Login.xaml", UriKind.Relative), this);
     }
     catch (Exception ex)
     {
         tblNotification.Text = ex.Message;
     }
 }
Пример #9
0
 public void NavigateTo(string uri, FrameworkElement source)
 {
     try
     {
         BBCodeBlock bbBlock = new BBCodeBlock();
         bbBlock.LinkNavigator.Navigate(new Uri(uri, UriKind.Relative), source, NavigationHelper.FrameTop);
     }
     catch (Exception error)
     {
         ModernDialog.ShowMessage(error.Message, FirstFloor.ModernUI.Resources.NavigationFailed, MessageBoxButton.OK);
     }
 }
Пример #10
0
        public void AddColoredBBCode(string text)
        {
            BBCodeBlock t = new BBCodeBlock();

            t.BBCode = "[color=#" +
                       ApplicationSettings.instance.accentColor.R.ToString("X2") +
                       ApplicationSettings.instance.accentColor.G.ToString("X2") +
                       ApplicationSettings.instance.accentColor.B.ToString("X2") + "]" +
                       text +
                       "[/color]";
            t.Margin = baseMargin;
            s.Children.Add(t);
        }
Пример #11
0
        public void AddColoredHeader(string text)
        {
            BBCodeBlock t = new BBCodeBlock();

            t.BBCode = "[color=#" +
                       ApplicationSettings.instance.accentColor.R.ToString("X2") +
                       ApplicationSettings.instance.accentColor.G.ToString("X2") +
                       ApplicationSettings.instance.accentColor.B.ToString("X2") + "]" +
                       "[b][size=16]" + text.ToUpper() + "[/b][/size]" +
                       "[/color]";
            t.Margin = baseMargin;
            s.Children.Add(t);
        }
Пример #12
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         AppViewModel.SelectedAccountFriendlyName = FriendlyNameTextBlock.Text;
         var url = "/Pages/AccountPage.xaml";
         var bb  = new BBCodeBlock();
         bb.LinkNavigator.Navigate(new Uri(url, UriKind.Relative), this);
     }
     catch
     {
     }
 }
        public void Navigate(string url, FrameworkElement sender)
        {
            BBCodeBlock bs = new BBCodeBlock();

            try
            {
                bs.LinkNavigator.Navigate(new Uri(url, UriKind.Relative), sender);
            }
            catch (Exception error)
            {
                ModernDialog.ShowMessage(error.Message, FirstFloor.ModernUI.Resources.NavigationFailed, MessageBoxButton.OK);
            }
        }
Пример #14
0
 //hplChangePassWord_Click
 private void hplChangePassWord_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BBCodeBlock bbcodeblock = new BBCodeBlock();
         bbcodeblock.LinkNavigator.Navigate(new Uri("/Pages/Setting/ChangePassword.xaml", UriKind.Relative), this);
     }
     catch (Exception ex)
     {
         Pages.Notification page = new Pages.Notification();
         page.tblNotification.Text = ex.Message;
         page.ShowDialog();
     }
 }
Пример #15
0
        public static void login(User user, Login lg)
        {
            var httpWebRequest = (HttpWebRequest)WebRequest.Create(Utility.ip + "/authenticate");

            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method      = "POST";

            var serializer       = new JavaScriptSerializer();
            var serializedResult = serializer.Serialize(user);

            using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
            {
                streamWriter.Write(serializedResult);
                streamWriter.Flush();
                streamWriter.Close();
            }

            var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();

            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();

                Dictionary <string, object> lr = serializer.Deserialize <dynamic>(result);
                Utility.user = user;

                if (lr.ContainsValue(true))
                {
                    BBCodeBlock bs = new BBCodeBlock();
                    user.token = (string)lr["token"];
                    try
                    {
                        bs.LinkNavigator.Navigate(new Uri("/Pages/ComponentView.xaml", UriKind.Relative), lg);
                    }

                    catch (Exception error)
                    {
                        ModernDialog.ShowMessage(error.Message, FirstFloor.ModernUI.Resources.NavigationFailed, MessageBoxButton.OK);
                    }

                    ModernDialog.ShowMessage("Login Successful", "", MessageBoxButton.OK);
                }

                else
                {
                    ModernDialog.ShowMessage(lr["msg"].ToString(), "Authentication Failed", MessageBoxButton.OK);
                }
            }
        }
Пример #16
0
        //btnChange_Click
        private void btnChange_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (pwbNewPassword.Password.Trim() == "")
                {
                    tblNotification.Text = FindResource("new_password_null").ToString();
                    pwbNewPassword.Focus();
                    return;
                }

                if (pwbNewPassword.Password.Trim().Length < 3)
                {
                    tblNotification.Text = FindResource("password_short").ToString();
                    pwbNewPassword.Focus();
                    return;
                }

                if (pwbConfirmPassword.Password.Trim() == "")
                {
                    tblNotification.Text = FindResource("confirm_password_null").ToString();
                    pwbConfirmPassword.Focus();
                    return;
                }

                if (pwbNewPassword.Password.Trim() != pwbConfirmPassword.Password.Trim().ToString())
                {
                    tblNotification.Text = FindResource("new_password_confirm_password_incorrect").ToString();
                    pwbNewPassword.Focus();
                    return;
                }

                else
                {
                    EC_tb_User ec_tb_user = new EC_tb_User();
                    ec_tb_user.ID       = 1;
                    ec_tb_user.Password = StaticClass.GeneralClass.MD5Hash(pwbNewPassword.Password.Trim());
                    if (bus_tb_user.UpdatePasswordUser(ec_tb_user, StaticClass.GeneralClass.flag_database_type_general) == 1)
                    {
                        BBCodeBlock bbcodeblock = new BBCodeBlock();
                        bbcodeblock.LinkNavigator.Navigate(new Uri(@"/Pages/Home/Login.xaml", UriKind.Relative), this);
                    }
                }
            }
            catch (Exception ex)
            {
                tblNotification.Text = ex.Message;
            }
        }
Пример #17
0
        //hplNo_Click
        private void hplNo_Click(object sender, RoutedEventArgs e)
        {
            BBCodeBlock bbcodeblock = new BBCodeBlock();

            try
            {
                bbcodeblock.LinkNavigator.Navigate(new Uri(@"/Pages/Home/Home.xaml", UriKind.Relative), this);
            }
            catch (Exception ex)
            {
                Pages.Notification page = new Pages.Notification();
                page.tblNotification.Text = ex.Message;
                page.ShowDialog();
            }
        }
Пример #18
0
        private void GetExcelImportTemplate()
        {
            string excelFileTemplate = ModelInfoSelected.ModelName + "_Template_" + DateTime.Now.ToString("yyyyMMddHHmmssfff");
            var    dialog            = new SaveFileDialog()
            {
                FileName = excelFileTemplate,
                Filter   = "Excel Files(*.xlsx)|*.xlsx|All(*.*)|*"
            };

            if (dialog.ShowDialog() == true)
            {
                DataTable tempTable    = (new DataTable()).FromHeaders(ModelInfoSelected.ModelProperties);
                bool      exportResult = ExcelProvider.Export(tempTable, dialog.FileName);

                BBCodeBlock codeBlock = new BBCodeBlock();
                if (exportResult)
                {
                    codeBlock.BBCode = string.Format("Succesfully imported excel {0} model data template.\nFile: {1}.\n[color=Green]Open file?[/color]", ModelInfoSelected.ModelName, dialog.FileName);

                    var dlg = new ModernDialog
                    {
                        Title   = "Import Excel Template",
                        Content = codeBlock
                    };
                    dlg.Buttons = new[] { dlg.YesButton, dlg.NoButton };
                    bool?result = dlg.ShowDialog();
                    if (result != null && result.Value)
                    {
                        Process.Start(dialog.FileName);
                    }
                }
                else
                {
                    codeBlock.BBCode = string.Format("Error importing excel {0} model data template.\nFile: {1}.\n[color=Red]Please try again.[/color]", ModelInfoSelected.ModelName, dialog.FileName);
                    var dlg = new ModernDialog
                    {
                        Title   = "Import Excel Template",
                        Content = codeBlock
                    };
                    dlg.Buttons = new[] { dlg.OkButton };
                    dlg.ShowDialog();
                }
            }
        }
        private static object CreateContent(string text)
        {
            var grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = GridLength.Auto
            });
            grid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(125)
            });

            grid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = GridLength.Auto
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition()
            {
                Width = new GridLength(400)
            });

            var bbCodeBlock = new BBCodeBlock {
                BBCode = text, Margin = new Thickness(0, 2, 0, 8)
            };

            grid.Children.Add(bbCodeBlock);
            textBox = new TextBox()
            {
                Margin = new Thickness(2, 0, 0, 8), TextWrapping = TextWrapping.Wrap, AcceptsReturn = true, VerticalAlignment = VerticalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch
            };

            grid.Children.Add(textBox);

            Grid.SetRow(bbCodeBlock, 0);
            Grid.SetColumn(bbCodeBlock, 0);

            Grid.SetRow(textBox, 0);
            Grid.SetRowSpan(textBox, 2);
            Grid.SetColumn(textBox, 1);

            return(grid);
        }
Пример #20
0
        private void ImportDataFromExcelFile()
        {
            var dialog = new OpenFileDialog()
            {
                Filter = "Excel Files(*.xlsx)|*.xlsx|All(*.*)|*"
            };

            if (dialog.ShowDialog() == true)
            {
                DataTable tempTable;
                bool      importResult = ExcelProvider.Import(out tempTable, dialog.FileName);

                BBCodeBlock codeBlock = new BBCodeBlock();
                if (importResult)
                {
                    codeBlock.BBCode = string.Format("Succesfully imported excel {0} model data.\nFile: {1}.\n[color=Green]Load data?[/color]", ModelInfoSelected.ModelName, dialog.FileName);

                    var dlg = new ModernDialog
                    {
                        Title   = "Import Excel Data",
                        Content = codeBlock
                    };
                    dlg.Buttons = new[] { dlg.YesButton, dlg.NoButton };
                    bool?result = dlg.ShowDialog();
                    if (result != null && result.Value)
                    {
                        ModuleItems = tempTable;
                    }
                }
                else
                {
                    codeBlock.BBCode = string.Format("Error importing excel {0} model data.\nFile: {1}.\n[color=Red]Please try again.[/color]", ModelInfoSelected.ModelName, dialog.FileName);
                    var dlg = new ModernDialog
                    {
                        Title   = "Import Excel Data",
                        Content = codeBlock
                    };
                    dlg.Buttons = new[] { dlg.OkButton };
                    dlg.ShowDialog();
                }
            }
        }
Пример #21
0
        private async void Btn_Login_ClickAsync(object sender, RoutedEventArgs e)//ログインボタン@tom
        {
            var login = await global.net.Login(txtID.Text, txtPass.Text);

            Console.WriteLine(login);
            if (login)
            {
                var url = "/Design/ListPage1.xaml";
                var bb  = new BBCodeBlock();
                bb.LinkNavigator.Navigate(new Uri(url, UriKind.Relative), this);
                // You may want to set some property in that page's ViewModel, for example, indicating the selected User ID.
            }
            else if (login == false)
            {
                var url = "/Design/pageLogin.xaml"; //Login出来なかったとき用@kurikinton、ページ作成お願いします。
                var bb  = new BBCodeBlock();
                bb.LinkNavigator.Navigate(new Uri(url, UriKind.Relative), this);
                Console.WriteLine("ログインページにもどります");
            }
        }
Пример #22
0
        //btnOK_Click
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (txbQuestion.Text.Trim().ToString() == "")
            {
                tblNotification.Text = FindResource("question_null").ToString();;
                txbQuestion.Focus();
                return;
            }

            if (txbAnswer.Text.Trim().ToString() == "")
            {
                tblNotification.Text = FindResource("answer_null").ToString();;
                txbAnswer.Focus();
                return;
            }

            if (CheckResetPassword(txbQuestion.Text.Trim(), txbAnswer.Text.Trim()))
            {
                BBCodeBlock bbcodeblock = new BBCodeBlock();
                bbcodeblock.LinkNavigator.Navigate(new Uri(@"/Pages/Setting/CreateNewPassword.xaml", UriKind.Relative), this);
            }
            else
            {
                System.Data.DataTable tb_user = bus_tb_user.GetUser("WHERE [Name] = 'Admin' AND [Question] = '" + txbQuestion.Text.Trim().ToLower() + "' AND [Answer] = '" + txbAnswer.Text.Trim().ToLower() + "'");

                if (tb_user.Rows.Count == 1)
                {
                    StaticClass.GeneralClass.id_user_general = Convert.ToInt32(tb_user.Rows[0]["ID"].ToString());
                    BBCodeBlock bbcodeblock = new BBCodeBlock();
                    bbcodeblock.LinkNavigator.Navigate(new Uri(@"/Pages/Setting/CreateNewPassword.xaml", UriKind.Relative), this);
                }
                else
                {
                    tblNotification.Text = FindResource("user_info_incorrect").ToString();
                    txbQuestion.Focus();
                }
            }
        }
Пример #23
0
        public static ModernDialog CreateModernDialog(string title, string content, string textYesButton = null, string textNoButton = null, string textOkButton = null, string textCancelButton = null)
        {
            ModernDialog expr_05 = new ModernDialog();

            expr_05.Title = title;
            BBCodeBlock expr_12 = new BBCodeBlock();

            expr_12.set_BBCode(content);
            expr_12.TextWrapping = TextWrapping.WrapWithOverflow;
            expr_05.Content      = expr_12;
            ModernDialog modernDialog = expr_05;

            modernDialog.BorderBrush = (modernDialog.FindResource("YellowBaseBrush") as Brush);
            if (ObjectHolder.MainForm != null && ObjectHolder.MainForm.IsVisible)
            {
                modernDialog.Owner = ObjectHolder.MainForm;
            }
            modernDialog.get_YesButton().Content    = (textYesButton ?? Components.ModernDialogExtension_CreateModernDialog_Yes);
            modernDialog.get_NoButton().Content     = (textNoButton ?? Components.ModernDialogExtension_CreateModernDialog_No);
            modernDialog.get_OkButton().Content     = (textOkButton ?? Components.ModernDialogExtension_CreateModernDialog_Ok);
            modernDialog.get_CancelButton().Content = (textCancelButton ?? Components.ModernDialogExtension_CreateModernDialog_Cancel);
            return(modernDialog);
        }
Пример #24
0
        private void btn_login_Click_1(object sender, RoutedEventArgs e)
        {
            //new ModernDialog
            //{
            //    Title = "Common dialog",
            //    Content = new Home()
            //}.ShowDialog();
            Err err = User.login(tb_id.Text, pb_pwd.Password);

            if (err.res == true)
            {
                MainWindow.is_loged_in = true;
                MainWindow.loginuser   = User.get_single_user(tb_id.Text);
                ModernDialog.ShowMessage("Login success user name " + tb_id.Text + " user power " + MainWindow.loginuser.U_Power, "LogIn status", MessageBoxButton.OK);
                BBCodeBlock bb = new BBCodeBlock();
            }
            else
            {
                ModernDialog.ShowMessage("Login failed\ncause of " + err.info, "LogIn status", MessageBoxButton.OK);
                this.tb_id.Text      = "";
                this.pb_pwd.Password = "";
            }
        }
Пример #25
0
        private void buttonOk_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (comboBoxServerUriList.SelectedValue != null)
                {
                    Properties.Settings.Default.ServerUri = comboBoxServerUriList.SelectedValue.ToString().Split(new char[] { '|' })[1].Trim();

                    string productGroup = comboBoxProductGroupList.SelectedValue.ToString();
                    if (productGroup == Properties.Resources.ProductGroup_Projects)
                    {
                        Properties.Settings.Default.SupportPerson = Properties.Resources.SupportPerson_Projects;
                    }
                    else if (productGroup == Properties.Resources.ProductGroup_ServiceAsset)
                    {
                        Properties.Settings.Default.SupportPerson = Properties.Resources.SupportPerson_ServiceAsset;
                    }
                    else if (productGroup == Properties.Resources.ProductGroup_Other)
                    {
                        Properties.Settings.Default.SupportPerson = Properties.Resources.SupportPerson_Other;
                    }

                    BBCodeBlock bs = new BBCodeBlock();

                    bs.LinkNavigator.Navigate(new Uri("/UserControls/UserControlCheckOut.xaml", UriKind.Relative), this);
                }
                else
                {
                    ModernDialog.ShowMessage("Please Select a Server.", "Server Select", MessageBoxButton.OK);
                }
            }
            catch (Exception error)
            {
                ModernDialog.ShowMessage(error.Message, FirstFloor.ModernUI.Resources.NavigationFailed, MessageBoxButton.OK);
            }
        }
Пример #26
0
        //hplRegister_Click
        private void hplRegister_Click(object sender, RoutedEventArgs e)
        {
            BBCodeBlock bbcodeblock = new BBCodeBlock();

            bbcodeblock.LinkNavigator.Navigate(new Uri(@"/Pages/CopyRight/Register.xaml", UriKind.Relative), this);
        }
        void RegisterCustomBBCodeTag()
        {
            BBCodeBlock.AddCustomTag("icon", rpInline =>
            {
                var rSpan = rpInline as Span;
                if (rSpan == null || rSpan.Inlines.Count != 1)
                {
                    return(null);
                }

                var rRun = rSpan.Inlines.FirstInline as Run;
                if (rRun == null)
                {
                    return(null);
                }

                var rMaterial = rRun.Text;
                if (rMaterial.OICEquals("fuel"))
                {
                    return new InlineUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Fuel
                    })
                    {
                        BaselineAlignment = BaselineAlignment.Center
                    }
                }
                ;
                if (rMaterial.OICEquals("bullet"))
                {
                    return new InlineUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Bullet
                    })
                    {
                        BaselineAlignment = BaselineAlignment.Center
                    }
                }
                ;
                if (rMaterial.OICEquals("steel"))
                {
                    return new InlineUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Steel
                    })
                    {
                        BaselineAlignment = BaselineAlignment.Center
                    }
                }
                ;
                if (rMaterial.OICEquals("bauxite"))
                {
                    return new InlineUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Bauxite
                    })
                    {
                        BaselineAlignment = BaselineAlignment.Center
                    }
                }
                ;
                if (rMaterial.OICEquals("ic"))
                {
                    return new InlineUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.InstantConstruction
                    })
                    {
                        BaselineAlignment = BaselineAlignment.Center
                    }
                }
                ;
                if (rMaterial.OICEquals("bucket"))
                {
                    return new InlineUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Bucket
                    })
                    {
                        BaselineAlignment = BaselineAlignment.Center
                    }
                }
                ;
                if (rMaterial.OICEquals("dm"))
                {
                    return new InlineUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.DevelopmentMaterial
                    })
                    {
                        BaselineAlignment = BaselineAlignment.Center
                    }
                }
                ;
                if (rMaterial.OICEquals("im"))
                {
                    return new InlineUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.ImprovementMaterial
                    })
                    {
                        BaselineAlignment = BaselineAlignment.Center
                    }
                }
                ;

                return(null);
            });
        }
Пример #28
0
        //btnOK_Click
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (txbYourEmail.Text.Trim().ToString() == "")
                {
                    tblNotification.Text = FindResource("your_email_null").ToString();
                    txbYourEmail.Focus();
                    return;
                }

                if (txbSerialNumber.Text.Trim().ToString() == "")
                {
                    tblNotification.Text = FindResource("serial_number_null").ToString();
                    txbSerialNumber.Focus();
                    return;
                }

                else
                {
                    SecurityManager scm              = new SecurityManager();
                    string          softname         = "Cash Register";
                    string          customer_email   = txbYourEmail.Text.Trim().ToString();
                    string          license_key_info = softname + "_" + StaticClass.GeneralClass.software_version + "_" + customer_email;
                    string          serial_number    = txbSerialNumber.Text.Trim().ToString();
                    if (scm.CheckSerialNumber(license_key_info, serial_number))
                    {
                        //create register status in regedit
                        Registry.SetValue(StaticClass.GeneralClass.keyname_register_general, StaticClass.GeneralClass.valuename_register_general, "TRUE");

                        //create register info file
                        Pages.CopyRight.SecurityManager security_manager = new Pages.CopyRight.SecurityManager();
                        security_manager.EncryptFile(customer_email, serial_number, "ResInfo", "EncryptReg", StaticClass.GeneralClass.key_register_general);

                        Pages.Notification page = new Pages.Notification();
                        page.tblNotification.Text = FindResource("activation_success").ToString();
                        page.ShowDialog();

                        //set registerd successful
                        StaticClass.GeneralClass.flag_registered_general      = true;
                        StaticClass.GeneralClass.youremail_registered_general = txbYourEmail.Text.Trim().ToString();
                        Application.Current.Resources["cash_register"]        = "Cash Register Pro";

                        BBCodeBlock bbcodeblock = new BBCodeBlock();
                        bbcodeblock.LinkNavigator.Navigate(new Uri(@"/Pages/Settings/About.xaml", UriKind.Relative), this);
                    }
                    else
                    {
                        //if serial number is invalid
                        Registry.SetValue(StaticClass.GeneralClass.keyname_register_general, StaticClass.GeneralClass.valuename_register_general, "FALSE");

                        Pages.Notification page = new Pages.Notification();
                        page.tblNotification.Text = FindResource("activation_unsuccess").ToString();
                        page.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                //if serial number is invalid and have error
                Registry.SetValue(StaticClass.GeneralClass.keyname_register_general, StaticClass.GeneralClass.valuename_register_general, "FALSE");

                tblNotification.Text = ex.Message;
            }
        }
Пример #29
0
        void RegisterCustomBBCodeTag()
        {
            BBCodeBlock.AddCustomTag("icon", rpInline =>
            {
                var rSpan = rpInline as Span;
                if (rSpan == null || rSpan.Inlines.Count != 1)
                {
                    return(null);
                }

                var rRun = rSpan.Inlines.FirstInline as Run;
                if (rRun == null)
                {
                    return(null);
                }

                var rIcon = rRun.Text;
                if (rIcon.OICEquals("fuel"))
                {
                    return(GetUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Fuel
                    }));
                }
                if (rIcon.OICEquals("bullet"))
                {
                    return(GetUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Bullet
                    }));
                }
                if (rIcon.OICEquals("steel"))
                {
                    return(GetUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Steel
                    }));
                }
                if (rIcon.OICEquals("bauxite"))
                {
                    return(GetUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Bauxite
                    }));
                }
                if (rIcon.OICEquals("ic"))
                {
                    return(GetUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.InstantConstruction
                    }));
                }
                if (rIcon.OICEquals("bucket"))
                {
                    return(GetUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.Bucket
                    }));
                }
                if (rIcon.OICEquals("dm"))
                {
                    return(GetUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.DevelopmentMaterial
                    }));
                }
                if (rIcon.OICEquals("im"))
                {
                    return(GetUIContainer(new MaterialIcon()
                    {
                        Type = MaterialType.ImprovementMaterial
                    }));
                }

                if (rIcon.OICEquals("firepower"))
                {
                    return(GetUIContainer(new CommonPropertyIcon()
                    {
                        Type = CommonProperty.Firepower
                    }));
                }
                if (rIcon.OICEquals("torpedo"))
                {
                    return(GetUIContainer(new CommonPropertyIcon()
                    {
                        Type = CommonProperty.Torpedo
                    }));
                }
                if (rIcon.OICEquals("aa"))
                {
                    return(GetUIContainer(new CommonPropertyIcon()
                    {
                        Type = CommonProperty.AA
                    }));
                }
                if (rIcon.OICEquals("armor"))
                {
                    return(GetUIContainer(new CommonPropertyIcon()
                    {
                        Type = CommonProperty.Armor
                    }));
                }
                if (rIcon.OICEquals("luck"))
                {
                    return(GetUIContainer(new CommonPropertyIcon()
                    {
                        Type = CommonProperty.Luck
                    }));
                }

                return(null);
            });
        }
Пример #30
0
        //btnOK_Click
        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (pwbCurrentPassword.Password.Trim() == "")
                {
                    tblNotification.Text = FindResource("current_password_null").ToString();
                    pwbCurrentPassword.Focus();
                    return;
                }

                if (pwbNewPassword.Password.Trim() == "")
                {
                    tblNotification.Text = FindResource("new_password_null").ToString();
                    pwbNewPassword.Focus();
                    return;
                }

                if (pwbNewPassword.Password.Trim().Length < 3)
                {
                    tblNotification.Text = FindResource("password_short").ToString();
                    pwbNewPassword.Focus();
                    return;
                }

                if (pwbConfirmPassword.Password.Trim() == "")
                {
                    tblNotification.Text = FindResource("confirm_password_null").ToString();
                    pwbConfirmPassword.Focus();
                    return;
                }

                else
                {
                    if (StaticClass.GeneralClass.MD5Hash(pwbCurrentPassword.Password.Trim().ToString()) != StaticClass.GeneralClass.password_user_general)
                    {
                        tblNotification.Text = FindResource("current_password_incorrect").ToString();
                        pwbCurrentPassword.Focus();
                        return;
                    }

                    if (StaticClass.GeneralClass.MD5Hash(pwbNewPassword.Password.Trim().ToString()) != StaticClass.GeneralClass.MD5Hash(pwbConfirmPassword.Password.Trim().ToString()))
                    {
                        tblNotification.Text = FindResource("new_password_confirm_password_incorrect").ToString();
                        pwbConfirmPassword.Focus();
                        return;
                    }

                    else
                    {
                        EC_tb_User ec_tb_user = new EC_tb_User();
                        ec_tb_user.ID       = StaticClass.GeneralClass.id_user_general;
                        ec_tb_user.Password = StaticClass.GeneralClass.MD5Hash(pwbNewPassword.Password.Trim().ToString());

                        if (bus_tb_user.UpdatePasswordUser(ec_tb_user, StaticClass.GeneralClass.flag_database_type_general) == 1)
                        {
                            StaticClass.GeneralClass.password_user_general = ec_tb_user.Password;

                            //return account page
                            BBCodeBlock bbcodeblock = new BBCodeBlock();
                            bbcodeblock.LinkNavigator.Navigate(new Uri("/Pages/Setting/Account.xaml", UriKind.Relative), this);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Pages.Notification page = new Pages.Notification();
                page.tblNotification.Text = ex.Message;
                page.ShowDialog();
            }
        }