In my code I have a implemented method which in some cases can append new text for existing archive entry. But when I tried this code it gives me a System.ArgumentException: 'An item with the same key has already been added. Key: dir/file.csv'. This exception occurs in situations when given entryName will be something like this 'dir//file.csv''. This small difference does not allow archive.GetEntry(entryName) return something else then null.
public void Insert(Stream stream, string entryName, bool append = false)
{
using var baseStream = FileSystem.FileStream.New(ArchivePath, FileMode.Open, FileAccess.ReadWrite);
using var archive = new ZipArchive(baseStream, ZipArchiveMode.Update, false, null, compressionSettings, encryptionSettings);
var entry = archive.GetEntry(entryName); // null
var entryStream = append
? entry?.Open() ?? archive.CreateEntry(entryName).Open() //exception cause already exists
: archive.CreateEntry(entryName).Open();
stream.Position = 0;
if (append) entryStream.Seek(0, SeekOrigin.End);
stream.CopyTo(entryStream);
entryStream.Flush();
}
I am learning game programming in C# with WPF using MSVS-2022.
For this MSVS-2022 offers two types of project:
WPF Application
I googles these and still cannot figure out what is the difference - they both are for WPF application,
Which one is more suitable for game programming?
And will the code written using WPF Application - could it be copied to a WPF App (.NET Framework) and run without corrections?
Hello everyone,
on my WPF application I have to use a WizardPages component to make a configuration. These configuration (and the relative pages) may changes based on a combobox item selectable on the first WizardPage (a page in common for all configurations).
My question is.... It's possible to add WizardPages dynamically based on the selection on the combobox of first page?
Thank you
Hi, we have implemented the ExportToXlsx method and it worked really well out the box.. however we are utilising the paging method (also the group before paging too) and would like the export to give us all the data returned - this is present in the dataset, so no additional call is needed to get more pages.
Any assistance would be great.
Matthew
Hi Team,
I followed the online documentation of RadPersistenceFramework to persist the selected fields of RadPivotFieldList. It doesn't work! Here's my code.
--xmal
<pivot:RadPivotFieldList x:Name="pfAttributes" Grid.Row="0" telerik:PersistenceManager.StorageId="pvFields"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="250"
DataProvider="{StaticResource DataProviderKeyMetrics}" />
--save layout
IsolatedStorageProvider isoStorageProvider = new IsolatedStorageProvider();
isoStorageProvider.SaveToStorage();
-- load layout
IsolatedStorageProvider isoStorageProvider = new IsolatedStorageProvider();
Thanks,
Currently I'm using a ProjectItem classes and FileItem classes into a RadTreeView for displaying the ProjectItem content. And when I'm trying to handle the Edited event, there occurs a problem with Old and New value, in case that given objects to RadTreeView.ItemsSource will be a reference type, it might create a problem.
I would like to handle the Edited event for checking the NewValue, and according to conditions return there a OldValue.
<tk:RadPanelBar x:Name="PanelBar" BorderThickness="0"
Padding="0 3 0 0"
tk:AnimationManager.IsAnimationEnabled="True"
SelectedItem="{Binding CurrentAnalysisCategory, Mode=TwoWay}"
ItemsSource="{Binding AnalysisCategories}"
VerticalContentAlignment="Stretch"
VerticalAlignment="Stretch">
<tk:RadPanelBar.Resources>
<DataTemplate DataType="{x:Type avm:RoutinesVm}">
<views:RoutinesPanel />
</DataTemplate>
<DataTemplate DataType="{x:Type avm:MeasurementsVm}">
<views:MeasurementsPanel/>
</DataTemplate>
<DataTemplate x:Key="ViewTemplate">
<ContentPresenter Content="{Binding}" />
</DataTemplate>
</tk:RadPanelBar.Resources>
<tk:RadPanelBar.ItemTemplate>
<HierarchicalDataTemplate
ItemsSource="{Binding Data}"
ItemTemplate="{StaticResource ViewTemplate}">
<TextBlock Text="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</HierarchicalDataTemplate>
</tk:RadPanelBar.ItemTemplate>
<tk:RadPanelBar.ItemContainerStyle>
<Style TargetType="{x:Type tk:RadPanelBarItem}">
<Setter Property="Padding" Value="3"/>
<Setter Property="VerticalAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
<Setter Property="MinHeight" Value="0"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="MaxHeight" Value="{Binding ElementName='Root', Path=MaxItemHeight}"/>
<Setter Property="MaxWidth" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type views:ScanImagePanel}}, Path=ActualWidth}"/>
<Setter Property="tk:AnimationManager.AnimationSelector" Value="{StaticResource FastAnimator}"/>
</Style>
</tk:RadPanelBar.ItemContainerStyle>
</tk:RadPanelBar>