예제 #1
0
        private async void Confirmed()
        {
            string NName = NewName.Text.Trim();
            string Error = "";

            if (string.IsNullOrEmpty(NName))
            {
                Error = "Value cannot be empty!";
            }
            else
            {
                try
                {
                    NamingTarget.Name = NName;
                    Canceled          = false;
                    this.Hide();
                    return;
                }
                catch (Exception ex)
                {
                    Error = ex.Message;
                }
            }

            if (Error != "")
            {
                MessageDialog Msg = new MessageDialog(Error);
                // Should NOT use Popups.ShowDialog because it closes the rename dialog
                // Making the caller await step thru, causing undesired behaviour
                await Msg.ShowAsync();

                NewName.Focus(FocusState.Keyboard);
            }
        }
예제 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((NewName != null ? NewName.GetHashCode() : 0) * 397) ^ (Test != null ? Test.GetHashCode() : 0));
     }
 }
예제 #3
0
        static public void UpdateLecturer(ref Dictionary <int, Lecturer> ListOfLecturers)
        {
            string NewName;

            Console.WriteLine("Please enter the Students's ID․․");
            var LIDasStr = Console.ReadLine();
            int LID;

            while (!int.TryParse(LIDasStr, out LID))
            {
                Console.WriteLine("This is not a number! Try again..");
                LIDasStr = Console.ReadLine();
            }
            if (ListOfLecturers.ContainsKey(LID))
            {
                Console.WriteLine("Please enter the new lecturer's name..");
                NewName = Console.ReadLine();
                bool allLetters;
                while (!(allLetters = NewName.All(c => Char.IsLetter(c))) || !(Char.IsUpper(NewName, 0)))
                {
                    Console.WriteLine("Invalid name format!! Try again..");
                    NewName = Console.ReadLine();
                }
                ListOfLecturers[LID].Name = NewName;
                ListOfLecturers[LID].University.GetLecturer(LID).Name = NewName;
                ListOfLecturers[LID].Faculty.GetLecturer(LID).Name    = NewName;
            }
            else
            {
                Console.WriteLine("There is no lecturer on this ID!");
            }
        }
예제 #4
0
        static public void UpdateUniversity(ref Dictionary <int, University> ListOfUniversities)
        {
            string NewName;

            Console.WriteLine("Please enter the University's ID․․");
            var UIDasStr = Console.ReadLine();
            int UID;

            while (!int.TryParse(UIDasStr, out UID))
            {
                Console.WriteLine("This is not a number! Try again..");
                UIDasStr = Console.ReadLine();
            }
            if (ListOfUniversities.ContainsKey(UID))
            {
                Console.WriteLine("Please enter the new University's name..");
                NewName = Console.ReadLine();
                bool allLetters;
                while (!(allLetters = NewName.All(c => Char.IsLetter(c))) || !(NewName.IsUpper()))
                {
                    Console.WriteLine("Invalid name format! Try again..");
                    NewName = Console.ReadLine();
                }
                ListOfUniversities[UID].Name = NewName;
            }
            else
            {
                Console.WriteLine("There is no University on this ID!");
            }
        }
예제 #5
0
    static void Main()
    {
        Name name = new Name();

        if (special_variable_macros.testFred(name) != "none")
        {
            throw new Exception("test failed");
        }
        if (special_variable_macros.testJack(name) != "$specialname")
        {
            throw new Exception("test failed");
        }
        if (special_variable_macros.testJill(name) != "jilly")
        {
            throw new Exception("test failed");
        }
        if (special_variable_macros.testMary(name) != "SWIGTYPE_p_NameWrap")
        {
            throw new Exception("test failed");
        }
        if (special_variable_macros.testJim(name) != "multiname num")
        {
            throw new Exception("test failed");
        }
        if (special_variable_macros.testJohn(new PairIntBool(10, false)) != 123)
        {
            throw new Exception("test failed");
        }
        NewName newName = NewName.factory("factoryname");

        name = newName.getStoredName();
    }
