List of projectsPORTFOLIO -

WPF LiveShaping

I’ve been working hard for few days in a row. I was coding project using c# and WPF, so I refreshed my skills and got a lot of new information.
Main trouble was with LiveShaping. For future use I leave here few important notes for myself:

1. Every collection has default CollectionView interface:

_view = CollectionViewSource.GetDefaultView(Model);

2. To create new alternate view (for grouping, sorting and filtering):

_view = new CollectionViewSource { Source = Model }.View;

3. It is possible to create CollectionViewSource declaratively (and should be created in proper view XAML file for MVVM paradigm):

<CollectionViewSource x:Key="_cvs" IsLiveFilteringRequested="True" Source="{Binding Model}" >
<CollectionViewSource.LiveFilteringProperties>
<System:String>Active</System:String>
</CollectionViewSource.LiveFilteringProperties>
</CollectionViewSource>

BUT!!! here is BIG problem for filtering. LiveFilteringProperties is just set of properties to watch for but real filtering should be placed in event handler described in ‘Filter’ attribute.
So anyway you must have code behind, e.g:


_view.Filter = obj => ((SomeViewModel)obj).Model.Active;
var liveview = (ICollectionViewLiveShaping)_activeView;
liveview.LiveFilteringProperties.Add("Model.Active");
liveview.IsLiveFiltering = true;

_view could be defined as property of type ICollectionView and could be bound to elemets insted of original datasource.

P.S. useful links:

http://stackoverflow.com/questions/20888619/proper-way-to-use-collectionviewsource-in-viewmodel

http://www.spikie.be/blog/post/2012/04/12/Filtering-collections-from-XAML-using-CollectionViewSource.aspx

http://stackoverflow.com/questions/16634194/wpf-multiple-collectionview-with-different-filters-on-same-collection

http://blogs.microsoft.co.il/pavely/2011/10/02/wpf-45-new-feature-live-shaping/

http://www.jonathanantoine.com/2011/10/05/wpf-4-5-%E2%80%93-part-10-live-shaping/

https://www.codeproject.com/articles/442498/multi-filtered-wpf-datagrid-with-mvvm

 

UPDATE

I also find very useful information on topic why my lambda expression passed to RelayCommand canExecute won’t work as I’ve expected:

The non-generic implementation of RelayCommand (in MVVM Light) does not accept a parameter. Use RelayCommand<Object> instead, or (even better) RelayCommand<YourCustomType>so the parameter to SomeFunc is strongly typed.

By admin on February 7, 2017 | Uncategorized | A comment?

Woooooooo!

I installed Woo Commerce plugin for testing purposes as there is high demand on it at freelance job feed.

By admin on November 9, 2016 | Uncategorized | A comment?

Grayscale test

Sample how to use grayscale CSS3 styles:

switch grayscale

By admin on | Uncategorized | A comment?

BackUp script

ok guys! just a little code I used at my hosting. Due to one day there was data loss and there was huge problem to get native hosting backups via support. So I code my own one and set it up at crontab.

#!/bin/bash

###########################################################################
# var settings

homedir=”/home/myhomedir”
backupdir=$homedir/backup

sitelist=”mysitenumberone.com myanothersite.com”

ts=`date “+%Y%m%d%H%M%S”`
curbackupdir=$backupdir/$ts”_site”

t_now=`date “+%s”`
max_age=$((60*60*24*15))

###########################################################################
# main code

echo Starting backup for sites…
mkdir $curbackupdir
for site in $sitelist; do
tar -czf $curbackupdir/$site.tar.gz -C $homedir $site
echo :: $site saved as $curbackupdir/$site.tar.gz
done
echo Backup succesfully finished!

echo “————————————-”

echo Checking old archives…
for f in $backupdir/*
do
if [[ $f =~ [0-9]{12}_site ]];
then
t_atime=`stat -f %a $f`
age=$(($t_now – $t_atime))
if (( $age > $max_age ));
then
echo $f is too old!!! DELETE!
rm -f -r $f
else
echo $f is ok
fi
fi
done
echo Checking finished!

IMPORTANT NOTE! Variable `sitelist’ actually contains names of the folders for corresponding web-sites at my shared virtual hosting server but NOT web-site domain names itself.

I also use little modification for backing up databases at separate script, because databases have much less size but need to be saved more often.

hope it could be useful for some newbies at least 😉
have fun!

By admin on November 26, 2015 | Uncategorized | 2 comments

stackoverfloooooooow!

now at stackoverflow too:


profile for Pavel Sokolov at Stack Overflow, Q&A for professional and enthusiast programmers

By admin on November 14, 2015 | Uncategorized | A comment?

GitHub

Finally, I registered at for developing purposes.
Still under hard coding new web site for my art studio.

By admin on November 11, 2015 | Uncategorized | A comment?

My new job

For few years I have no access to bshellz.net access for some reason.
Now I am back and it’s a good news – I am working at art-tehnika.ru now!

By admin on November 7, 2015 | Uncategorized | A comment?

Slit Shot

I am not sure is it slit shot at all, but I try to make something like here

Get Adobe Flash player

 

Usage: 1. allow FP to use your webcam 2. Push “Capture” button and try to move a little 3. Save picture!

 

Result: may depend on your webcam and total PC performance.

 

Here is some real pics below 😉

 

DrugFace2 DrugFace3 DrugFace4 DrugFace5

 

P.S. special for KPOBa 🙂

 

By admin on March 5, 2013 | Uncategorized | A comment?

Time to test!

one more test from WP flugin

By admin on February 18, 2013 | Uncategorized
Tags: