<Window.Resources> <ControlTemplate x:Key="TextboxWithWatermark" TargetType="{x:Type TextBox}"> <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" Background="{TemplateBinding Background}"> <Grid> <ScrollViewer x:Name="PART_ContentHost" Focusable="False" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/> <TextBlock Cursor="IBeam" VerticalAlignment="Top" x:Name="HintPresenter" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontWeight="{TemplateBinding FontWeight}" Margin="5,0,5,0" HorizontalAlignment="Left" Foreground="{TemplateBinding Foreground}" FontStyle="Italic" Opacity="0" Text="{TemplateBinding ToolTip}"/> </Grid> </Border> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Opacity" TargetName="border" Value="0.56"/> </Trigger> <Trigger Property="Text" Value="" > <Setter Property="Opacity" TargetName="HintPresenter" Value="0.5"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Window.Resources> <Grid x:Name="MainGrid"> <StackPanel Margin="10" Width="150" HorizontalAlignment="Left"> <Label Content="Information"/> <TextBox Template="{DynamicResource TextboxWithWatermark}" ToolTip="First name" Margin="1"/> <TextBox Template="{DynamicResource TextboxWithWatermark}" ToolTip="Last name" Margin="1"/> <TextBox Template="{DynamicResource TextboxWithWatermark}" ToolTip="Address" Margin="1"/> <TextBox Template="{DynamicResource TextboxWithWatermark}" ToolTip="E-mail address" Margin="1"/> <TextBox Template="{DynamicResource TextboxWithWatermark}" ToolTip="Tel" Margin="1"/> <Button Content="Send" HorizontalAlignment="Right"/> </StackPanel> </Grid>
private bool runNormal() { try { //Do Somthing normal , if run by admin it dosen't work ////Map Network Driver for user } catch { return false; } } private bool runAdmin() { try { //Do Somthing advance, if run by NormalUser it dosen't work //Unlock Folder Form Deny Everyone To acessWrite //Ex. "C:// Programs file" or "%UserProfile%\Download" //Unlock User Folder to possible for Write } catch { return false; } } public void StartMainProcess() { if (runNormal() && runAdmin()) { //Afert Unlock UserFile, //Afert Map Network Drive //Continue to tranfer all file form mapped NW. Drive //To unlocked Folder // then Lock folders again (byadmin) // and remove network drive (byuser) // Finally User can only read and excute folder } }
private bool runNormal(){ try { //Do Somthing normal , if run by admin it dosen't work ////Map Network Driver for user } catch { return false; }}private bool runAdmin(){ try { //Do Somthing advance, if run by NormalUser it dosen't work //Unlock Folder Form Deny Everyone To acessWrite //Ex. "C:// Programs file" or "%UserProfile%\Download" //Unlock User Folder to possible for Write } catch { return false; }}public void StartMainProcess(){ if (runNormal() && runAdmin()) { //Afert Unlock UserFile, //Afert Map Network Drive //Continue to tranfer all file form mapped NW. Drive //To unlocked Folder // then Lock folders again (byadmin) // and remove network drive (byuser) // Finally User can only read and excute folder }}
if (excelPrj != null) { if (System.IO.File.Exists(brokenFile)) { Wtime = System.IO.File.GetLastWriteTime(brokenFile); System.IO.File.Delete(brokenFile); } excelPrj.SaveAs(brokenFile, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookDefault, miss, miss,false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive,miss, miss, miss, miss, miss); excelPrj.Close(true); System.IO.File.SetLastWriteTime(brokenFile, Wtime); }