예제 #6
0
        public override void DoImpl()
        {
            if (Value.Parent.GetValues().Any(v => v.Name == NewName))
            {
                throw new ValidationException(Resources.Validation_DuplicateValueName, NewName);
            }

            if (NewName.IsNullOrEmpty())
            {
                throw new ValidationException(Resources.Validation_InvalidName, NewName);
            }

            try
            {
                var lvi = List.Items.Cast <ListViewItem>().Single(item => item.Text == Value.Name);
                lvi.ForeColor = NewName.StartsWith("$") ? Color.LightGray : Color.Black;

                OldName = Value.Name;
                Value.Rename(NewName);
            }
            catch (ArgumentException)
            {
                throw new ValidationException(Resources.Validation_InvalidName, NewName);
            }
        }
        public override void DoImpl()
        {
            if (Branch.Parent.GetBranches().Any(b => b.Name == NewName))
            {
                throw new ValidationException(Resources.Validation_DuplicateBranchName, NewName);
            }

            if (NewName.IsNullOrEmpty())
            {
                throw new ValidationException(Resources.Validation_InvalidName, NewName);
            }

            try
            {
                var tn = Tree.Nodes[0].SelectNode(Branch.VPath).AssertNotNull();
                tn.ForeColor = NewName.StartsWith("$") ? Color.LightGray : Color.Black;

                OldName = Branch.Name;
                Branch.Rename(NewName);
            }
            catch (ArgumentException)
            {
                throw new ValidationException(Resources.Validation_InvalidName, NewName);
            }
        }
예제 #8
0
        private Section LoadSection()
        {
            Stream         str        = null;
            OpenFileDialog LoadWindow = new OpenFileDialog()
            {
                InitialDirectory = "c:\\Pulpit",
                Filter           = "All files (*.*)|*.*|JPG (*.jpg)|*.jpg",
                FilterIndex      = 2,
                RestoreDirectory = true
            };

            try
            {
                LoadWindow.ShowDialog();
                str = LoadWindow.OpenFile();
                if (str != null)
                {
                    Bitmap img = new Bitmap(str);

                    StringPackage pac     = new StringPackage("");
                    NewName       newName = new NewName(pac);
                    newName.ShowDialog();
                    Section sec = new Section(pac.Content, img);
                    AddToList(sec);
                    return(sec);
                }
            }
            catch
            {
                return(null);
            }
            return(null);
        }
        public int ChangeName(NewName nn)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            SqlCommand    command    = new SqlCommand("usp_changeName");

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new SqlParameter("@UserID", nn.UserID));
            command.Parameters.Add(new SqlParameter("@NewName", nn.NewNameString));
            command.Connection = connection;

            connection.Open();
            SqlDataAdapter adapter = new SqlDataAdapter(command);
            DataTable      table   = new DataTable();

            adapter.Fill(table);
            connection.Close();

            if (table.Rows[0][0].ToString() == nn.NewNameString)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
 public string this[string columnName]
 {
     get
     {
         ErrorMessage = null;
         if (columnName == "NewName" && !string.IsNullOrEmpty(NewName))
         {
             if (NewName == App.STANDARD_DESIGN_NAME)
             {
                 ErrorMessage = string.Format("Der Name \"{0}\" ist reserviert.", App.STANDARD_DESIGN_NAME);
             }
             else if (NewName.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) > -1)
             {
                 ErrorMessage = "Der Name enthält unerlaubte Zeichen!";
             }
             else
             {
                 if (reg.IsMatch(NewName))
                 {
                     ErrorMessage = "Der Dateiname ist nicht erlaubt!";
                 }
             }
         }
         return(ErrorMessage);
     }
 }
예제 #11
0
 public RenameItem(string oldName)
 {
     InitializeComponent();
     Name         = oldName;
     Title        = $"Renaming {oldName}";
     NewName.Text = oldName;
     NewName.Focus();
 }
예제 #12
0
 private void Button_Click_4(object sender, RoutedEventArgs e)
 {
     dg_newV.IsOpen = false;
     ImagenesDG.Columns[5].Visibility = Visibility.Visible;
     NewName.Clear();
     NewDataPath.Clear();
     AddSVG(files);
 }
예제 #13
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (PassThru.Expression != null)
            {
                targetCommand.AddParameter("PassThru", PassThru.Get(context));
            }

            if (DomainCredential.Expression != null)
            {
                targetCommand.AddParameter("DomainCredential", DomainCredential.Get(context));
            }

            if (LocalCredential.Expression != null)
            {
                targetCommand.AddParameter("LocalCredential", LocalCredential.Get(context));
            }

            if (NewName.Expression != null)
            {
                targetCommand.AddParameter("NewName", NewName.Get(context));
            }

            if (Force.Expression != null)
            {
                targetCommand.AddParameter("Force", Force.Get(context));
            }

            if (Restart.Expression != null)
            {
                targetCommand.AddParameter("Restart", Restart.Get(context));
            }

            if (WsmanAuthentication.Expression != null)
            {
                targetCommand.AddParameter("WsmanAuthentication", WsmanAuthentication.Get(context));
            }

            if (Protocol.Expression != null)
            {
                targetCommand.AddParameter("Protocol", Protocol.Get(context));
            }

            if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom))
            {
                targetCommand.AddParameter("ComputerName", PSComputerName.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
예제 #14
0
 public RenameWindow()
 {
     InitializeComponent();
     _renameType   = RenameType.NewCategory;
     Title         = "Создать категорию";
     ResultNewName = "";
     NewName.Text  = "";
     NewName.Focus();
 }
예제 #15
0
        public void CreateFolder(IClientRequest request)
        {
            NewName input = request.GetInput <NewName>();

            try
            {
                FolderCreator.Create(input);
            }
            catch { }
        }
예제 #16
0
        public void ChangeNameTest()
        {
            NewName nn = new NewName();

            nn.UserID        = GetUserID();
            nn.NewNameString = "TESTNAME2";

            int result = controller.ChangeName(nn);

            Assert.AreEqual(result, 1);
        }
예제 #17
0
 /// <summary>
 /// Submits a supplied ResultType as a new Result Type
 /// </summary>
 /// <param name="result">Single ResultType</param>
 public void SubmitNewResultType(ResultType result)
 {
     ScrollToBottom();
     NewName.Type(result.Name);
     NewUoM.Type(result.UoM);
     SetCheckBox(NewDefault, result.IsDefault);
     NewReportingPeriod.SelectListOptionByText(result.ReportingPeriod.ToString());
     System.Threading.Thread.Sleep(1000);  //give it a couple seconds to catch up
     NewCreateButton.Click();
     System.Threading.Thread.Sleep(1000);  //give it a couple seconds to catch up
 }
예제 #18
0
 private void Rename_Click(object sender, RoutedEventArgs e)
 {
     if (RenameArea.Visibility == Visibility.Visible)
     {
         RenameArea.Visibility = Visibility.Collapsed;
     }
     else
     {
         RenameArea.Visibility = Visibility.Visible;
         NewName.Focus(FocusState.Keyboard);
         NewName.Select(0, NewName.Text.Length);
     }
 }
예제 #19
0
        private void button1_Click(object sender, EventArgs e)
        {
            NewName = newNameTextBox.Text;
            NewName = NewName.Trim().Replace(' ', '_').Trim();

            if (newNameTextBox.Text.Length == 0)
            {
                MessageBox.Show("Name can't be blank.");
                return;
            }

            Close();
            result = true;
        }
        /// <summary>
        /// Handles the OK button's Click event.
        /// </summary>
        /// <param name="sender">The button object.</param>
        /// <param name="e">The event arguments.</param>
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (_rename)
            {
                // Check for invalid characters.
                if (NewName.Contains("/") || NewName.Contains("\\"))
                {
                    MessageBox.Show(Messages.InvalidCharacters, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }
            }

            this.DialogResult = DialogResult.OK;
        }
예제 #21
0
        public Rename(INamable Target, string Title, bool ReadOnly)
            : this()
        {
            NamingTarget       = Target;
            NewName.Text       = Target.Name;
            NewName.IsReadOnly = ReadOnly;

            NewName.SelectAll();

            if (!string.IsNullOrEmpty(Title))
            {
                TitleBlock.Text = Title;
            }
        }
예제 #22
0
    }                   // ボタンが押されたときに実行されるデリゲート

    void OnGUI()
    {
        NewName = EditorGUILayout.TextField(CaptionText, NewName);
        if (GUILayout.Button(ButtonText))
        {
            if (OnClickButtonDelegate != null)
            {
                // ボタンが押されたら、あらかじめ設定されたデリゲートに入力された名前を渡す
                OnClickButtonDelegate.Invoke(NewName.Trim());
            }

            Close();
            GUIUtility.ExitGUI();
        }
    }
예제 #23
0
    }                                                           // 버튼을 눌렀을 때이 눌러졌을 때 실행되는 델리게이트

    void OnGUI()
    {
        NewName = EditorGUILayout.TextField(CaptionText, NewName);
        if (GUILayout.Button(ButtonText))
        {
            if (OnClickButtonDelegate != null)
            {
                // 버튼을 누르면이 눌러지면 미리 설정된 델리게이트에 입력된되어 있는 이름을 넘겨준다
                OnClickButtonDelegate.Invoke(NewName.Trim());
            }

            Close();
            GUIUtility.ExitGUI();
        }
    }
예제 #24
0
        private void OnNewNameButtonClick(object sender, RoutedEventArgs e)
        {
            StringPackage pac     = new StringPackage("");
            NewName       newName = new NewName(pac);

            newName.ShowDialog();
            string na = pac.Content;

            if (!na.Contains(".kml"))
            {
                na += ".kml";
            }

            ((Kml)ChosenFile.Root).Feature.Name = na;
        }
예제 #25
0
        /// <summary>
        ///		Comprueba que los datos introducidos sean correctos
        /// </summary>
        private bool ValidateData()
        {
            bool validate = false;

            // Comprueba los datos introducidos
            if (NewName.IsEmpty())
            {
                SourceEditorViewModel.Instance.ControllerWindow.ShowMessage("Introduzca el nuevo nombre del archivo");
            }
            else
            {
                validate = true;
            }
            // Devuelve el valor que indica si los datos son correctos
            return(validate);
        }
예제 #26
0
 public override void SaveToStream(Stream s)
 {
     using (BinaryWriter bw = new BinaryWriter(s, Encoding.ASCII, true))
     {
         bw.Write(SignerAccount);
         bw.Write(TargetAccount);
         bw.Write(NumberOfOperations);
         bw.Write(Fee);
         Payload.SaveToStream(bw);
         AccountKey.SaveToStream(s, false);
         bw.Write(ChangeType);
         NewAccountKey.SaveToStream(s, false);
         NewName.SaveToStream(bw);
         bw.Write(NewType);
         Signature.SaveToStream(s);
     }
 }
        protected override MergeResult DoMerge(Operation operation)
        {
            if (base.DoMerge(operation) == MergeResult.Stop)
            {
                return(MergeResult.Stop);
            }

            if (operation is RenameColumnOperation otherAsRenameColumnOp &&
                NewName.Equals(otherAsRenameColumnOp.Name, StringComparison.InvariantCultureIgnoreCase))
            {
                NewName = otherAsRenameColumnOp.NewName;
                otherAsRenameColumnOp.Disabled = true;
                return(MergeResult.Continue);
            }

            return(MergeResult.Continue);
        }
예제 #28
0
        protected override void ProcessRecord()
        {
            if (NewName.Contains("\\"))
            {
                NewName = System.IO.Path.GetFileName(NewName);
            }
            string newPath = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(FilePath), NewName);

            //  テスト自動生成
            _generator.FilePath(FilePath);
            _generator.FilePath(newPath);

            if (File.Exists(FilePath))
            {
                FileSystem.RenameFile(FilePath, NewName);
            }
            WriteObject(new FileSummary(newPath, true));
        }
예제 #29
0
        /// <summary>
        /// Add new item to <see cref="ScheduleDataViewModel.ItemCustomList"/>.
        /// </summary>
        private async Task AddItemCommandMethodAsync()
        {
            await RunCommandAsync(() => mModifyFlag, async() =>
            {
                IoC.Logger.Log("Creating new schedule custom item.", LogLevel.Debug);

                if (!IoC.DataContent.ScheduleData.CanAddCustomItem)
                {
                    return;
                }

                if (string.IsNullOrEmpty(NewName))
                {
                    return;
                }

                // Trim.
                string name     = NewName.Trim();
                string colorHex = "000000";

                // Add item.
                if (FormVM.AddItem(name, colorHex, false) == null)
                {
                    // Some error occured during adding item.
                    _ = IoC.UI.ShowNotification(new NotificationBoxDialogViewModel()
                    {
                        Title   = "ERROR OCCURRED!",
                        Message = $"The name of the item is already defined or some of the entered values are invalid. Please, check them again.",
                        Result  = NotificationBoxResult.Ok,
                    });

                    return;
                }

                // Log it.
                IoC.Logger.Log($"Created new schedule custom item '{name}'.", LogLevel.Info);

                // Sort list.
                FormVM.SortItemCustomList();

                await Task.Delay(1);
            });
        }
예제 #30
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (Path.Expression != null)
            {
                targetCommand.AddParameter("Path", Path.Get(context));
            }

            if (LiteralPath.Expression != null)
            {
                targetCommand.AddParameter("LiteralPath", LiteralPath.Get(context));
            }

            if (NewName.Expression != null)
            {
                targetCommand.AddParameter("NewName", NewName.Get(context));
            }

            if (Force.Expression != null)
            {
                targetCommand.AddParameter("Force", Force.Get(context));
            }

            if (PassThru.Expression != null)
            {
                targetCommand.AddParameter("PassThru", PassThru.Get(context));
            }

            if (Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
예제 #31
0
 public static void Main()
 {
     NewName president = new NewName ("George", "Washington");
     NewName first = new NewName ("George", "Washington");
     Console.WriteLine
             ("Should be equal, but Equals returns: {0}",                                        first.Equals(president));
     Console.Write
          ("The hash codes for first and president are: ");
     if (president.GetHashCode() == first.GetHashCode())
        Console.WriteLine("equal");
     else
        Console.WriteLine("not equal");
     Dictionary<NewName, String> m = new Dictionary<NewName, String>();
     m.Add(president, "first");
     Console.WriteLine
      ("Should contain George Washington, and ContainsKey returns: "
                                        + m.ContainsKey(first));
     Console.WriteLine
     ("Should find 'first', and m[first] returns: "
                                               + m[first]);
     Console.WriteLine
        ("ToString overridden so first is: " + first);
 }